Comparing version 3.0.4 to 3.0.5
@@ -378,6 +378,4 @@ (function (f) { | ||
} | ||
module.exports = { | ||
new: autoConstruct, | ||
FableLog: FableLog | ||
}; | ||
module.exports = FableLog; | ||
module.exports.new = autoConstruct; | ||
module.exports.LogProviderBase = require('./Fable-Log-BaseLogger.js'); | ||
@@ -384,0 +382,0 @@ }, { |
@@ -33,3 +33,3 @@ !function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).FableLog=t()}}((function(){return function t(e,o,s){function r(a,n){if(!o[a]){if(!e[a]){var l="function"==typeof require&&require;if(!n&&l)return l(a,!0);if(i)return i(a,!0);var g=new Error("Cannot find module '"+a+"'");throw g.code="MODULE_NOT_FOUND",g}var h=o[a]={exports:{}};e[a][0].call(h.exports,(function(t){return r(e[a][1][t]||t)}),h,h.exports,t,e,o,s)}return o[a].exports}for(var i="function"==typeof require&&require,a=0;a<s.length;a++)r(s[a]);return r}({1:[function(t,e,o){e.exports= | ||
*/ | ||
class s{constructor(e,o){let s="object"==typeof e?e:{};this._Settings=s,this._Providers=t("./Fable-Log-DefaultProviders-Node.js"),this._StreamDefinitions=s.hasOwnProperty("LogStreams")?s.LogStreams:t("./Fable-Log-DefaultStreams.json"),this.logStreams=[],this.logProviders={},this.activeLogStreams={},this.logStreamsTrace=[],this.logStreamsDebug=[],this.logStreamsInfo=[],this.logStreamsWarn=[],this.logStreamsError=[],this.logStreamsFatal=[],this.datumDecorator=t=>t,this.uuid="string"==typeof s.Product?s.Product:"Default"}addLogger(t,e){if(this.activeLogStreams.hasOwnProperty(t.loggerUUID))return!1;switch(this.logStreams.push(t),this.activeLogStreams[t.loggerUUID]=!0,e){case"trace":this.logStreamsTrace.push(t);case"debug":this.logStreamsDebug.push(t);case"info":this.logStreamsInfo.push(t);case"warn":this.logStreamsWarn.push(t);case"error":this.logStreamsError.push(t);case"fatal":this.logStreamsFatal.push(t)}return!0}setDatumDecorator(t){this.datumDecorator="function"==typeof t?t:t=>t}trace(t,e){const o=this.datumDecorator(e);for(let e=0;e<this.logStreamsTrace.length;e++)this.logStreamsTrace[e].trace(t,o)}debug(t,e){const o=this.datumDecorator(e);for(let e=0;e<this.logStreamsDebug.length;e++)this.logStreamsDebug[e].debug(t,o)}info(t,e){const o=this.datumDecorator(e);for(let e=0;e<this.logStreamsInfo.length;e++)this.logStreamsInfo[e].info(t,o)}warn(t,e){const o=this.datumDecorator(e);for(let e=0;e<this.logStreamsWarn.length;e++)this.logStreamsWarn[e].warn(t,o)}error(t,e){const o=this.datumDecorator(e);for(let e=0;e<this.logStreamsError.length;e++)this.logStreamsError[e].error(t,o)}fatal(t,e){const o=this.datumDecorator(e);for(let e=0;e<this.logStreamsFatal.length;e++)this.logStreamsFatal[e].fatal(t,o)}initialize(){for(let t=0;t<this._StreamDefinitions.length;t++){let e=Object.assign({loggertype:"default",streamtype:"console",level:"info"},this._StreamDefinitions[t]);this._Providers.hasOwnProperty(e.loggertype)?this.addLogger(new this._Providers[e.loggertype](e,this),e.level):console.log(`Error initializing log stream: bad loggertype in stream definition ${JSON.stringify(e)}`)}for(let t=0;t<this.logStreams.length;t++)this.logStreams[t].initialize()}logTime(t,e){let o=void 0!==t?t:"Time",s=new Date;this.info(`${o} ${s} (epoch ${+s})`,e)}getTimeStamp(){return+new Date}getTimeDelta(t){return+new Date-t}logTimeDelta(t,e,o){let s=void 0!==e?e:"Time Measurement",r=+new Date;this.info(`${s} logged at (epoch ${+r}) took (${t}ms)`,o)}logTimeDeltaHuman(t,e,o){let s=void 0!==e?e:"Time Measurement",r=+new Date,i=parseInt(t%1e3),a=parseInt(t/1e3%60),n=parseInt(t/6e4%60),l=parseInt(t/36e5);i=i<10?"00"+i:i<100?"0"+i:i,a=a<10?"0"+a:a,n=n<10?"0"+n:n,l=l<10?"0"+l:l,this.info(`${s} logged at (epoch ${+r}) took (${t}ms) or (${l}:${n}:${a}.${i})`,o)}logTimeDeltaRelative(t,e,o){this.logTimeDelta(this.getTimeDelta(t),e,o)}logTimeDeltaRelativeHuman(t,e,o){this.logTimeDeltaHuman(this.getTimeDelta(t),e,o)}}e.exports={new:function(t){return new s(t)},FableLog:s},e.exports.LogProviderBase=t("./Fable-Log-BaseLogger.js")},{"./Fable-Log-BaseLogger.js":1,"./Fable-Log-DefaultProviders-Node.js":3,"./Fable-Log-DefaultStreams.json":4}]},{},[2])(2)})); | ||
class s{constructor(e,o){let s="object"==typeof e?e:{};this._Settings=s,this._Providers=t("./Fable-Log-DefaultProviders-Node.js"),this._StreamDefinitions=s.hasOwnProperty("LogStreams")?s.LogStreams:t("./Fable-Log-DefaultStreams.json"),this.logStreams=[],this.logProviders={},this.activeLogStreams={},this.logStreamsTrace=[],this.logStreamsDebug=[],this.logStreamsInfo=[],this.logStreamsWarn=[],this.logStreamsError=[],this.logStreamsFatal=[],this.datumDecorator=t=>t,this.uuid="string"==typeof s.Product?s.Product:"Default"}addLogger(t,e){if(this.activeLogStreams.hasOwnProperty(t.loggerUUID))return!1;switch(this.logStreams.push(t),this.activeLogStreams[t.loggerUUID]=!0,e){case"trace":this.logStreamsTrace.push(t);case"debug":this.logStreamsDebug.push(t);case"info":this.logStreamsInfo.push(t);case"warn":this.logStreamsWarn.push(t);case"error":this.logStreamsError.push(t);case"fatal":this.logStreamsFatal.push(t)}return!0}setDatumDecorator(t){this.datumDecorator="function"==typeof t?t:t=>t}trace(t,e){const o=this.datumDecorator(e);for(let e=0;e<this.logStreamsTrace.length;e++)this.logStreamsTrace[e].trace(t,o)}debug(t,e){const o=this.datumDecorator(e);for(let e=0;e<this.logStreamsDebug.length;e++)this.logStreamsDebug[e].debug(t,o)}info(t,e){const o=this.datumDecorator(e);for(let e=0;e<this.logStreamsInfo.length;e++)this.logStreamsInfo[e].info(t,o)}warn(t,e){const o=this.datumDecorator(e);for(let e=0;e<this.logStreamsWarn.length;e++)this.logStreamsWarn[e].warn(t,o)}error(t,e){const o=this.datumDecorator(e);for(let e=0;e<this.logStreamsError.length;e++)this.logStreamsError[e].error(t,o)}fatal(t,e){const o=this.datumDecorator(e);for(let e=0;e<this.logStreamsFatal.length;e++)this.logStreamsFatal[e].fatal(t,o)}initialize(){for(let t=0;t<this._StreamDefinitions.length;t++){let e=Object.assign({loggertype:"default",streamtype:"console",level:"info"},this._StreamDefinitions[t]);this._Providers.hasOwnProperty(e.loggertype)?this.addLogger(new this._Providers[e.loggertype](e,this),e.level):console.log(`Error initializing log stream: bad loggertype in stream definition ${JSON.stringify(e)}`)}for(let t=0;t<this.logStreams.length;t++)this.logStreams[t].initialize()}logTime(t,e){let o=void 0!==t?t:"Time",s=new Date;this.info(`${o} ${s} (epoch ${+s})`,e)}getTimeStamp(){return+new Date}getTimeDelta(t){return+new Date-t}logTimeDelta(t,e,o){let s=void 0!==e?e:"Time Measurement",r=+new Date;this.info(`${s} logged at (epoch ${+r}) took (${t}ms)`,o)}logTimeDeltaHuman(t,e,o){let s=void 0!==e?e:"Time Measurement",r=+new Date,i=parseInt(t%1e3),a=parseInt(t/1e3%60),n=parseInt(t/6e4%60),l=parseInt(t/36e5);i=i<10?"00"+i:i<100?"0"+i:i,a=a<10?"0"+a:a,n=n<10?"0"+n:n,l=l<10?"0"+l:l,this.info(`${s} logged at (epoch ${+r}) took (${t}ms) or (${l}:${n}:${a}.${i})`,o)}logTimeDeltaRelative(t,e,o){this.logTimeDelta(this.getTimeDelta(t),e,o)}logTimeDeltaRelativeHuman(t,e,o){this.logTimeDeltaHuman(this.getTimeDelta(t),e,o)}}e.exports=s,e.exports.new=function(t){return new s(t)},e.exports.LogProviderBase=t("./Fable-Log-BaseLogger.js")},{"./Fable-Log-BaseLogger.js":1,"./Fable-Log-DefaultProviders-Node.js":3,"./Fable-Log-DefaultStreams.json":4}]},{},[2])(2)})); | ||
//# sourceMappingURL=fable-log.min.js.map |
{ | ||
"name": "fable-log", | ||
"version": "3.0.4", | ||
"version": "3.0.5", | ||
"description": "A simple logging wrapper.", | ||
@@ -5,0 +5,0 @@ "main": "source/Fable-Log.js", |
@@ -238,3 +238,4 @@ /** | ||
module.exports = {new:autoConstruct, FableLog:FableLog}; | ||
module.exports = FableLog; | ||
module.exports.new = autoConstruct; | ||
module.exports.LogProviderBase = require('./Fable-Log-BaseLogger.js'); |
@@ -13,3 +13,3 @@ /** | ||
var libFableLog = require('../source/Fable-Log.js').FableLog; | ||
var libFableLog = require('../source/Fable-Log.js'); | ||
@@ -45,2 +45,12 @@ suite | ||
( | ||
'old new object should still work', | ||
function() | ||
{ | ||
var tmpFableLog = libFableLog.new(); | ||
Expect(tmpFableLog) | ||
.to.be.an('object', 'Fable-Log should initialize as an object directly from the require statement.'); | ||
} | ||
); | ||
test | ||
( | ||
'basic class parameters', | ||
@@ -47,0 +57,0 @@ function() |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
101907
1410