Comparing version 2.0.7 to 3.0.0
@@ -8,8 +8,40 @@ { | ||
{ | ||
"type": "node", | ||
"name": "Launch Debug Harness", | ||
"type": "pwa-node", | ||
"request": "launch", | ||
"name": "Launch Program", | ||
"program": "${workspaceFolder}/debug/Harness.js" | ||
"outputCapture": "std", | ||
"skipFiles": [ | ||
"<node_internals>/**" | ||
], | ||
"program": "${workspaceFolder}/debug/Harness.js", | ||
"presentation": { | ||
"hidden": false, | ||
"group": "", | ||
"order": 1 | ||
} | ||
}, | ||
{ | ||
"name": "Mocha Tests", | ||
"args": [ | ||
"-u", | ||
"tdd", | ||
"--timeout", | ||
"999999", | ||
"--colors", | ||
"${workspaceFolder}/test" | ||
], | ||
"internalConsoleOptions": "openOnSessionStart", | ||
"program": "${workspaceFolder}/node_modules/mocha/bin/_mocha", | ||
"request": "launch", | ||
"skipFiles": [ | ||
"<node_internals>/**" | ||
], | ||
"type": "pwa-node", | ||
"presentation": { | ||
"hidden": false, | ||
"group": "", | ||
"order": 2 | ||
} | ||
} | ||
] | ||
} |
@@ -1,558 +0,365 @@ | ||
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.FableLog = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){ | ||
/** | ||
* Random Byte Generator - Browser version | ||
* | ||
* @license MIT | ||
* | ||
* @author Steven Velozo <steven@velozo.com> | ||
*/ | ||
(function (f) { | ||
if (typeof exports === "object" && typeof module !== "undefined") { | ||
module.exports = f(); | ||
} else if (typeof define === "function" && define.amd) { | ||
define([], f); | ||
} else { | ||
var g; | ||
if (typeof window !== "undefined") { | ||
g = window; | ||
} else if (typeof global !== "undefined") { | ||
g = global; | ||
} else if (typeof self !== "undefined") { | ||
g = self; | ||
} else { | ||
g = this; | ||
} | ||
g.FableLog = f(); | ||
} | ||
})(function () { | ||
var define, module, exports; | ||
return function () { | ||
function r(e, n, t) { | ||
function o(i, f) { | ||
if (!n[i]) { | ||
if (!e[i]) { | ||
var c = "function" == typeof require && require; | ||
if (!f && c) return c(i, !0); | ||
if (u) return u(i, !0); | ||
var a = new Error("Cannot find module '" + i + "'"); | ||
throw a.code = "MODULE_NOT_FOUND", a; | ||
} | ||
var p = n[i] = { | ||
exports: {} | ||
}; | ||
e[i][0].call(p.exports, function (r) { | ||
var n = e[i][1][r]; | ||
return o(n || r); | ||
}, p, p.exports, r, e, n, t); | ||
} | ||
return n[i].exports; | ||
} | ||
for (var u = "function" == typeof require && require, i = 0; i < t.length; i++) o(t[i]); | ||
return o; | ||
} | ||
return r; | ||
}()({ | ||
1: [function (require, module, exports) { | ||
/** | ||
* Base Logger Class | ||
* | ||
* @license MIT | ||
* | ||
* @author Steven Velozo <steven@velozo.com> | ||
*/ | ||
// Adapted from node-uuid (https://github.com/kelektiv/node-uuid) | ||
// Unique ID creation requires a high quality random # generator. In the | ||
// browser this is a little complicated due to unknown quality of Math.random() | ||
// and inconsistent support for the `crypto` API. We do the best we can via | ||
// feature-detection | ||
class RandomBytes | ||
{ | ||
constructor() | ||
{ | ||
class BaseLogger { | ||
constructor(pLogStreamSettings, pFableLog) { | ||
// This should not possibly be able to be instantiated without a settings object | ||
this._Settings = pLogStreamSettings; | ||
// getRandomValues needs to be invoked in a context where "this" is a Crypto | ||
// implementation. Also, find the complete implementation of crypto on IE11. | ||
this.getRandomValues = (typeof(crypto) != 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto)) || | ||
(typeof(msCrypto) != 'undefined' && typeof window.msCrypto.getRandomValues == 'function' && msCrypto.getRandomValues.bind(msCrypto)); | ||
} | ||
// The base logger does nothing but associate a UUID with itself | ||
// We added this as the mechanism for tracking loggers to allow multiple simultaneous streams | ||
// to the same provider. | ||
this.loggerUUID = this.generateInsecureUUID(); | ||
} | ||
// WHATWG crypto RNG - http://wiki.whatwg.org/wiki/Crypto | ||
generateWhatWGBytes() | ||
{ | ||
let tmpBuffer = new Uint8Array(16); // eslint-disable-line no-undef | ||
// This is meant to generate programmatically insecure UUIDs to identify loggers | ||
generateInsecureUUID() { | ||
let tmpDate = new Date().getTime(); | ||
let tmpUUID = 'LOGSTREAM-xxxxxx-yxxxxx'.replace(/[xy]/g, pCharacter => { | ||
// Funny algorithm from w3resource that is twister-ish without the deep math and security | ||
// ..but good enough for unique log stream identifiers | ||
let tmpRandomData = (tmpDate + Math.random() * 16) % 16 | 0; | ||
tmpDate = Math.floor(tmpDate / 16); | ||
return (pCharacter == 'x' ? tmpRandomData : tmpRandomData & 0x3 | 0x8).toString(16); | ||
}); | ||
return tmpUUID; | ||
} | ||
initialize() { | ||
// No operation. | ||
} | ||
trace(pLogText, pLogObject) { | ||
this.write("trace", pLogText, pLogObject); | ||
} | ||
debug(pLogText, pLogObject) { | ||
this.write("debug", pLogText, pLogObject); | ||
} | ||
info(pLogText, pLogObject) { | ||
this.write("info", pLogText, pLogObject); | ||
} | ||
warn(pLogText, pLogObject) { | ||
this.write("warn", pLogText, pLogObject); | ||
} | ||
error(pLogText, pLogObject) { | ||
this.write("error", pLogText, pLogObject); | ||
} | ||
fatal(pLogText, pLogObject) { | ||
this.write("fatal", pLogText, pLogObject); | ||
} | ||
write(pLogLevel, pLogText, pLogObject) { | ||
// The base logger does nothing. | ||
return true; | ||
} | ||
} | ||
module.exports = BaseLogger; | ||
}, {}], | ||
2: [function (require, module, exports) { | ||
/** | ||
* Simple browser shim loader - assign the npm module to a window global automatically | ||
* | ||
* @license MIT | ||
* @author <steven@velozo.com> | ||
*/ | ||
var libNPMModuleWrapper = require('./Fable-Log.js'); | ||
if (typeof window === 'object' && !window.hasOwnProperty('FableLog')) { | ||
window.FableLog = libNPMModuleWrapper; | ||
} | ||
module.exports = libNPMModuleWrapper; | ||
}, { | ||
"./Fable-Log.js": 6 | ||
}], | ||
3: [function (require, module, exports) { | ||
/** | ||
* Default Logger Provider Function | ||
* | ||
* @license MIT | ||
* | ||
* @author Steven Velozo <steven@velozo.com> | ||
*/ | ||
this.getRandomValues(tmpBuffer); | ||
return tmpBuffer; | ||
} | ||
// Math.random()-based (RNG) | ||
generateRandomBytes() | ||
{ | ||
// | ||
// If all else fails, use Math.random(). It's fast, but is of unspecified | ||
// quality. | ||
let tmpBuffer = new Uint8Array(16); // eslint-disable-line no-undef | ||
for (let i = 0, tmpValue; i < 16; i++) | ||
{ | ||
if ((i & 0x03) === 0) | ||
{ | ||
tmpValue = Math.random() * 0x100000000; | ||
} | ||
tmpBuffer[i] = tmpValue >>> ((i & 0x03) << 3) & 0xff; | ||
} | ||
return tmpBuffer; | ||
} | ||
generate() | ||
{ | ||
if (this.getRandomValues) | ||
{ | ||
return generateWhatWGBytes(); | ||
} | ||
else | ||
{ | ||
return generateRandomBytes(); | ||
} | ||
} | ||
} | ||
module.exports = RandomBytes; | ||
},{}],2:[function(require,module,exports){ | ||
/** | ||
* Fable UUID Generator | ||
* | ||
* @license MIT | ||
* | ||
* @author Steven Velozo <steven@velozo.com> | ||
* @module Fable UUID | ||
*/ | ||
/** | ||
* Fable Solution UUID Generation Main Class | ||
* | ||
* @class FableUUID | ||
* @constructor | ||
*/ | ||
var libRandomByteGenerator = require('./Fable-UUID-Random.js') | ||
class FableUUID | ||
{ | ||
constructor(pSettings) | ||
{ | ||
// Determine if the module is in "Random UUID Mode" which means just use the random character function rather than the v4 random UUID spec. | ||
// Note this allows UUIDs of various lengths (including very short ones) although guaranteed uniqueness goes downhill fast. | ||
this._UUIDModeRandom = (typeof(pSettings) === 'object') && (pSettings.hasOwnProperty('UUIDModeRandom')) ? (pSettings.UUIDModeRandom == true) : false; | ||
// These two properties are only useful if we are in Random mode. Otherwise it generates a v4 spec | ||
// Length for "Random UUID Mode" is set -- if not set it to 8 | ||
this._UUIDLength = (typeof(pSettings) === 'object') && (pSettings.hasOwnProperty('UUIDLength')) ? (pSettings.UUIDLength + 0) : 8; | ||
// Dictionary for "Random UUID Mode" | ||
this._UUIDRandomDictionary = (typeof(pSettings) === 'object') && (pSettings.hasOwnProperty('UUIDDictionary')) ? (pSettings.UUIDDictionary + 0) : '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; | ||
this.randomByteGenerator = new libRandomByteGenerator(); | ||
// Lookup table for hex codes | ||
this._HexLookup = []; | ||
for (let i = 0; i < 256; ++i) | ||
{ | ||
this._HexLookup[i] = (i + 0x100).toString(16).substr(1); | ||
} | ||
} | ||
// Adapted from node-uuid (https://github.com/kelektiv/node-uuid) | ||
bytesToUUID(pBuffer) | ||
{ | ||
let i = 0; | ||
// join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4 | ||
return ([ | ||
this._HexLookup[pBuffer[i++]], this._HexLookup[pBuffer[i++]], | ||
this._HexLookup[pBuffer[i++]], this._HexLookup[pBuffer[i++]], '-', | ||
this._HexLookup[pBuffer[i++]], this._HexLookup[pBuffer[i++]], '-', | ||
this._HexLookup[pBuffer[i++]], this._HexLookup[pBuffer[i++]], '-', | ||
this._HexLookup[pBuffer[i++]], this._HexLookup[pBuffer[i++]], '-', | ||
this._HexLookup[pBuffer[i++]], this._HexLookup[pBuffer[i++]], this._HexLookup[pBuffer[i++]], this._HexLookup[pBuffer[i++]], this._HexLookup[pBuffer[i++]], this._HexLookup[pBuffer[i++]] | ||
]).join(''); | ||
} | ||
// Adapted from node-uuid (https://github.com/kelektiv/node-uuid) | ||
generateUUIDv4() | ||
{ | ||
let tmpBuffer = new Array(16); | ||
var tmpRandomBytes = this.randomByteGenerator.generate(); | ||
// Per 4.4, set bits for version and `clock_seq_hi_and_reserved` | ||
tmpRandomBytes[6] = (tmpRandomBytes[6] & 0x0f) | 0x40; | ||
tmpRandomBytes[8] = (tmpRandomBytes[8] & 0x3f) | 0x80; | ||
return this.bytesToUUID(tmpRandomBytes); | ||
} | ||
// Simple random UUID generation | ||
generateRandom() | ||
{ | ||
let tmpUUID = ''; | ||
for (let i = 0; i < this._UUIDLength; i++) | ||
{ | ||
tmpUUID += this._UUIDRandomDictionary.charAt(Math.floor(Math.random() * (this._UUIDRandomDictionary.length-1))); | ||
} | ||
return tmpUUID; | ||
} | ||
// Adapted from node-uuid (https://github.com/kelektiv/node-uuid) | ||
getUUID() | ||
{ | ||
if (this._UUIDModeRandom) | ||
{ | ||
return this.generateRandom(); | ||
} | ||
else | ||
{ | ||
return this.generateUUIDv4(); | ||
} | ||
} | ||
} | ||
// This is for backwards compatibility | ||
function autoConstruct(pSettings) | ||
{ | ||
return new FableUUID(pSettings); | ||
} | ||
module.exports = {new:autoConstruct, FableUUID:FableUUID}; | ||
},{"./Fable-UUID-Random.js":1}],3:[function(require,module,exports){ | ||
/** | ||
* Base Logger Class | ||
* | ||
* @license MIT | ||
* | ||
* @author Steven Velozo <steven@velozo.com> | ||
*/ | ||
const libFableUUID = new (require('fable-uuid').FableUUID)(); | ||
class BaseLogger | ||
{ | ||
constructor(pLogStreamSettings, pFableLog) | ||
{ | ||
// This should not possibly be able to be instantiated without a settings object | ||
this._Settings = pLogStreamSettings; | ||
// The base logger does nothing but associate a UUID with itself | ||
this.loggerUUID = libFableUUID.getUUID(); | ||
} | ||
initialize() | ||
{ | ||
// No operation. | ||
} | ||
trace(pLogText, pLogObject) | ||
{ | ||
this.write("trace", pLogText, pLogObject); | ||
} | ||
debug(pLogText, pLogObject) | ||
{ | ||
this.write("debug", pLogText, pLogObject); | ||
} | ||
info(pLogText, pLogObject) | ||
{ | ||
this.write("info", pLogText, pLogObject); | ||
} | ||
warn(pLogText, pLogObject) | ||
{ | ||
this.write("warn", pLogText, pLogObject); | ||
} | ||
error(pLogText, pLogObject) | ||
{ | ||
this.write("error", pLogText, pLogObject); | ||
} | ||
fatal(pLogText, pLogObject) | ||
{ | ||
this.write("fatal", pLogText, pLogObject); | ||
} | ||
write(pLogLevel, pLogText, pLogObject) | ||
{ | ||
// The base logger does nothing. | ||
return true; | ||
} | ||
} | ||
module.exports = BaseLogger; | ||
},{"fable-uuid":2}],4:[function(require,module,exports){ | ||
/** | ||
* Default Logger Provider Function --- Browser | ||
* | ||
* @license MIT | ||
* | ||
* @author Steven Velozo <steven@velozo.com> | ||
*/ | ||
// Return the providers that are available without extensions loaded | ||
getDefaultProviders = () => | ||
{ | ||
let tmpDefaultProviders = {}; | ||
tmpDefaultProviders.console = require('./Fable-Log-Logger-Console.js'); | ||
tmpDefaultProviders.default = tmpDefaultProviders.console; | ||
return tmpDefaultProviders; | ||
} | ||
module.exports = getDefaultProviders(); | ||
},{"./Fable-Log-Logger-Console.js":6}],5:[function(require,module,exports){ | ||
module.exports=[ | ||
{ | ||
// Return the providers that are available without extensions loaded | ||
getDefaultProviders = () => { | ||
let tmpDefaultProviders = {}; | ||
tmpDefaultProviders.console = require('./Fable-Log-Logger-Console.js'); | ||
tmpDefaultProviders.default = tmpDefaultProviders.console; | ||
return tmpDefaultProviders; | ||
}; | ||
module.exports = getDefaultProviders(); | ||
}, { | ||
"./Fable-Log-Logger-Console.js": 5 | ||
}], | ||
4: [function (require, module, exports) { | ||
module.exports = [{ | ||
"loggertype": "console", | ||
"streamtype": "console", | ||
"level": "trace" | ||
} | ||
] | ||
},{}],6:[function(require,module,exports){ | ||
let libBaseLogger = require('./Fable-Log-BaseLogger.js'); | ||
}]; | ||
}, {}], | ||
5: [function (require, module, exports) { | ||
let libBaseLogger = require('./Fable-Log-BaseLogger.js'); | ||
class ConsoleLogger extends libBaseLogger { | ||
constructor(pLogStreamSettings, pFableLog) { | ||
super(pLogStreamSettings); | ||
this._ShowTimeStamps = pLogStreamSettings.hasOwnProperty('ShowTimeStamps') ? pLogStreamSettings.ShowTimeStamps == true : false; | ||
this._FormattedTimeStamps = pLogStreamSettings.hasOwnProperty('FormattedTimeStamps') ? pLogStreamSettings.FormattedTimeStamps == true : false; | ||
this._ContextMessage = pLogStreamSettings.hasOwnProperty('Context') ? ` (${pLogStreamSettings.Context})` : pFableLog._Settings.hasOwnProperty('Product') ? ` (${pFableLog._Settings.Product})` : ''; | ||
} | ||
write(pLevel, pLogText, pObject) { | ||
if (this._ShowTimeStamps && this._FormattedTimeStamps) { | ||
let tmpDate = new Date().toISOString(); | ||
console.log(`${tmpDate} [${pLevel}]${this._ContextMessage} ${pLogText}`); | ||
} else if (this._ShowTimeStamps) { | ||
let tmpDate = +new Date(); | ||
console.log(`${tmpDate} [${pLevel}]${this._ContextMessage} ${pLogText}`); | ||
} else { | ||
console.log(`[${pLevel}]${this._ContextMessage} ${pLogText}`); | ||
} | ||
class ConsoleLogger extends libBaseLogger | ||
{ | ||
constructor(pLogStreamSettings, pFableLog) | ||
{ | ||
super(pLogStreamSettings) | ||
// Write out the object on a separate line if it is passed in | ||
if (typeof pObject !== 'undefined') { | ||
console.log(JSON.stringify(pObject, null, 4)); | ||
} | ||
} | ||
} | ||
module.exports = ConsoleLogger; | ||
}, { | ||
"./Fable-Log-BaseLogger.js": 1 | ||
}], | ||
6: [function (require, module, exports) { | ||
/** | ||
* Fable Logging Add-on | ||
* | ||
* @license MIT | ||
* | ||
* @author Steven Velozo <steven@velozo.com> | ||
* @module Fable Logger | ||
*/ | ||
this._ShowTimeStamps = pLogStreamSettings.hasOwnProperty('ShowTimeStamps') ? (pLogStreamSettings.ShowTimeStamps == true) : false; | ||
this._FormattedTimeStamps = pLogStreamSettings.hasOwnProperty('FormattedTimeStamps') ? (pLogStreamSettings.FormattedTimeStamps == true) : false; | ||
/** | ||
* Fable Solution Log Wrapper Main Class | ||
* | ||
* @class FableLog | ||
* @constructor | ||
*/ | ||
class FableLog { | ||
constructor(pFableSettings, pFable) { | ||
let tmpSettings = typeof pFableSettings === 'object' ? pFableSettings : {}; | ||
this._Settings = tmpSettings; | ||
this._Providers = require('./Fable-Log-DefaultProviders.js'); | ||
this._StreamDefinitions = tmpSettings.hasOwnProperty('LogStreams') ? tmpSettings.LogStreams : require('./Fable-Log-DefaultStreams.json'); | ||
this.logStreams = []; | ||
this._ContextMessage = pLogStreamSettings.hasOwnProperty('Context') ? ` (${pLogStreamSettings.Context})` : | ||
pFableLog._Settings.hasOwnProperty('Product') ? ` (${pFableLog._Settings.Product})` : | ||
''; | ||
} | ||
// This object gets decorated for one-time instantiated providers that | ||
// have multiple outputs, such as bunyan. | ||
this.logProviders = {}; | ||
write(pLevel, pLogText, pObject) | ||
{ | ||
if (this._ShowTimeStamps && this._FormattedTimeStamps) | ||
{ | ||
let tmpDate = (new Date()).toISOString(); | ||
console.log(`${tmpDate} [${pLevel}]${this._ContextMessage} ${pLogText}`); | ||
} | ||
else if (this._ShowTimeStamps) | ||
{ | ||
let tmpDate = +new Date(); | ||
console.log(`${tmpDate} [${pLevel}]${this._ContextMessage} ${pLogText}`); | ||
} | ||
else | ||
{ | ||
console.log(`[${pLevel}]${this._ContextMessage} ${pLogText}`); | ||
} | ||
// A hash list of the GUIDs for each log stream, so they can't be added to the set more than one time | ||
this.activeLogStreams = {}; | ||
this.logStreamsTrace = []; | ||
this.logStreamsDebug = []; | ||
this.logStreamsInfo = []; | ||
this.logStreamsWarn = []; | ||
this.logStreamsError = []; | ||
this.logStreamsFatal = []; | ||
this.datumDecorator = pDatum => pDatum; | ||
this.uuid = typeof tmpSettings.Product === 'string' ? tmpSettings.Product : 'Default'; | ||
} | ||
addLogger(pLogger, pLevel) { | ||
// Bail out if we've already created one. | ||
if (this.activeLogStreams.hasOwnProperty(pLogger.loggerUUID)) { | ||
return false; | ||
} | ||
// Write out the object on a separate line if it is passed in | ||
if (typeof(pObject) !== 'undefined') | ||
{ | ||
console.log(JSON.stringify(pObject, null, 4)); | ||
} | ||
} | ||
// Add it to the streams and to the mutex | ||
this.logStreams.push(pLogger); | ||
this.activeLogStreams[pLogger.loggerUUID] = true; | ||
} | ||
// Make sure a kosher level was passed in | ||
switch (pLevel) { | ||
case 'trace': | ||
this.logStreamsTrace.push(pLogger); | ||
case 'debug': | ||
this.logStreamsDebug.push(pLogger); | ||
case 'info': | ||
this.logStreamsInfo.push(pLogger); | ||
case 'warn': | ||
this.logStreamsWarn.push(pLogger); | ||
case 'error': | ||
this.logStreamsError.push(pLogger); | ||
case 'fatal': | ||
this.logStreamsFatal.push(pLogger); | ||
break; | ||
} | ||
return true; | ||
} | ||
setDatumDecorator(fDatumDecorator) { | ||
if (typeof fDatumDecorator === 'function') { | ||
this.datumDecorator = fDatumDecorator; | ||
} else { | ||
this.datumDecorator = pDatum => pDatum; | ||
} | ||
} | ||
trace(pMessage, pDatum) { | ||
const tmpDecoratedDatum = this.datumDecorator(pDatum); | ||
for (let i = 0; i < this.logStreamsTrace.length; i++) { | ||
this.logStreamsTrace[i].trace(pMessage, tmpDecoratedDatum); | ||
} | ||
} | ||
debug(pMessage, pDatum) { | ||
const tmpDecoratedDatum = this.datumDecorator(pDatum); | ||
for (let i = 0; i < this.logStreamsDebug.length; i++) { | ||
this.logStreamsDebug[i].debug(pMessage, tmpDecoratedDatum); | ||
} | ||
} | ||
info(pMessage, pDatum) { | ||
const tmpDecoratedDatum = this.datumDecorator(pDatum); | ||
for (let i = 0; i < this.logStreamsInfo.length; i++) { | ||
this.logStreamsInfo[i].info(pMessage, tmpDecoratedDatum); | ||
} | ||
} | ||
warn(pMessage, pDatum) { | ||
const tmpDecoratedDatum = this.datumDecorator(pDatum); | ||
for (let i = 0; i < this.logStreamsWarn.length; i++) { | ||
this.logStreamsWarn[i].warn(pMessage, tmpDecoratedDatum); | ||
} | ||
} | ||
error(pMessage, pDatum) { | ||
const tmpDecoratedDatum = this.datumDecorator(pDatum); | ||
for (let i = 0; i < this.logStreamsError.length; i++) { | ||
this.logStreamsError[i].error(pMessage, tmpDecoratedDatum); | ||
} | ||
} | ||
fatal(pMessage, pDatum) { | ||
const tmpDecoratedDatum = this.datumDecorator(pDatum); | ||
for (let i = 0; i < this.logStreamsFatal.length; i++) { | ||
this.logStreamsFatal[i].fatal(pMessage, tmpDecoratedDatum); | ||
} | ||
} | ||
initialize() { | ||
// "initialize" each logger as defined in the logging parameters | ||
for (let i = 0; i < this._StreamDefinitions.length; i++) { | ||
let tmpStreamDefinition = Object.assign({ | ||
loggertype: 'default', | ||
streamtype: 'console', | ||
level: 'info' | ||
}, this._StreamDefinitions[i]); | ||
if (!this._Providers.hasOwnProperty(tmpStreamDefinition.loggertype)) { | ||
console.log(`Error initializing log stream: bad loggertype in stream definition ${JSON.stringify(tmpStreamDefinition)}`); | ||
} else { | ||
this.addLogger(new this._Providers[tmpStreamDefinition.loggertype](tmpStreamDefinition, this), tmpStreamDefinition.level); | ||
} | ||
} | ||
module.exports = ConsoleLogger; | ||
},{"./Fable-Log-BaseLogger.js":3}],7:[function(require,module,exports){ | ||
/** | ||
* Fable Logging Add-on | ||
* | ||
* @license MIT | ||
* | ||
* @author Steven Velozo <steven@velozo.com> | ||
* @module Fable Logger | ||
*/ | ||
// Now initialize each one. | ||
for (let i = 0; i < this.logStreams.length; i++) { | ||
this.logStreams[i].initialize(); | ||
} | ||
} | ||
logTime(pMessage, pDatum) { | ||
let tmpMessage = typeof pMessage !== 'undefined' ? pMessage : 'Time'; | ||
let tmpTime = new Date(); | ||
this.info(`${tmpMessage} ${tmpTime} (epoch ${+tmpTime})`, pDatum); | ||
} | ||
/** | ||
* Fable Solution Log Wrapper Main Class | ||
* | ||
* @class FableLog | ||
* @constructor | ||
*/ | ||
class FableLog | ||
{ | ||
constructor(pFableSettings, pFable) | ||
{ | ||
let tmpSettings = (typeof(pFableSettings) === 'object') ? pFableSettings : {} | ||
this._Settings = tmpSettings; | ||
// Get a timestamp | ||
getTimeStamp() { | ||
return +new Date(); | ||
} | ||
getTimeDelta(pTimeStamp) { | ||
let tmpEndTime = +new Date(); | ||
return tmpEndTime - pTimeStamp; | ||
} | ||
this._Providers = require('./Fable-Log-DefaultProviders.js'); | ||
// Log the delta between a timestamp, and now with a message | ||
logTimeDelta(pTimeDelta, pMessage, pDatum) { | ||
let tmpMessage = typeof pMessage !== 'undefined' ? pMessage : 'Time Measurement'; | ||
let tmpDatum = typeof pDatum === 'object' ? pDatum : {}; | ||
let tmpEndTime = +new Date(); | ||
this.info(`${tmpMessage} logged at (epoch ${+tmpEndTime}) took (${pTimeDelta}ms)`, pDatum); | ||
} | ||
logTimeDeltaHuman(pTimeDelta, pMessage, pDatum) { | ||
let tmpMessage = typeof pMessage !== 'undefined' ? pMessage : 'Time Measurement'; | ||
let tmpEndTime = +new Date(); | ||
let tmpMs = parseInt(pTimeDelta % 1000); | ||
let tmpSeconds = parseInt(pTimeDelta / 1000 % 60); | ||
let tmpMinutes = parseInt(pTimeDelta / (1000 * 60) % 60); | ||
let tmpHours = parseInt(pTimeDelta / (1000 * 60 * 60)); | ||
tmpMs = tmpMs < 10 ? "00" + tmpMs : tmpMs < 100 ? "0" + tmpMs : tmpMs; | ||
tmpSeconds = tmpSeconds < 10 ? "0" + tmpSeconds : tmpSeconds; | ||
tmpMinutes = tmpMinutes < 10 ? "0" + tmpMinutes : tmpMinutes; | ||
tmpHours = tmpHours < 10 ? "0" + tmpHours : tmpHours; | ||
this.info(`${tmpMessage} logged at (epoch ${+tmpEndTime}) took (${pTimeDelta}ms) or (${tmpHours}:${tmpMinutes}:${tmpSeconds}.${tmpMs})`, pDatum); | ||
} | ||
logTimeDeltaRelative(pStartTime, pMessage, pDatum) { | ||
this.logTimeDelta(this.getTimeDelta(pStartTime), pMessage, pDatum); | ||
} | ||
logTimeDeltaRelativeHuman(pStartTime, pMessage, pDatum) { | ||
this.logTimeDeltaHuman(this.getTimeDelta(pStartTime), pMessage, pDatum); | ||
} | ||
} | ||
this._StreamDefinitions = (tmpSettings.hasOwnProperty('LogStreams')) ? tmpSettings.LogStreams : require('./Fable-Log-DefaultStreams.json'); | ||
this.logStreams = []; | ||
// This object gets decorated for one-time instantiated providers that | ||
// have multiple outputs, such as bunyan. | ||
this.logProviders = {}; | ||
// A hash list of the GUIDs for each log stream, so they can't be added to the set more than one time | ||
this.activeLogStreams = {}; | ||
this.logStreamsTrace = []; | ||
this.logStreamsDebug = []; | ||
this.logStreamsInfo = []; | ||
this.logStreamsWarn = []; | ||
this.logStreamsError = []; | ||
this.logStreamsFatal = []; | ||
this.datumDecorator = (pDatum) => pDatum; | ||
this.uuid = (typeof(tmpSettings.Product) === 'string') ? tmpSettings.Product : 'Default'; | ||
} | ||
addLogger(pLogger, pLevel) | ||
{ | ||
// Bail out if we've already created one. | ||
if (this.activeLogStreams.hasOwnProperty(pLogger.loggerUUID)) | ||
{ | ||
return false; | ||
} | ||
// Add it to the streams and to the mutex | ||
this.logStreams.push(pLogger); | ||
this.activeLogStreams[pLogger.loggerUUID] = true; | ||
// Make sure a kosher level was passed in | ||
switch (pLevel) | ||
{ | ||
case 'trace': | ||
this.logStreamsTrace.push(pLogger); | ||
case 'debug': | ||
this.logStreamsDebug.push(pLogger); | ||
case 'info': | ||
this.logStreamsInfo.push(pLogger); | ||
case 'warn': | ||
this.logStreamsWarn.push(pLogger); | ||
case 'error': | ||
this.logStreamsError.push(pLogger); | ||
case 'fatal': | ||
this.logStreamsFatal.push(pLogger); | ||
break; | ||
} | ||
return true; | ||
} | ||
setDatumDecorator(fDatumDecorator) | ||
{ | ||
if (typeof(fDatumDecorator) === 'function') | ||
{ | ||
this.datumDecorator = fDatumDecorator; | ||
} | ||
else | ||
{ | ||
this.datumDecorator = (pDatum) => pDatum; | ||
} | ||
} | ||
trace(pMessage, pDatum) | ||
{ | ||
const tmpDecoratedDatum = this.datumDecorator(pDatum); | ||
for (let i = 0; i < this.logStreamsTrace.length; i++) | ||
{ | ||
this.logStreamsTrace[i].trace(pMessage, tmpDecoratedDatum); | ||
} | ||
} | ||
debug(pMessage, pDatum) | ||
{ | ||
const tmpDecoratedDatum = this.datumDecorator(pDatum); | ||
for (let i = 0; i < this.logStreamsDebug.length; i++) | ||
{ | ||
this.logStreamsDebug[i].debug(pMessage, tmpDecoratedDatum); | ||
} | ||
} | ||
info(pMessage, pDatum) | ||
{ | ||
const tmpDecoratedDatum = this.datumDecorator(pDatum); | ||
for (let i = 0; i < this.logStreamsInfo.length; i++) | ||
{ | ||
this.logStreamsInfo[i].info(pMessage, tmpDecoratedDatum); | ||
} | ||
} | ||
warn(pMessage, pDatum) | ||
{ | ||
const tmpDecoratedDatum = this.datumDecorator(pDatum); | ||
for (let i = 0; i < this.logStreamsWarn.length; i++) | ||
{ | ||
this.logStreamsWarn[i].warn(pMessage, tmpDecoratedDatum); | ||
} | ||
} | ||
error(pMessage, pDatum) | ||
{ | ||
const tmpDecoratedDatum = this.datumDecorator(pDatum); | ||
for (let i = 0; i < this.logStreamsError.length; i++) | ||
{ | ||
this.logStreamsError[i].error(pMessage, tmpDecoratedDatum); | ||
} | ||
} | ||
fatal(pMessage, pDatum) | ||
{ | ||
const tmpDecoratedDatum = this.datumDecorator(pDatum); | ||
for (let i = 0; i < this.logStreamsFatal.length; i++) | ||
{ | ||
this.logStreamsFatal[i].fatal(pMessage, tmpDecoratedDatum); | ||
} | ||
} | ||
initialize() | ||
{ | ||
// "initialize" each logger as defined in the logging parameters | ||
for (let i = 0; i < this._StreamDefinitions.length; i++) | ||
{ | ||
let tmpStreamDefinition = Object.assign({loggertype:'default',streamtype:'console',level:'info'},this._StreamDefinitions[i]); | ||
if (!this._Providers.hasOwnProperty(tmpStreamDefinition.loggertype)) | ||
{ | ||
console.log(`Error initializing log stream: bad loggertype in stream definition ${JSON.stringify(tmpStreamDefinition)}`); | ||
} | ||
else | ||
{ | ||
this.addLogger(new this._Providers[tmpStreamDefinition.loggertype](tmpStreamDefinition, this), tmpStreamDefinition.level); | ||
} | ||
} | ||
// Now initialize each one. | ||
for (let i = 0; i < this.logStreams.length; i++) | ||
{ | ||
this.logStreams[i].initialize(); | ||
} | ||
} | ||
logTime(pMessage, pDatum) | ||
{ | ||
let tmpMessage = (typeof(pMessage) !== 'undefined') ? pMessage : 'Time'; | ||
let tmpTime = new Date(); | ||
this.info(`${tmpMessage} ${tmpTime} (epoch ${+tmpTime})`, pDatum); | ||
} | ||
// Get a timestamp | ||
getTimeStamp() | ||
{ | ||
return +new Date(); | ||
} | ||
getTimeDelta(pTimeStamp) | ||
{ | ||
let tmpEndTime = +new Date(); | ||
return tmpEndTime-pTimeStamp; | ||
} | ||
// Log the delta between a timestamp, and now with a message | ||
logTimeDelta(pTimeDelta, pMessage, pDatum) | ||
{ | ||
let tmpMessage = (typeof(pMessage) !== 'undefined') ? pMessage : 'Time Measurement'; | ||
let tmpDatum = (typeof(pDatum) === 'object') ? pDatum : {}; | ||
let tmpEndTime = +new Date(); | ||
this.info(`${tmpMessage} logged at (epoch ${+tmpEndTime}) took (${pTimeDelta}ms)`, pDatum); | ||
} | ||
logTimeDeltaHuman(pTimeDelta, pMessage, pDatum) | ||
{ | ||
let tmpMessage = (typeof(pMessage) !== 'undefined') ? pMessage : 'Time Measurement'; | ||
let tmpEndTime = +new Date(); | ||
let tmpMs = parseInt(pTimeDelta%1000); | ||
let tmpSeconds = parseInt((pTimeDelta/1000)%60); | ||
let tmpMinutes = parseInt((pTimeDelta/(1000*60))%60); | ||
let tmpHours = parseInt(pTimeDelta/(1000*60*60)); | ||
tmpMs = (tmpMs < 10) ? "00"+tmpMs : (tmpMs < 100) ? "0"+tmpMs : tmpMs; | ||
tmpSeconds = (tmpSeconds < 10) ? "0"+tmpSeconds : tmpSeconds; | ||
tmpMinutes = (tmpMinutes < 10) ? "0"+tmpMinutes : tmpMinutes; | ||
tmpHours = (tmpHours < 10) ? "0"+tmpHours : tmpHours; | ||
this.info(`${tmpMessage} logged at (epoch ${+tmpEndTime}) took (${pTimeDelta}ms) or (${tmpHours}:${tmpMinutes}:${tmpSeconds}.${tmpMs})`, pDatum); | ||
} | ||
logTimeDeltaRelative(pStartTime, pMessage, pDatum) | ||
{ | ||
this.logTimeDelta(this.getTimeDelta(pStartTime), pMessage, pDatum); | ||
} | ||
logTimeDeltaRelativeHuman(pStartTime, pMessage, pDatum) | ||
{ | ||
this.logTimeDeltaHuman(this.getTimeDelta(pStartTime), pMessage, pDatum); | ||
} | ||
} | ||
// This is for backwards compatibility | ||
function autoConstruct(pSettings) | ||
{ | ||
return new FableLog(pSettings); | ||
} | ||
module.exports = {new:autoConstruct, FableLog:FableLog}; | ||
},{"./Fable-Log-DefaultProviders.js":4,"./Fable-Log-DefaultStreams.json":5}]},{},[7])(7) | ||
}); | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9icm93c2VyLXBhY2svX3ByZWx1ZGUuanMiLCJub2RlX21vZHVsZXMvZmFibGUtdXVpZC9zb3VyY2UvRmFibGUtVVVJRC1SYW5kb20tQnJvd3Nlci5qcyIsIm5vZGVfbW9kdWxlcy9mYWJsZS11dWlkL3NvdXJjZS9GYWJsZS1VVUlELmpzIiwic291cmNlL0ZhYmxlLUxvZy1CYXNlTG9nZ2VyLmpzIiwic291cmNlL0ZhYmxlLUxvZy1EZWZhdWx0UHJvdmlkZXJzLUJyb3dzZXIuanMiLCJzb3VyY2UvRmFibGUtTG9nLURlZmF1bHRTdHJlYW1zLmpzb24iLCJzb3VyY2UvRmFibGUtTG9nLUxvZ2dlci1Db25zb2xlLmpzIiwic291cmNlL0ZhYmxlLUxvZy5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTtBQ0FBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQT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ycztcblxuXHRcdHRoaXMuaW5mbyhgJHt0bXBNZXNzYWdlfSBsb2dnZWQgYXQgKGVwb2NoICR7K3RtcEVuZFRpbWV9KSB0b29rICgke3BUaW1lRGVsdGF9bXMpIG9yICgke3RtcEhvdXJzfToke3RtcE1pbnV0ZXN9OiR7dG1wU2Vjb25kc30uJHt0bXBNc30pYCwgcERhdHVtKTtcblx0fVxuXG5cdGxvZ1RpbWVEZWx0YVJlbGF0aXZlKHBTdGFydFRpbWUsIHBNZXNzYWdlLCBwRGF0dW0pXG5cdHtcblx0XHR0aGlzLmxvZ1RpbWVEZWx0YSh0aGlzLmdldFRpbWVEZWx0YShwU3RhcnRUaW1lKSwgcE1lc3NhZ2UsIHBEYXR1bSk7XG5cdH1cblxuXHRsb2dUaW1lRGVsdGFSZWxhdGl2ZUh1bWFuKHBTdGFydFRpbWUsIHBNZXNzYWdlLCBwRGF0dW0pXG5cdHtcblx0XHR0aGlzLmxvZ1RpbWVEZWx0YUh1bWFuKHRoaXMuZ2V0VGltZURlbHRhKHBTdGFydFRpbWUpLCBwTWVzc2FnZSwgcERhdHVtKTtcblx0fVxufVxuXG4vLyBUaGlzIGlzIGZvciBiYWNrd2FyZHMgY29tcGF0aWJpbGl0eVxuZnVuY3Rpb24gYXV0b0NvbnN0cnVjdChwU2V0dGluZ3MpXG57XG5cdHJldHVybiBuZXcgRmFibGVMb2cocFNldHRpbmdzKTtcbn1cblxuXG5tb2R1bGUuZXhwb3J0cyA9IHtuZXc6YXV0b0NvbnN0cnVjdCwgRmFibGVMb2c6RmFibGVMb2d9O1xuIl19 | ||
// This is for backwards compatibility | ||
function autoConstruct(pSettings) { | ||
return new FableLog(pSettings); | ||
} | ||
module.exports = { | ||
new: autoConstruct, | ||
FableLog: FableLog | ||
}; | ||
}, { | ||
"./Fable-Log-DefaultProviders.js": 3, | ||
"./Fable-Log-DefaultStreams.json": 4 | ||
}] | ||
}, {}, [2])(2); | ||
}); |
@@ -1,44 +0,34 @@ | ||
!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(i,n){if(!o[i]){if(!t[i]){var l="function"==typeof require&&require;if(!n&&l)return l(i,!0);if(a)return a(i,!0);var h=new Error("Cannot find module '"+i+"'");throw h.code="MODULE_NOT_FOUND",h}var g=o[i]={exports:{}};t[i][0].call(g.exports,(function(e){return s(t[i][1][e]||e)}),g,g.exports,e,t,o,r)}return o[i].exports}for(var a="function"==typeof require&&require,i=0;i<r.length;i++)s(r[i]);return s}({1:[function(e,t,o){t.exports= | ||
!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= | ||
/** | ||
* Random Byte Generator - Browser version | ||
* | ||
* @license MIT | ||
* | ||
* @author Steven Velozo <steven@velozo.com> | ||
*/ | ||
class{constructor(){this.getRandomValues="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)}generateWhatWGBytes(){let e=new Uint8Array(16);return this.getRandomValues(e),e}generateRandomBytes(){let e=new Uint8Array(16);for(let t,o=0;o<16;o++)0==(3&o)&&(t=4294967296*Math.random()),e[o]=t>>>((3&o)<<3)&255;return e}generate(){return this.getRandomValues?generateWhatWGBytes():generateRandomBytes()}}},{}],2:[function(e,t,o){ | ||
* Base Logger Class | ||
* | ||
* @license MIT | ||
* | ||
* @author Steven Velozo <steven@velozo.com> | ||
*/ | ||
class{constructor(e,t){this._Settings=e,this.loggerUUID=this.generateInsecureUUID()}generateInsecureUUID(){let e=(new Date).getTime();return"LOGSTREAM-xxxxxx-yxxxxx".replace(/[xy]/g,(t=>{let o=(e+16*Math.random())%16|0;return e=Math.floor(e/16),("x"==t?o:3&o|8).toString(16)}))}initialize(){}trace(e,t){this.write("trace",e,t)}debug(e,t){this.write("debug",e,t)}info(e,t){this.write("info",e,t)}warn(e,t){this.write("warn",e,t)}error(e,t){this.write("error",e,t)}fatal(e,t){this.write("fatal",e,t)}write(e,t,o){return!0}}},{}],2:[function(e,t,o){ | ||
/** | ||
* Fable UUID Generator | ||
* | ||
* @license MIT | ||
* | ||
* @author Steven Velozo <steven@velozo.com> | ||
* @module Fable UUID | ||
*/ | ||
var r=e("./Fable-UUID-Random.js");class s{constructor(e){this._UUIDModeRandom=!("object"!=typeof e||!e.hasOwnProperty("UUIDModeRandom"))&&1==e.UUIDModeRandom,this._UUIDLength="object"==typeof e&&e.hasOwnProperty("UUIDLength")?e.UUIDLength+0:8,this._UUIDRandomDictionary="object"==typeof e&&e.hasOwnProperty("UUIDDictionary")?e.UUIDDictionary+0:"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",this.randomByteGenerator=new r,this._HexLookup=[];for(let e=0;e<256;++e)this._HexLookup[e]=(e+256).toString(16).substr(1)}bytesToUUID(e){let t=0;return[this._HexLookup[e[t++]],this._HexLookup[e[t++]],this._HexLookup[e[t++]],this._HexLookup[e[t++]],"-",this._HexLookup[e[t++]],this._HexLookup[e[t++]],"-",this._HexLookup[e[t++]],this._HexLookup[e[t++]],"-",this._HexLookup[e[t++]],this._HexLookup[e[t++]],"-",this._HexLookup[e[t++]],this._HexLookup[e[t++]],this._HexLookup[e[t++]],this._HexLookup[e[t++]],this._HexLookup[e[t++]],this._HexLookup[e[t++]]].join("")}generateUUIDv4(){new Array(16);var e=this.randomByteGenerator.generate();return e[6]=15&e[6]|64,e[8]=63&e[8]|128,this.bytesToUUID(e)}generateRandom(){let e="";for(let t=0;t<this._UUIDLength;t++)e+=this._UUIDRandomDictionary.charAt(Math.floor(Math.random()*(this._UUIDRandomDictionary.length-1)));return e}getUUID(){return this._UUIDModeRandom?this.generateRandom():this.generateUUIDv4()}}t.exports={new:function(e){return new s(e)},FableUUID:s}},{"./Fable-UUID-Random.js":1}],3:[function(e,t,o){ | ||
* Simple browser shim loader - assign the npm module to a window global automatically | ||
* | ||
* @license MIT | ||
* @author <steven@velozo.com> | ||
*/ | ||
var r=e("./Fable-Log.js");"object"!=typeof window||window.hasOwnProperty("FableLog")||(window.FableLog=r),t.exports=r},{"./Fable-Log.js":6}],3:[function(e,t,o){ | ||
/** | ||
* Base Logger Class | ||
* | ||
* @license MIT | ||
* | ||
* @author Steven Velozo <steven@velozo.com> | ||
*/ | ||
const r=new(e("fable-uuid").FableUUID);t.exports=class{constructor(e,t){this._Settings=e,this.loggerUUID=r.getUUID()}initialize(){}trace(e,t){this.write("trace",e,t)}debug(e,t){this.write("debug",e,t)}info(e,t){this.write("info",e,t)}warn(e,t){this.write("warn",e,t)}error(e,t){this.write("error",e,t)}fatal(e,t){this.write("fatal",e,t)}write(e,t,o){return!0}}},{"fable-uuid":2}],4:[function(e,t,o){ | ||
* Default Logger Provider Function | ||
* | ||
* @license MIT | ||
* | ||
* @author Steven Velozo <steven@velozo.com> | ||
*/ | ||
getDefaultProviders=()=>{let t={};return t.console=e("./Fable-Log-Logger-Console.js"),t.default=t.console,t},t.exports=getDefaultProviders()},{"./Fable-Log-Logger-Console.js":5}],4:[function(e,t,o){t.exports=[{loggertype:"console",streamtype:"console",level:"trace"}]},{}],5:[function(e,t,o){let r=e("./Fable-Log-BaseLogger.js");t.exports=class extends r{constructor(e,t){super(e),this._ShowTimeStamps=!!e.hasOwnProperty("ShowTimeStamps")&&1==e.ShowTimeStamps,this._FormattedTimeStamps=!!e.hasOwnProperty("FormattedTimeStamps")&&1==e.FormattedTimeStamps,this._ContextMessage=e.hasOwnProperty("Context")?` (${e.Context})`:t._Settings.hasOwnProperty("Product")?` (${t._Settings.Product})`:""}write(e,t,o){if(this._ShowTimeStamps&&this._FormattedTimeStamps){let o=(new Date).toISOString();console.log(`${o} [${e}]${this._ContextMessage} ${t}`)}else if(this._ShowTimeStamps){let o=+new Date;console.log(`${o} [${e}]${this._ContextMessage} ${t}`)}else console.log(`[${e}]${this._ContextMessage} ${t}`);void 0!==o&&console.log(JSON.stringify(o,null,4))}}},{"./Fable-Log-BaseLogger.js":1}],6:[function(e,t,o){ | ||
/** | ||
* Default Logger Provider Function --- Browser | ||
* | ||
* @license MIT | ||
* | ||
* @author Steven Velozo <steven@velozo.com> | ||
*/ | ||
getDefaultProviders=()=>{let t={};return t.console=e("./Fable-Log-Logger-Console.js"),t.default=t.console,t},t.exports=getDefaultProviders()},{"./Fable-Log-Logger-Console.js":6}],5:[function(e,t,o){t.exports=[{loggertype:"console",streamtype:"console",level:"trace"}]},{}],6:[function(e,t,o){let r=e("./Fable-Log-BaseLogger.js");t.exports=class extends r{constructor(e,t){super(e),this._ShowTimeStamps=!!e.hasOwnProperty("ShowTimeStamps")&&1==e.ShowTimeStamps,this._FormattedTimeStamps=!!e.hasOwnProperty("FormattedTimeStamps")&&1==e.FormattedTimeStamps,this._ContextMessage=e.hasOwnProperty("Context")?` (${e.Context})`:t._Settings.hasOwnProperty("Product")?` (${t._Settings.Product})`:""}write(e,t,o){if(this._ShowTimeStamps&&this._FormattedTimeStamps){let o=(new Date).toISOString();console.log(`${o} [${e}]${this._ContextMessage} ${t}`)}else if(this._ShowTimeStamps){let o=+new Date;console.log(`${o} [${e}]${this._ContextMessage} ${t}`)}else console.log(`[${e}]${this._ContextMessage} ${t}`);void 0!==o&&console.log(JSON.stringify(o,null,4))}}},{"./Fable-Log-BaseLogger.js":3}],7:[function(e,t,o){ | ||
/** | ||
* Fable Logging Add-on | ||
* | ||
* @license MIT | ||
* | ||
* @author Steven Velozo <steven@velozo.com> | ||
* @module Fable Logger | ||
*/ | ||
class r{constructor(t,o){let r="object"==typeof t?t:{};this._Settings=r,this._Providers=e("./Fable-Log-DefaultProviders.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,a=parseInt(e%1e3),i=parseInt(e/1e3%60),n=parseInt(e/6e4%60),l=parseInt(e/36e5);a=a<10?"00"+a:a<100?"0"+a:a,i=i<10?"0"+i:i,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}:${i}.${a})`,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.js":4,"./Fable-Log-DefaultStreams.json":5}]},{},[7])(7)})); | ||
* Fable Logging Add-on | ||
* | ||
* @license MIT | ||
* | ||
* @author Steven Velozo <steven@velozo.com> | ||
* @module Fable Logger | ||
*/ | ||
class r{constructor(t,o){let r="object"==typeof t?t:{};this._Settings=r,this._Providers=e("./Fable-Log-DefaultProviders.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.js":3,"./Fable-Log-DefaultStreams.json":4}]},{},[2])(2)})); | ||
//# sourceMappingURL=fable-log.min.js.map |
'use strict'; | ||
// We aren't abstracting this yet but here's the ... "Config" | ||
const _CONFIG = ( | ||
{ | ||
// The input source file that should be passed to browserify: | ||
// (if you need to auto-instantiate an object, for instance) | ||
EntrypointInputSourceFile: `${__dirname}/source/Fable-Log-Browser-Shim.js`, | ||
// The name of the packaged object to be passed to browserify: | ||
// (browserify sets this to global scope and window.SOMEOBJECTNAMEHERE where SOMEOBJECTNAMEHERE is the string below) | ||
LibraryObjectName: `FableLog`, | ||
// The folder to write the library files and maps out to: | ||
LibraryOutputFolder: `${__dirname}/dist/`, | ||
// The name of the unminified version of the packaged library, for easy debugging: | ||
LibraryUniminifiedFileName: `fable-log.js`, | ||
// The name of the minified version of the packaged library, for production release: | ||
LibraryMinifiedFileName: `fable-log.min.js` | ||
}); | ||
// ---> Boilerplate Browser Uglification and Packaging <--- \\ | ||
const libBrowserify = require('browserify'); | ||
@@ -9,35 +32,31 @@ const libGulp = require('gulp'); | ||
const libTerser = require('gulp-terser'); | ||
const libSourcemaps = require('gulp-sourcemaps'); | ||
const libGulpUtil = require('gulp-util'); | ||
const libGulpBabel = require('gulp-babel'); | ||
const libBabel = require('gulp-babel'); | ||
const libTerser = require('gulp-terser'); | ||
// Build the module for the browser | ||
// This gulp task is taken from the gulp recipe repository: | ||
// https://github.com/gulpjs/gulp/blob/master/docs/recipes/browserify-uglify-sourcemap.md | ||
libGulp.task('minified', | ||
() => { | ||
// set up the custom browserify instance for this task | ||
var tmpBrowserify = libBrowserify( | ||
{ | ||
entries: './source/Fable-Log.js', | ||
standalone: 'FableLog', | ||
debug: true | ||
}); | ||
//tmpBrowserify.ignore('underscore'); | ||
return tmpBrowserify.bundle() | ||
.pipe(libVinylSourceStream('fable-log.min.js')) | ||
.pipe(libVinylBuffer()) | ||
.pipe(libSourcemaps.init({loadMaps: true})) | ||
// Add transformation tasks to the pipeline here. | ||
.pipe(libTerser()) | ||
.on('error', libGulpUtil.log) | ||
.pipe(libSourcemaps.write('./')) | ||
.pipe(libGulp.dest('./dist/')); | ||
() => { | ||
// set up the custom browserify instance for this task | ||
var tmpBrowserify = libBrowserify( | ||
{ | ||
entries: _CONFIG.EntrypointInputSourceFile, | ||
standalone: _CONFIG.LibraryObjectName, | ||
debug: true | ||
}); | ||
return tmpBrowserify.bundle() | ||
.pipe(libVinylSourceStream(_CONFIG.LibraryMinifiedFileName)) | ||
.pipe(libVinylBuffer()) | ||
.pipe(libSourcemaps.init({loadMaps: true})) | ||
// Add transformation tasks to the pipeline here. | ||
.pipe(libBabel()) | ||
.pipe(libTerser()) | ||
.on('error', libGulpUtil.log) | ||
.pipe(libSourcemaps.write('./')) | ||
.pipe(libGulp.dest(_CONFIG.LibraryOutputFolder)); | ||
}); | ||
// Build the module for the browser | ||
// This gulp task is taken from the gulp recipe repository: | ||
// https://github.com/gulpjs/gulp/blob/master/docs/recipes/browserify-uglify-sourcemap.md | ||
libGulp.task('debug', | ||
@@ -48,4 +67,4 @@ () => { | ||
{ | ||
entries: './source/Fable-Log.js', | ||
standalone: 'FableLog', | ||
entries: _CONFIG.EntrypointInputSourceFile, | ||
standalone: _CONFIG.LibraryObjectName, | ||
debug: true | ||
@@ -55,6 +74,7 @@ }); | ||
return tmpBrowserify.bundle() | ||
.pipe(libVinylSourceStream('fable-log.js')) | ||
.pipe(libVinylSourceStream(_CONFIG.LibraryUniminifiedFileName)) | ||
.pipe(libVinylBuffer()) | ||
.pipe(libBabel()) | ||
.on('error', libGulpUtil.log) | ||
.pipe(libGulp.dest('./dist/')); | ||
.pipe(libGulp.dest(_CONFIG.LibraryOutputFolder)); | ||
}); | ||
@@ -66,2 +86,2 @@ | ||
libGulp.series('debug', 'minified') | ||
); | ||
); |
{ | ||
"name": "fable-log", | ||
"version": "2.0.7", | ||
"version": "3.0.0", | ||
"description": "A simple logging wrapper.", | ||
@@ -8,6 +8,26 @@ "main": "source/Fable-Log.js", | ||
"start": "node source/Fable-Log.js", | ||
"coverage": "./node_modules/nyc/bin/nyc.js --reporter=lcov --reporter=text-lcov ./node_modules/mocha/bin/_mocha -- -u tdd -R spec", | ||
"test": "./node_modules/mocha/bin/_mocha -u tdd -R spec", | ||
"harness": "node debug/Harness.js" | ||
"coverage": "./node_modules/.bin/nyc --reporter=lcov --reporter=text-lcov ./node_modules/mocha/bin/_mocha -- -u tdd -R spec", | ||
"test": "./node_modules/.bin/mocha -u tdd -R spec", | ||
"build": "./node_modules/.bin/gulp build", | ||
"docker-dev-build-image": "docker build ./ -f Dockerfile_LUXURYCode -t retold/fable-log:local", | ||
"docker-dev-run": "docker run -it -d --name retold-fable-log-dev -p 30004:8080 -v \"$PWD/.config:/home/coder/.config\" -v \"$PWD:/home/coder/fable-log\" -u \"$(id -u):$(id -g)\" -e \"DOCKER_USER=$USER\" retold/fable-log:local" | ||
}, | ||
"mocha": { | ||
"diff": true, | ||
"extension": [ | ||
"js" | ||
], | ||
"package": "./package.json", | ||
"reporter": "spec", | ||
"slow": "75", | ||
"timeout": "5000", | ||
"ui": "tdd", | ||
"watch-files": [ | ||
"source/**/*.js", | ||
"test/**/*.js" | ||
], | ||
"watch-ignore": [ | ||
"lib/vendor" | ||
] | ||
}, | ||
"repository": { | ||
@@ -22,5 +42,2 @@ "type": "git", | ||
"license": "MIT", | ||
"browser": { | ||
"./source/Fable-Log-DefaultProviders.js": "./source/Fable-Log-DefaultProviders-Browser.js" | ||
}, | ||
"bugs": { | ||
@@ -31,23 +48,16 @@ "url": "https://github.com/stevenvelozo/fable-log/issues" | ||
"devDependencies": { | ||
"@babel/core": "^7.4.4", | ||
"@babel/preset-env": "^7.4.4", | ||
"async": "^2.6.2", | ||
"browserify": "^16.2.3", | ||
"chai": "4.2.0", | ||
"async": "^3.2.4", | ||
"browserify": "^17.0.0", | ||
"chai": "4.3.7", | ||
"gulp": "^4.0.2", | ||
"gulp-babel": "^8.0.0", | ||
"gulp-sourcemaps": "^2.6.5", | ||
"gulp-terser": "^1.1.7", | ||
"gulp-sourcemaps": "^3.0.0", | ||
"gulp-terser": "^2.1.0", | ||
"gulp-util": "^3.0.8", | ||
"mocha": "6.2.3", | ||
"nyc": "^14.1.0", | ||
"mocha": "10.2.0", | ||
"nyc": "^15.1.0", | ||
"vinyl-buffer": "^1.0.1", | ||
"vinyl-source-stream": "^2.0.0" | ||
}, | ||
"dependencies": { | ||
"bunyan": "^1.8.12", | ||
"bunyan-logstash-tcp": "^1.0.0", | ||
"bunyan-prettystream": "^0.1.3", | ||
"fable-uuid": "^2.0.0" | ||
} | ||
"dependencies": {} | ||
} |
@@ -8,3 +8,2 @@ /** | ||
*/ | ||
const libFableUUID = new (require('fable-uuid').FableUUID)(); | ||
@@ -19,5 +18,24 @@ class BaseLogger | ||
// The base logger does nothing but associate a UUID with itself | ||
this.loggerUUID = libFableUUID.getUUID(); | ||
// We added this as the mechanism for tracking loggers to allow multiple simultaneous streams | ||
// to the same provider. | ||
this.loggerUUID = this.generateInsecureUUID(); | ||
} | ||
// This is meant to generate programmatically insecure UUIDs to identify loggers | ||
generateInsecureUUID() | ||
{ | ||
let tmpDate = new Date().getTime(); | ||
let tmpUUID = 'LOGSTREAM-xxxxxx-yxxxxx'.replace(/[xy]/g, | ||
(pCharacter) => | ||
{ | ||
// Funny algorithm from w3resource that is twister-ish without the deep math and security | ||
// ..but good enough for unique log stream identifiers | ||
let tmpRandomData = (tmpDate + Math.random()*16)%16 | 0; | ||
tmpDate = Math.floor(tmpDate/16); | ||
return (pCharacter =='x' ? tmpRandomData : (tmpRandomData&0x3|0x8)).toString(16); | ||
}); | ||
return tmpUUID; | ||
} | ||
initialize() | ||
@@ -24,0 +42,0 @@ { |
@@ -15,5 +15,4 @@ /** | ||
tmpDefaultProviders.console = require('./Fable-Log-Logger-Console.js'); | ||
tmpDefaultProviders.bunyan = require('./Fable-Log-Logger-Bunyan.js'); | ||
tmpDefaultProviders.default = tmpDefaultProviders.bunyan; | ||
tmpDefaultProviders.default = tmpDefaultProviders.console; | ||
@@ -20,0 +19,0 @@ return tmpDefaultProviders; |
@@ -330,169 +330,3 @@ /** | ||
); | ||
suite | ||
( | ||
'Bunyan', | ||
function() | ||
{ | ||
test | ||
( | ||
'create a bunyan logger', | ||
function() | ||
{ | ||
var tmpFableLog = new libFableLog( | ||
{ | ||
LogStreams: | ||
[ | ||
{ | ||
loggertype:'bunyan', | ||
streamtype:'stdout', | ||
level:'debug' | ||
}, | ||
{ | ||
loggertype:'bunyan', | ||
level:'debug', | ||
streamtype:'file', | ||
path:'./Test-Bunyan.log' | ||
} | ||
] | ||
}); | ||
Expect(tmpFableLog) | ||
.to.be.an('object', 'Bunyan loggers should initialize properly.'); | ||
tmpFableLog.initialize(); | ||
tmpFableLog.trace('Bunyan to Trace...',{Value:"Unlikely",Status:false}); | ||
tmpFableLog.debug('Bunyan to Debug...',{Value:"Unlikely",Status:true}); | ||
tmpFableLog.info('Bunyan to Info...',{Value:"Unlikely",Status:true}); | ||
tmpFableLog.warn('Bunyan to Warning...',{Value:"Unlikely",Status:true}); | ||
tmpFableLog.error('Bunyan to Error...',{Value:"Unlikely",Status:true}); | ||
tmpFableLog.fatal('Bunyan to Fatal...',{Value:"Unlikely",Status:true}); | ||
} | ||
); | ||
test | ||
( | ||
'pretty streams', | ||
function() | ||
{ | ||
var tmpFableLog = require('../source/Fable-Log.js').new( | ||
{ | ||
LogStreams: | ||
[ | ||
{ | ||
loggertype:'bunyan', | ||
streamtype:'stdout', | ||
level:'trace' | ||
}, | ||
{ | ||
loggertype:'bunyan', | ||
level:'trace', | ||
streamtype:'prettystream' | ||
} | ||
] | ||
}); | ||
tmpFableLog.initialize(); | ||
tmpFableLog.trace('Trying out pretty streams to Trace...',{Value:"Unlikely",Status:true}); | ||
tmpFableLog.debug('Trying out pretty streams to Debug...',{Value:"Unlikely",Status:true}); | ||
tmpFableLog.info('Trying out pretty streams to Info...',{Value:"Unlikely",Status:true}); | ||
tmpFableLog.warn('Trying out pretty streams to Warning...',{Value:"Unlikely",Status:true}); | ||
tmpFableLog.error('Trying out pretty streams to Error...',{Value:"Unlikely",Status:true}); | ||
tmpFableLog.fatal('Trying out pretty streams to Fatal...',{Value:"Unlikely",Status:true}); | ||
} | ||
); | ||
test | ||
( | ||
'pretty streams default content', | ||
function() | ||
{ | ||
var tmpFableLog = require('../source/Fable-Log.js').new( | ||
{ | ||
LogStreams: | ||
[ | ||
{ | ||
loggertype:'bunyan', | ||
level:'trace', | ||
streamtype:'prettystream' | ||
} | ||
] | ||
}); | ||
tmpFableLog.initialize(); | ||
tmpFableLog.trace(); | ||
tmpFableLog.debug(); | ||
tmpFableLog.info(); | ||
tmpFableLog.warn(); | ||
tmpFableLog.error(); | ||
tmpFableLog.fatal(); | ||
} | ||
); | ||
test | ||
( | ||
'other stream output options', | ||
function() | ||
{ | ||
var tmpFableLog = require('../source/Fable-Log.js').new( | ||
{ | ||
LogStreams: | ||
[ | ||
{ | ||
loggertype:'bunyan', | ||
streamtype:'stderr', | ||
level:'trace' | ||
}, | ||
{ | ||
loggertype:'bunyan', | ||
streamtype:'process.stderr', | ||
level:'trace' | ||
}, | ||
{ | ||
loggertype:'bunyan', | ||
streamtype:'process.stdout', | ||
level:'trace' | ||
}, | ||
{ | ||
loggertype:'bunyan', | ||
level:'trace', | ||
streamtype:'prettystream' | ||
} | ||
] | ||
}); | ||
tmpFableLog.initialize(); | ||
tmpFableLog.trace('Trying out pretty streams to Trace...',{Value:"Unlikely",Status:true}); | ||
tmpFableLog.debug('Trying out pretty streams to Debug...',{Value:"Unlikely",Status:true}); | ||
tmpFableLog.info('Trying out pretty streams to Info...',{Value:"Unlikely",Status:true}); | ||
tmpFableLog.warn('Trying out pretty streams to Warning...',{Value:"Unlikely",Status:true}); | ||
tmpFableLog.error('Trying out pretty streams to Error...',{Value:"Unlikely",Status:true}); | ||
tmpFableLog.fatal('Trying out pretty streams to Fatal...',{Value:"Unlikely",Status:true}); | ||
} | ||
); | ||
test | ||
( | ||
'create a logstash stream', | ||
function() | ||
{ | ||
var tmpFableLog = require('../source/Fable-Log.js').new( | ||
{ | ||
LogStreams: | ||
[ | ||
{ | ||
loggertype:'bunyan', | ||
level:'trace' | ||
}, | ||
{ | ||
loggertype:'bunyan', | ||
streamtype:'logstash', | ||
level:'trace' | ||
} | ||
] | ||
}); | ||
tmpFableLog.initialize(); | ||
tmpFableLog.trace('Trying out pretty streams to Trace...',{Value:"Unlikely",Status:true}); | ||
tmpFableLog.debug('Trying out pretty streams to Debug...',{Value:"Unlikely",Status:true}); | ||
tmpFableLog.info('Trying out pretty streams to Info...',{Value:"Unlikely",Status:true}); | ||
tmpFableLog.warn('Trying out pretty streams to Warning...',{Value:"Unlikely",Status:true}); | ||
tmpFableLog.error('Trying out pretty streams to Error...',{Value:"Unlikely",Status:true}); | ||
tmpFableLog.fatal('Trying out pretty streams to Fatal...',{Value:"Unlikely",Status:true}); | ||
} | ||
); | ||
} | ||
); | ||
} | ||
); |
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
0
12
26
91618
1250
- Removedbunyan@^1.8.12
- Removedbunyan-logstash-tcp@^1.0.0
- Removedbunyan-prettystream@^0.1.3
- Removedfable-uuid@^2.0.0
- RemovedCBuffer@2.0.0(transitive)
- Removedbalanced-match@1.0.2(transitive)
- Removedbrace-expansion@1.1.11(transitive)
- Removedbunyan@1.8.15(transitive)
- Removedbunyan-logstash-tcp@1.0.0(transitive)
- Removedbunyan-prettystream@0.1.3(transitive)
- Removedconcat-map@0.0.1(transitive)
- Removeddtrace-provider@0.8.8(transitive)
- Removedfable-uuid@2.0.2(transitive)
- Removedglob@6.0.4(transitive)
- Removedinflight@1.0.6(transitive)
- Removedinherits@2.0.4(transitive)
- Removedminimatch@3.1.2(transitive)
- Removedminimist@1.2.8(transitive)
- Removedmkdirp@0.5.6(transitive)
- Removedmoment@2.30.1(transitive)
- Removedmv@2.1.1(transitive)
- Removednan@2.22.0(transitive)
- Removedncp@2.0.0(transitive)
- Removedonce@1.4.0(transitive)
- Removedpath-is-absolute@1.0.1(transitive)
- Removedrimraf@2.4.5(transitive)
- Removedsafe-json-stringify@1.2.0(transitive)
- Removedwrappy@1.0.2(transitive)