Comparing version 3.0.1 to 3.0.3
@@ -382,3 +382,5 @@ (function (f) { | ||
}; | ||
module.exports.LogProviderBase = require('./Fable-Log-BaseLogger.js'); | ||
}, { | ||
"./Fable-Log-BaseLogger.js": 1, | ||
"./Fable-Log-DefaultProviders-Node.js": 3, | ||
@@ -385,0 +387,0 @@ "./Fable-Log-DefaultStreams.json": 4 |
@@ -33,3 +33,3 @@ !function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).FableLog=e()}}((function(){return function e(t,o,r){function s(a,n){if(!o[a]){if(!t[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:{}};t[a][0].call(h.exports,(function(e){return s(t[a][1][e]||e)}),h,h.exports,e,t,o,r)}return o[a].exports}for(var i="function"==typeof require&&require,a=0;a<r.length;a++)s(r[a]);return s}({1:[function(e,t,o){t.exports= | ||
*/ | ||
class r{constructor(t,o){let r="object"==typeof t?t:{};this._Settings=r,this._Providers=e("./Fable-Log-DefaultProviders-Node.js"),this._StreamDefinitions=r.hasOwnProperty("LogStreams")?r.LogStreams:e("./Fable-Log-DefaultStreams.json"),this.logStreams=[],this.logProviders={},this.activeLogStreams={},this.logStreamsTrace=[],this.logStreamsDebug=[],this.logStreamsInfo=[],this.logStreamsWarn=[],this.logStreamsError=[],this.logStreamsFatal=[],this.datumDecorator=e=>e,this.uuid="string"==typeof r.Product?r.Product:"Default"}addLogger(e,t){if(this.activeLogStreams.hasOwnProperty(e.loggerUUID))return!1;switch(this.logStreams.push(e),this.activeLogStreams[e.loggerUUID]=!0,t){case"trace":this.logStreamsTrace.push(e);case"debug":this.logStreamsDebug.push(e);case"info":this.logStreamsInfo.push(e);case"warn":this.logStreamsWarn.push(e);case"error":this.logStreamsError.push(e);case"fatal":this.logStreamsFatal.push(e)}return!0}setDatumDecorator(e){this.datumDecorator="function"==typeof e?e:e=>e}trace(e,t){const o=this.datumDecorator(t);for(let t=0;t<this.logStreamsTrace.length;t++)this.logStreamsTrace[t].trace(e,o)}debug(e,t){const o=this.datumDecorator(t);for(let t=0;t<this.logStreamsDebug.length;t++)this.logStreamsDebug[t].debug(e,o)}info(e,t){const o=this.datumDecorator(t);for(let t=0;t<this.logStreamsInfo.length;t++)this.logStreamsInfo[t].info(e,o)}warn(e,t){const o=this.datumDecorator(t);for(let t=0;t<this.logStreamsWarn.length;t++)this.logStreamsWarn[t].warn(e,o)}error(e,t){const o=this.datumDecorator(t);for(let t=0;t<this.logStreamsError.length;t++)this.logStreamsError[t].error(e,o)}fatal(e,t){const o=this.datumDecorator(t);for(let t=0;t<this.logStreamsFatal.length;t++)this.logStreamsFatal[t].fatal(e,o)}initialize(){for(let e=0;e<this._StreamDefinitions.length;e++){let t=Object.assign({loggertype:"default",streamtype:"console",level:"info"},this._StreamDefinitions[e]);this._Providers.hasOwnProperty(t.loggertype)?this.addLogger(new this._Providers[t.loggertype](t,this),t.level):console.log(`Error initializing log stream: bad loggertype in stream definition ${JSON.stringify(t)}`)}for(let e=0;e<this.logStreams.length;e++)this.logStreams[e].initialize()}logTime(e,t){let o=void 0!==e?e:"Time",r=new Date;this.info(`${o} ${r} (epoch ${+r})`,t)}getTimeStamp(){return+new Date}getTimeDelta(e){return+new Date-e}logTimeDelta(e,t,o){let r=void 0!==t?t:"Time Measurement",s=+new Date;this.info(`${r} logged at (epoch ${+s}) took (${e}ms)`,o)}logTimeDeltaHuman(e,t,o){let r=void 0!==t?t:"Time Measurement",s=+new Date,i=parseInt(e%1e3),a=parseInt(e/1e3%60),n=parseInt(e/6e4%60),l=parseInt(e/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(`${r} logged at (epoch ${+s}) took (${e}ms) or (${l}:${n}:${a}.${i})`,o)}logTimeDeltaRelative(e,t,o){this.logTimeDelta(this.getTimeDelta(e),t,o)}logTimeDeltaRelativeHuman(e,t,o){this.logTimeDeltaHuman(this.getTimeDelta(e),t,o)}}t.exports={new:function(e){return new r(e)},FableLog:r}},{"./Fable-Log-DefaultProviders-Node.js":3,"./Fable-Log-DefaultStreams.json":4}]},{},[2])(2)})); | ||
class r{constructor(t,o){let r="object"==typeof t?t:{};this._Settings=r,this._Providers=e("./Fable-Log-DefaultProviders-Node.js"),this._StreamDefinitions=r.hasOwnProperty("LogStreams")?r.LogStreams:e("./Fable-Log-DefaultStreams.json"),this.logStreams=[],this.logProviders={},this.activeLogStreams={},this.logStreamsTrace=[],this.logStreamsDebug=[],this.logStreamsInfo=[],this.logStreamsWarn=[],this.logStreamsError=[],this.logStreamsFatal=[],this.datumDecorator=e=>e,this.uuid="string"==typeof r.Product?r.Product:"Default"}addLogger(e,t){if(this.activeLogStreams.hasOwnProperty(e.loggerUUID))return!1;switch(this.logStreams.push(e),this.activeLogStreams[e.loggerUUID]=!0,t){case"trace":this.logStreamsTrace.push(e);case"debug":this.logStreamsDebug.push(e);case"info":this.logStreamsInfo.push(e);case"warn":this.logStreamsWarn.push(e);case"error":this.logStreamsError.push(e);case"fatal":this.logStreamsFatal.push(e)}return!0}setDatumDecorator(e){this.datumDecorator="function"==typeof e?e:e=>e}trace(e,t){const o=this.datumDecorator(t);for(let t=0;t<this.logStreamsTrace.length;t++)this.logStreamsTrace[t].trace(e,o)}debug(e,t){const o=this.datumDecorator(t);for(let t=0;t<this.logStreamsDebug.length;t++)this.logStreamsDebug[t].debug(e,o)}info(e,t){const o=this.datumDecorator(t);for(let t=0;t<this.logStreamsInfo.length;t++)this.logStreamsInfo[t].info(e,o)}warn(e,t){const o=this.datumDecorator(t);for(let t=0;t<this.logStreamsWarn.length;t++)this.logStreamsWarn[t].warn(e,o)}error(e,t){const o=this.datumDecorator(t);for(let t=0;t<this.logStreamsError.length;t++)this.logStreamsError[t].error(e,o)}fatal(e,t){const o=this.datumDecorator(t);for(let t=0;t<this.logStreamsFatal.length;t++)this.logStreamsFatal[t].fatal(e,o)}initialize(){for(let e=0;e<this._StreamDefinitions.length;e++){let t=Object.assign({loggertype:"default",streamtype:"console",level:"info"},this._StreamDefinitions[e]);this._Providers.hasOwnProperty(t.loggertype)?this.addLogger(new this._Providers[t.loggertype](t,this),t.level):console.log(`Error initializing log stream: bad loggertype in stream definition ${JSON.stringify(t)}`)}for(let e=0;e<this.logStreams.length;e++)this.logStreams[e].initialize()}logTime(e,t){let o=void 0!==e?e:"Time",r=new Date;this.info(`${o} ${r} (epoch ${+r})`,t)}getTimeStamp(){return+new Date}getTimeDelta(e){return+new Date-e}logTimeDelta(e,t,o){let r=void 0!==t?t:"Time Measurement",s=+new Date;this.info(`${r} logged at (epoch ${+s}) took (${e}ms)`,o)}logTimeDeltaHuman(e,t,o){let r=void 0!==t?t:"Time Measurement",s=+new Date,i=parseInt(e%1e3),a=parseInt(e/1e3%60),n=parseInt(e/6e4%60),l=parseInt(e/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(`${r} logged at (epoch ${+s}) took (${e}ms) or (${l}:${n}:${a}.${i})`,o)}logTimeDeltaRelative(e,t,o){this.logTimeDelta(this.getTimeDelta(e),t,o)}logTimeDeltaRelativeHuman(e,t,o){this.logTimeDeltaHuman(this.getTimeDelta(e),t,o)}}t.exports={new:function(e){return new r(e)},FableLog:r},t.exports.LogProviderBase=e("./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.1", | ||
"version": "3.0.3", | ||
"description": "A simple logging wrapper.", | ||
@@ -5,0 +5,0 @@ "main": "source/Fable-Log.js", |
@@ -14,3 +14,3 @@ /** | ||
// This should not possibly be able to be instantiated without a settings object | ||
this._Settings = pLogStreamSettings; | ||
this._Settings = (typeof(pLogStreamSettings) == 'object') ? pLogStreamSettings : {}; | ||
@@ -17,0 +17,0 @@ // The base logger does nothing but associate a UUID with itself |
@@ -9,6 +9,6 @@ let libBaseLogger = require('./Fable-Log-BaseLogger.js'); | ||
this._ShowTimeStamps = pLogStreamSettings.hasOwnProperty('showtimestamps') ? (pLogStreamSettings.showtimestamps == true) : false; | ||
this._FormattedTimeStamps = pLogStreamSettings.hasOwnProperty('formattedtimestamps') ? (pLogStreamSettings.formattedtimestamps == true) : false; | ||
this._ShowTimeStamps = this._Settings.hasOwnProperty('showtimestamps') ? (this._Settings.showtimestamps == true) : false; | ||
this._FormattedTimeStamps = this._Settings.hasOwnProperty('formattedtimestamps') ? (this._Settings.formattedtimestamps == true) : false; | ||
this._ContextMessage = pLogStreamSettings.hasOwnProperty('Context') ? `(${pLogStreamSettings.Context})` : | ||
this._ContextMessage = this._Settings.hasOwnProperty('Context') ? `(${this._Settings.Context})` : | ||
pFableLog._Settings.hasOwnProperty('Product') ? `(${pFableLog._Settings.Product})` : | ||
@@ -18,4 +18,4 @@ 'Unnamed_Log_Context'; | ||
// Allow the user to decide what gets output to the console | ||
this._OutputLogLinesToConsole = pLogStreamSettings.hasOwnProperty('outputloglinestoconsole') ? pLogStreamSettings.outputloglinestoconsole : true; | ||
this._OutputObjectsToConsole = pLogStreamSettings.hasOwnProperty('outputobjectstoconsole') ? pLogStreamSettings.outputobjectstoconsole : true; | ||
this._OutputLogLinesToConsole = this._Settings.hasOwnProperty('outputloglinestoconsole') ? this._Settings.outputloglinestoconsole : true; | ||
this._OutputObjectsToConsole = this._Settings.hasOwnProperty('outputobjectstoconsole') ? this._Settings.outputobjectstoconsole : true; | ||
@@ -22,0 +22,0 @@ // Precompute the prefix for each level |
@@ -12,6 +12,6 @@ const libConsoleLog = require('./Fable-Log-Logger-Console.js'); | ||
// If a path isn't provided for the logfile, it tries to use the ProductName or Context | ||
this.logFileRawPath = (pLogStreamSettings.hasOwnProperty('path')) ? pLogStreamSettings.path : `./${this._ContextMessage}.log`; | ||
this.logFileRawPath = (this._Settings.hasOwnProperty('path')) ? this._Settings.path : `./${this._ContextMessage}.log`; | ||
this.logFilePath = libPath.normalize(this.logFileRawPath); | ||
this.logFileStreamOptions = (pLogStreamSettings.hasOwnProperty('fileStreamoptions')) ? pLogStreamSettings.fileStreamOptions : ( | ||
this.logFileStreamOptions = (this._Settings.hasOwnProperty('fileStreamoptions')) ? this._Settings.fileStreamOptions : ( | ||
{ | ||
@@ -18,0 +18,0 @@ "flags": "a", |
@@ -239,1 +239,2 @@ /** | ||
module.exports = {new:autoConstruct, FableLog:FableLog}; | ||
module.exports.LogProviderBase = require('./Fable-Log-BaseLogger.js'); |
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
101378
1400