Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fable-log

Package Overview
Dependencies
Maintainers
3
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fable-log - npm Package Compare versions

Comparing version 3.0.7 to 3.0.8

118

dist/fable-log.js

@@ -49,2 +49,55 @@ (function (f) {

2: [function (require, module, exports) {
/**
* Fable Core Pre-initialization Service Base
*
* For a couple services, we need to be able to instantiate them before the Fable object is fully initialized.
* This is a base class for those services.
*
* @license MIT
* @author <steven@velozo.com>
*/
class FableCoreServiceProviderBase {
constructor(pOptions, pServiceHash) {
this.fable = false;
this.options = typeof pOptions === 'object' ? pOptions : {};
this.serviceType = 'Unknown';
// The hash will be a non-standard UUID ... the UUID service uses this base class!
this.UUID = `CORESVC-${Math.floor(Math.random() * (99999 - 10000) + 10000)}`;
this.Hash = typeof pServiceHash === 'string' ? pServiceHash : `${this.UUID}`;
}
static isFableService = true;
// After fable is initialized, it would be expected to be wired in as a normal service.
connectFable(pFable) {
this.fable = pFable;
return true;
}
}
module.exports = FableCoreServiceProviderBase;
}, {}],
3: [function (require, module, exports) {
/**
* Fable Service Base
* @license MIT
* @author <steven@velozo.com>
*/
class FableServiceProviderBase {
constructor(pFable, pOptions, pServiceHash) {
this.fable = pFable;
this.options = typeof pOptions === 'object' ? pOptions : {};
this.serviceType = 'Unknown';
this.UUID = pFable.getUUID();
this.Hash = typeof pServiceHash === 'string' ? pServiceHash : `${this.UUID}`;
}
static isFableService = true;
}
module.exports = FableServiceProviderBase;
module.exports.CoreServiceProviderBase = require('./Fable-ServiceProviderBase-Preinit.js');
}, {
"./Fable-ServiceProviderBase-Preinit.js": 2
}],
4: [function (require, module, exports) {
(function (process) {

@@ -518,5 +571,5 @@ (function () {

}, {
"_process": 3
"_process": 5
}],
3: [function (require, module, exports) {
5: [function (require, module, exports) {
// shim for using process in browser

@@ -698,3 +751,3 @@ var process = module.exports = {};

}, {}],
4: [function (require, module, exports) {
6: [function (require, module, exports) {
/**

@@ -763,3 +816,3 @@ * Base Logger Class

}, {}],
5: [function (require, module, exports) {
7: [function (require, module, exports) {
/**

@@ -777,5 +830,5 @@ * Simple browser shim loader - assign the npm module to a window global automatically

}, {
"./Fable-Log.js": 10
"./Fable-Log.js": 12
}],
6: [function (require, module, exports) {
8: [function (require, module, exports) {
/**

@@ -790,3 +843,3 @@ * Default Logger Provider Function

// Return the providers that are available without extensions loaded
getDefaultProviders = () => {
var getDefaultProviders = () => {
let tmpDefaultProviders = {};

@@ -799,5 +852,5 @@ tmpDefaultProviders.console = require('./Fable-Log-Logger-Console.js');

}, {
"./Fable-Log-Logger-Console.js": 8
"./Fable-Log-Logger-Console.js": 10
}],
7: [function (require, module, exports) {
9: [function (require, module, exports) {
module.exports = [{

@@ -809,3 +862,3 @@ "loggertype": "console",

}, {}],
8: [function (require, module, exports) {
10: [function (require, module, exports) {
let libBaseLogger = require('./Fable-Log-BaseLogger.js');

@@ -856,5 +909,5 @@ class ConsoleLogger extends libBaseLogger {

}, {
"./Fable-Log-BaseLogger.js": 4
"./Fable-Log-BaseLogger.js": 6
}],
9: [function (require, module, exports) {
11: [function (require, module, exports) {
const libConsoleLog = require('./Fable-Log-Logger-Console.js');

@@ -945,25 +998,17 @@ const libFS = require('fs');

}, {
"./Fable-Log-Logger-Console.js": 8,
"./Fable-Log-Logger-Console.js": 10,
"fs": 1,
"path": 2
"path": 4
}],
10: [function (require, module, exports) {
12: [function (require, module, exports) {
/**
* Fable Logging Add-on
*
* @license MIT
*
* @author Steven Velozo <steven@velozo.com>
* @module Fable Logger
* Fable Logging Service
*/
/**
* Fable Solution Log Wrapper Main Class
*
* @class FableLog
* @constructor
*/
class FableLog {
constructor(pFableSettings, pFable) {
let tmpSettings = typeof pFableSettings === 'object' ? pFableSettings : {};
const libFableServiceProviderBase = require('fable-serviceproviderbase').CoreServiceProviderBase;
class FableLog extends libFableServiceProviderBase {
constructor(pSettings, pServiceHash) {
super(pSettings, pServiceHash);
this.serviceType = 'Logging';
let tmpSettings = typeof pSettings === 'object' ? pSettings : {};
this._Settings = tmpSettings;

@@ -1133,9 +1178,10 @@ this._Providers = require('./Fable-Log-DefaultProviders-Node.js');

}, {
"./Fable-Log-BaseLogger.js": 4,
"./Fable-Log-DefaultProviders-Node.js": 6,
"./Fable-Log-DefaultStreams.json": 7,
"./Fable-Log-Logger-Console.js": 8,
"./Fable-Log-Logger-SimpleFlatFile.js": 9
"./Fable-Log-BaseLogger.js": 6,
"./Fable-Log-DefaultProviders-Node.js": 8,
"./Fable-Log-DefaultStreams.json": 9,
"./Fable-Log-Logger-Console.js": 10,
"./Fable-Log-Logger-SimpleFlatFile.js": 11,
"fable-serviceproviderbase": 3
}]
}, {}, [5])(5);
}, {}, [7])(7);
});

@@ -1,19 +0,20 @@

!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,r,o){function i(s,l){if(!r[s]){if(!t[s]){var a="function"==typeof require&&require;if(!l&&a)return a(s,!0);if(n)return n(s,!0);var h=new Error("Cannot find module '"+s+"'");throw h.code="MODULE_NOT_FOUND",h}var g=r[s]={exports:{}};t[s][0].call(g.exports,(function(e){return i(t[s][1][e]||e)}),g,g.exports,e,t,r,o)}return r[s].exports}for(var n="function"==typeof require&&require,s=0;s<o.length;s++)i(o[s]);return i}({1:[function(e,t,r){},{}],2:[function(e,t,r){(function(e){(function(){"use strict";function r(e){if("string"!=typeof e)throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}function o(e,t){for(var r,o="",i=0,n=-1,s=0,l=0;l<=e.length;++l){if(l<e.length)r=e.charCodeAt(l);else{if(47===r)break;r=47}if(47===r){if(n===l-1||1===s);else if(n!==l-1&&2===s){if(o.length<2||2!==i||46!==o.charCodeAt(o.length-1)||46!==o.charCodeAt(o.length-2))if(o.length>2){var a=o.lastIndexOf("/");if(a!==o.length-1){-1===a?(o="",i=0):i=(o=o.slice(0,a)).length-1-o.lastIndexOf("/"),n=l,s=0;continue}}else if(2===o.length||1===o.length){o="",i=0,n=l,s=0;continue}t&&(o.length>0?o+="/..":o="..",i=2)}else o.length>0?o+="/"+e.slice(n+1,l):o=e.slice(n+1,l),i=l-n-1;n=l,s=0}else 46===r&&-1!==s?++s:s=-1}return o}var i={resolve:function(){for(var t,i="",n=!1,s=arguments.length-1;s>=-1&&!n;s--){var l;s>=0?l=arguments[s]:(void 0===t&&(t=e.cwd()),l=t),r(l),0!==l.length&&(i=l+"/"+i,n=47===l.charCodeAt(0))}return i=o(i,!n),n?i.length>0?"/"+i:"/":i.length>0?i:"."},normalize:function(e){if(r(e),0===e.length)return".";var t=47===e.charCodeAt(0),i=47===e.charCodeAt(e.length-1);return 0!==(e=o(e,!t)).length||t||(e="."),e.length>0&&i&&(e+="/"),t?"/"+e:e},isAbsolute:function(e){return r(e),e.length>0&&47===e.charCodeAt(0)},join:function(){if(0===arguments.length)return".";for(var e,t=0;t<arguments.length;++t){var o=arguments[t];r(o),o.length>0&&(void 0===e?e=o:e+="/"+o)}return void 0===e?".":i.normalize(e)},relative:function(e,t){if(r(e),r(t),e===t)return"";if((e=i.resolve(e))===(t=i.resolve(t)))return"";for(var o=1;o<e.length&&47===e.charCodeAt(o);++o);for(var n=e.length,s=n-o,l=1;l<t.length&&47===t.charCodeAt(l);++l);for(var a=t.length-l,h=s<a?s:a,g=-1,u=0;u<=h;++u){if(u===h){if(a>h){if(47===t.charCodeAt(l+u))return t.slice(l+u+1);if(0===u)return t.slice(l+u)}else s>h&&(47===e.charCodeAt(o+u)?g=u:0===u&&(g=0));break}var f=e.charCodeAt(o+u);if(f!==t.charCodeAt(l+u))break;47===f&&(g=u)}var c="";for(u=o+g+1;u<=n;++u)u!==n&&47!==e.charCodeAt(u)||(0===c.length?c+="..":c+="/..");return c.length>0?c+t.slice(l+g):(l+=g,47===t.charCodeAt(l)&&++l,t.slice(l))},_makeLong:function(e){return e},dirname:function(e){if(r(e),0===e.length)return".";for(var t=e.charCodeAt(0),o=47===t,i=-1,n=!0,s=e.length-1;s>=1;--s)if(47===(t=e.charCodeAt(s))){if(!n){i=s;break}}else n=!1;return-1===i?o?"/":".":o&&1===i?"//":e.slice(0,i)},basename:function(e,t){if(void 0!==t&&"string"!=typeof t)throw new TypeError('"ext" argument must be a string');r(e);var o,i=0,n=-1,s=!0;if(void 0!==t&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return"";var l=t.length-1,a=-1;for(o=e.length-1;o>=0;--o){var h=e.charCodeAt(o);if(47===h){if(!s){i=o+1;break}}else-1===a&&(s=!1,a=o+1),l>=0&&(h===t.charCodeAt(l)?-1==--l&&(n=o):(l=-1,n=a))}return i===n?n=a:-1===n&&(n=e.length),e.slice(i,n)}for(o=e.length-1;o>=0;--o)if(47===e.charCodeAt(o)){if(!s){i=o+1;break}}else-1===n&&(s=!1,n=o+1);return-1===n?"":e.slice(i,n)},extname:function(e){r(e);for(var t=-1,o=0,i=-1,n=!0,s=0,l=e.length-1;l>=0;--l){var a=e.charCodeAt(l);if(47!==a)-1===i&&(n=!1,i=l+1),46===a?-1===t?t=l:1!==s&&(s=1):-1!==t&&(s=-1);else if(!n){o=l+1;break}}return-1===t||-1===i||0===s||1===s&&t===i-1&&t===o+1?"":e.slice(t,i)},format:function(e){if(null===e||"object"!=typeof e)throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof e);return function(e,t){var r=t.dir||t.root,o=t.base||(t.name||"")+(t.ext||"");return r?r===t.root?r+o:r+e+o:o}("/",e)},parse:function(e){r(e);var t={root:"",dir:"",base:"",ext:"",name:""};if(0===e.length)return t;var o,i=e.charCodeAt(0),n=47===i;n?(t.root="/",o=1):o=0;for(var s=-1,l=0,a=-1,h=!0,g=e.length-1,u=0;g>=o;--g)if(47!==(i=e.charCodeAt(g)))-1===a&&(h=!1,a=g+1),46===i?-1===s?s=g:1!==u&&(u=1):-1!==s&&(u=-1);else if(!h){l=g+1;break}return-1===s||-1===a||0===u||1===u&&s===a-1&&s===l+1?-1!==a&&(t.base=t.name=0===l&&n?e.slice(1,a):e.slice(l,a)):(0===l&&n?(t.name=e.slice(1,s),t.base=e.slice(1,a)):(t.name=e.slice(l,s),t.base=e.slice(l,a)),t.ext=e.slice(s,a)),l>0?t.dir=e.slice(0,l-1):n&&(t.dir="/"),t},sep:"/",delimiter:":",win32:null,posix:null};i.posix=i,t.exports=i}).call(this)}).call(this,e("_process"))},{_process:3}],3:[function(e,t,r){var o,i,n=t.exports={};function s(){throw new Error("setTimeout has not been defined")}function l(){throw new Error("clearTimeout has not been defined")}function a(e){if(o===setTimeout)return setTimeout(e,0);if((o===s||!o)&&setTimeout)return o=setTimeout,setTimeout(e,0);try{return o(e,0)}catch(t){try{return o.call(null,e,0)}catch(t){return o.call(this,e,0)}}}!function(){try{o="function"==typeof setTimeout?setTimeout:s}catch(e){o=s}try{i="function"==typeof clearTimeout?clearTimeout:l}catch(e){i=l}}();var h,g=[],u=!1,f=-1;function c(){u&&h&&(u=!1,h.length?g=h.concat(g):f=-1,g.length&&m())}function m(){if(!u){var e=a(c);u=!0;for(var t=g.length;t;){for(h=g,g=[];++f<t;)h&&h[f].run();f=-1,t=g.length}h=null,u=!1,function(e){if(i===clearTimeout)return clearTimeout(e);if((i===l||!i)&&clearTimeout)return i=clearTimeout,clearTimeout(e);try{return i(e)}catch(t){try{return i.call(null,e)}catch(t){return i.call(this,e)}}}(e)}}function p(e,t){this.fun=e,this.array=t}function d(){}n.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];g.push(new p(e,t)),1!==g.length||u||a(m)},p.prototype.run=function(){this.fun.apply(null,this.array)},n.title="browser",n.browser=!0,n.env={},n.argv=[],n.version="",n.versions={},n.on=d,n.addListener=d,n.once=d,n.off=d,n.removeListener=d,n.removeAllListeners=d,n.emit=d,n.prependListener=d,n.prependOnceListener=d,n.listeners=function(e){return[]},n.binding=function(e){throw new Error("process.binding is not supported")},n.cwd=function(){return"/"},n.chdir=function(e){throw new Error("process.chdir is not supported")},n.umask=function(){return 0}},{}],4:[function(e,t,r){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,r,i){function o(n,l){if(!r[n]){if(!t[n]){var a="function"==typeof require&&require;if(!l&&a)return a(n,!0);if(s)return s(n,!0);var h=new Error("Cannot find module '"+n+"'");throw h.code="MODULE_NOT_FOUND",h}var g=r[n]={exports:{}};t[n][0].call(g.exports,(function(e){return o(t[n][1][e]||e)}),g,g.exports,e,t,r,i)}return r[n].exports}for(var s="function"==typeof require&&require,n=0;n<i.length;n++)o(i[n]);return o}({1:[function(e,t,r){},{}],2:[function(e,t,r){t.exports=
/**
* Base Logger Class
* Fable Core Pre-initialization Service Base
*
* For a couple services, we need to be able to instantiate them before the Fable object is fully initialized.
* This is a base class for those services.
*
* @license MIT
*
* @author Steven Velozo <steven@velozo.com>
* @author <steven@velozo.com>
*/
class{constructor(e,t){this._Settings="object"==typeof e?e:{},this.loggerUUID=this.generateInsecureUUID(),this.levels=["trace","debug","info","warn","error","fatal"]}generateInsecureUUID(){let e=(new Date).getTime();return"LOGSTREAM-xxxxxx-yxxxxx".replace(/[xy]/g,(t=>{let r=(e+16*Math.random())%16|0;return e=Math.floor(e/16),("x"==t?r:3&r|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,r){return!0}}},{}],5:[function(e,t,r){
class{constructor(e,t){this.fable=!1,this.options="object"==typeof e?e:{},this.serviceType="Unknown",this.UUID=`CORESVC-${Math.floor(89999*Math.random()+1e4)}`,this.Hash="string"==typeof t?t:`${this.UUID}`}static isFableService=!0;connectFable(e){return this.fable=e,!0}}},{}],3:[function(e,t,r){t.exports=
/**
* Simple browser shim loader - assign the npm module to a window global automatically
*
* Fable Service Base
* @license MIT
* @author <steven@velozo.com>
*/
var o=e("./Fable-Log.js");"object"!=typeof window||window.hasOwnProperty("FableLog")||(window.FableLog=o),t.exports=o},{"./Fable-Log.js":10}],6:[function(e,t,r){
class{constructor(e,t,r){this.fable=e,this.options="object"==typeof t?t:{},this.serviceType="Unknown",this.UUID=e.getUUID(),this.Hash="string"==typeof r?r:`${this.UUID}`}static isFableService=!0},t.exports.CoreServiceProviderBase=e("./Fable-ServiceProviderBase-Preinit.js")},{"./Fable-ServiceProviderBase-Preinit.js":2}],4:[function(e,t,r){(function(e){(function(){"use strict";function r(e){if("string"!=typeof e)throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}function i(e,t){for(var r,i="",o=0,s=-1,n=0,l=0;l<=e.length;++l){if(l<e.length)r=e.charCodeAt(l);else{if(47===r)break;r=47}if(47===r){if(s===l-1||1===n);else if(s!==l-1&&2===n){if(i.length<2||2!==o||46!==i.charCodeAt(i.length-1)||46!==i.charCodeAt(i.length-2))if(i.length>2){var a=i.lastIndexOf("/");if(a!==i.length-1){-1===a?(i="",o=0):o=(i=i.slice(0,a)).length-1-i.lastIndexOf("/"),s=l,n=0;continue}}else if(2===i.length||1===i.length){i="",o=0,s=l,n=0;continue}t&&(i.length>0?i+="/..":i="..",o=2)}else i.length>0?i+="/"+e.slice(s+1,l):i=e.slice(s+1,l),o=l-s-1;s=l,n=0}else 46===r&&-1!==n?++n:n=-1}return i}var o={resolve:function(){for(var t,o="",s=!1,n=arguments.length-1;n>=-1&&!s;n--){var l;n>=0?l=arguments[n]:(void 0===t&&(t=e.cwd()),l=t),r(l),0!==l.length&&(o=l+"/"+o,s=47===l.charCodeAt(0))}return o=i(o,!s),s?o.length>0?"/"+o:"/":o.length>0?o:"."},normalize:function(e){if(r(e),0===e.length)return".";var t=47===e.charCodeAt(0),o=47===e.charCodeAt(e.length-1);return 0!==(e=i(e,!t)).length||t||(e="."),e.length>0&&o&&(e+="/"),t?"/"+e:e},isAbsolute:function(e){return r(e),e.length>0&&47===e.charCodeAt(0)},join:function(){if(0===arguments.length)return".";for(var e,t=0;t<arguments.length;++t){var i=arguments[t];r(i),i.length>0&&(void 0===e?e=i:e+="/"+i)}return void 0===e?".":o.normalize(e)},relative:function(e,t){if(r(e),r(t),e===t)return"";if((e=o.resolve(e))===(t=o.resolve(t)))return"";for(var i=1;i<e.length&&47===e.charCodeAt(i);++i);for(var s=e.length,n=s-i,l=1;l<t.length&&47===t.charCodeAt(l);++l);for(var a=t.length-l,h=n<a?n:a,g=-1,c=0;c<=h;++c){if(c===h){if(a>h){if(47===t.charCodeAt(l+c))return t.slice(l+c+1);if(0===c)return t.slice(l+c)}else n>h&&(47===e.charCodeAt(i+c)?g=c:0===c&&(g=0));break}var f=e.charCodeAt(i+c);if(f!==t.charCodeAt(l+c))break;47===f&&(g=c)}var u="";for(c=i+g+1;c<=s;++c)c!==s&&47!==e.charCodeAt(c)||(0===u.length?u+="..":u+="/..");return u.length>0?u+t.slice(l+g):(l+=g,47===t.charCodeAt(l)&&++l,t.slice(l))},_makeLong:function(e){return e},dirname:function(e){if(r(e),0===e.length)return".";for(var t=e.charCodeAt(0),i=47===t,o=-1,s=!0,n=e.length-1;n>=1;--n)if(47===(t=e.charCodeAt(n))){if(!s){o=n;break}}else s=!1;return-1===o?i?"/":".":i&&1===o?"//":e.slice(0,o)},basename:function(e,t){if(void 0!==t&&"string"!=typeof t)throw new TypeError('"ext" argument must be a string');r(e);var i,o=0,s=-1,n=!0;if(void 0!==t&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return"";var l=t.length-1,a=-1;for(i=e.length-1;i>=0;--i){var h=e.charCodeAt(i);if(47===h){if(!n){o=i+1;break}}else-1===a&&(n=!1,a=i+1),l>=0&&(h===t.charCodeAt(l)?-1==--l&&(s=i):(l=-1,s=a))}return o===s?s=a:-1===s&&(s=e.length),e.slice(o,s)}for(i=e.length-1;i>=0;--i)if(47===e.charCodeAt(i)){if(!n){o=i+1;break}}else-1===s&&(n=!1,s=i+1);return-1===s?"":e.slice(o,s)},extname:function(e){r(e);for(var t=-1,i=0,o=-1,s=!0,n=0,l=e.length-1;l>=0;--l){var a=e.charCodeAt(l);if(47!==a)-1===o&&(s=!1,o=l+1),46===a?-1===t?t=l:1!==n&&(n=1):-1!==t&&(n=-1);else if(!s){i=l+1;break}}return-1===t||-1===o||0===n||1===n&&t===o-1&&t===i+1?"":e.slice(t,o)},format:function(e){if(null===e||"object"!=typeof e)throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof e);return function(e,t){var r=t.dir||t.root,i=t.base||(t.name||"")+(t.ext||"");return r?r===t.root?r+i:r+e+i:i}("/",e)},parse:function(e){r(e);var t={root:"",dir:"",base:"",ext:"",name:""};if(0===e.length)return t;var i,o=e.charCodeAt(0),s=47===o;s?(t.root="/",i=1):i=0;for(var n=-1,l=0,a=-1,h=!0,g=e.length-1,c=0;g>=i;--g)if(47!==(o=e.charCodeAt(g)))-1===a&&(h=!1,a=g+1),46===o?-1===n?n=g:1!==c&&(c=1):-1!==n&&(c=-1);else if(!h){l=g+1;break}return-1===n||-1===a||0===c||1===c&&n===a-1&&n===l+1?-1!==a&&(t.base=t.name=0===l&&s?e.slice(1,a):e.slice(l,a)):(0===l&&s?(t.name=e.slice(1,n),t.base=e.slice(1,a)):(t.name=e.slice(l,n),t.base=e.slice(l,a)),t.ext=e.slice(n,a)),l>0?t.dir=e.slice(0,l-1):s&&(t.dir="/"),t},sep:"/",delimiter:":",win32:null,posix:null};o.posix=o,t.exports=o}).call(this)}).call(this,e("_process"))},{_process:5}],5:[function(e,t,r){var i,o,s=t.exports={};function n(){throw new Error("setTimeout has not been defined")}function l(){throw new Error("clearTimeout has not been defined")}function a(e){if(i===setTimeout)return setTimeout(e,0);if((i===n||!i)&&setTimeout)return i=setTimeout,setTimeout(e,0);try{return i(e,0)}catch(t){try{return i.call(null,e,0)}catch(t){return i.call(this,e,0)}}}!function(){try{i="function"==typeof setTimeout?setTimeout:n}catch(e){i=n}try{o="function"==typeof clearTimeout?clearTimeout:l}catch(e){o=l}}();var h,g=[],c=!1,f=-1;function u(){c&&h&&(c=!1,h.length?g=h.concat(g):f=-1,g.length&&p())}function p(){if(!c){var e=a(u);c=!0;for(var t=g.length;t;){for(h=g,g=[];++f<t;)h&&h[f].run();f=-1,t=g.length}h=null,c=!1,function(e){if(o===clearTimeout)return clearTimeout(e);if((o===l||!o)&&clearTimeout)return o=clearTimeout,clearTimeout(e);try{return o(e)}catch(t){try{return o.call(null,e)}catch(t){return o.call(this,e)}}}(e)}}function m(e,t){this.fun=e,this.array=t}function d(){}s.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];g.push(new m(e,t)),1!==g.length||c||a(p)},m.prototype.run=function(){this.fun.apply(null,this.array)},s.title="browser",s.browser=!0,s.env={},s.argv=[],s.version="",s.versions={},s.on=d,s.addListener=d,s.once=d,s.off=d,s.removeListener=d,s.removeAllListeners=d,s.emit=d,s.prependListener=d,s.prependOnceListener=d,s.listeners=function(e){return[]},s.binding=function(e){throw new Error("process.binding is not supported")},s.cwd=function(){return"/"},s.chdir=function(e){throw new Error("process.chdir is not supported")},s.umask=function(){return 0}},{}],6:[function(e,t,r){t.exports=
/**
* Default Logger Provider Function
* Base Logger Class
*

@@ -24,12 +25,10 @@ * @license MIT

*/
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":8}],7:[function(e,t,r){t.exports=[{loggertype:"console",streamtype:"console",level:"trace"}]},{}],8:[function(e,t,r){let o=e("./Fable-Log-BaseLogger.js");t.exports=class extends o{constructor(e,t){super(e),this._ShowTimeStamps=!this._Settings.hasOwnProperty("showtimestamps")||1==this._Settings.showtimestamps,this._FormattedTimeStamps=!this._Settings.hasOwnProperty("formattedtimestamps")||1==this._Settings.formattedtimestamps,this._ContextMessage=this._Settings.hasOwnProperty("Context")?`(${this._Settings.Context})`:t._Settings.hasOwnProperty("Product")?`(${t._Settings.Product})`:"Unnamed_Log_Context",this._OutputLogLinesToConsole=!this._Settings.hasOwnProperty("outputloglinestoconsole")||this._Settings.outputloglinestoconsole,this._OutputObjectsToConsole=!this._Settings.hasOwnProperty("outputobjectstoconsole")||this._Settings.outputobjectstoconsole,this.prefixCache={};for(let e=0;e<=this.levels.length;e++)this.prefixCache[this.levels[e]]=`[${this.levels[e]}] ${this._ContextMessage}: `,this._ShowTimeStamps&&(this.prefixCache[this.levels[e]]=" "+this.prefixCache[this.levels[e]])}write(e,t,r){let o="";this._ShowTimeStamps&&this._FormattedTimeStamps?o=(new Date).toISOString():this._ShowTimeStamps&&(o=+new Date);let i=`${o}${this.prefixCache[e]}${t}`;return this._OutputLogLinesToConsole&&console.log(i),this._OutputObjectsToConsole&&void 0!==r&&console.log(JSON.stringify(r,null,2)),i}}},{"./Fable-Log-BaseLogger.js":4}],9:[function(e,t,r){const o=e("./Fable-Log-Logger-Console.js"),i=e("fs"),n=e("path");t.exports=class extends o{constructor(e,t){super(e,t),this.logFileRawPath=this._Settings.hasOwnProperty("path")?this._Settings.path:`./${this._ContextMessage}.log`,this.logFilePath=n.normalize(this.logFileRawPath),this.logFileStreamOptions=this._Settings.hasOwnProperty("fileStreamoptions")?this._Settings.fileStreamOptions:{flags:"a",encoding:"utf8"},this.fileWriter=i.createWriteStream(this.logFilePath,this.logFileStreamOptions),this.activelyWriting=!1,this.logLineStrings=[],this.logObjectStrings=[],this.defaultWriteCompleteCallback=()=>{},this.defaultBufferFlushCallback=()=>{}}closeWriter(e){let t="function"==typeof e?e:()=>{};if(this.fileWriter)return this.fileWriter.end("\n"),this.fileWriter.once("finish",t.bind(this))}completeBufferFlushToLogFile(e){this.activelyWriting=!1;let t="function"==typeof e?e:this.defaultBufferFlushCallback;if(!(this.logLineStrings.length>0))return t();this.flushBufferToLogFile(t)}flushBufferToLogFile(e){if(!this.activelyWriting){this.activelyWriting=!0;let t="function"==typeof e?e:this.defaultBufferFlushCallback,r=this.logLineStrings,o=this.logObjectStrings;this.logLineStrings=[],this.logObjectStrings=[];let i="";for(let e=0;e<r.length;e++)i+=`${r[e]}\n`,!1!==o[e]&&(i+=`${o[e]}\n`);if(this.fileWriter.write(i,"utf8"))return this.completeBufferFlushToLogFile(t);this.fileWriter.once("drain",this.completeBufferFlushToLogFile.bind(this,t))}}write(e,t,r){let o=super.write(e,t,r);this.logLineStrings.push(o),void 0!==r?this.logObjectStrings.push(JSON.stringify(r,null,4)):this.logObjectStrings.push(!1),this.flushBufferToLogFile()}}},{"./Fable-Log-Logger-Console.js":8,fs:1,path:2}],10:[function(e,t,r){
class{constructor(e,t){this._Settings="object"==typeof e?e:{},this.loggerUUID=this.generateInsecureUUID(),this.levels=["trace","debug","info","warn","error","fatal"]}generateInsecureUUID(){let e=(new Date).getTime();return"LOGSTREAM-xxxxxx-yxxxxx".replace(/[xy]/g,(t=>{let r=(e+16*Math.random())%16|0;return e=Math.floor(e/16),("x"==t?r:3&r|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,r){return!0}}},{}],7:[function(e,t,r){
/**
* Fable Logging Add-on
* Simple browser shim loader - assign the npm module to a window global automatically
*
* @license MIT
*
* @author Steven Velozo <steven@velozo.com>
* @module Fable Logger
* @author <steven@velozo.com>
*/
class o{constructor(t,r){let o="object"==typeof t?t:{};this._Settings=o,this._Providers=e("./Fable-Log-DefaultProviders-Node.js"),this._StreamDefinitions=o.hasOwnProperty("LogStreams")?o.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 o.Product?o.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 r=this.datumDecorator(t);for(let t=0;t<this.logStreamsTrace.length;t++)this.logStreamsTrace[t].trace(e,r)}debug(e,t){const r=this.datumDecorator(t);for(let t=0;t<this.logStreamsDebug.length;t++)this.logStreamsDebug[t].debug(e,r)}info(e,t){const r=this.datumDecorator(t);for(let t=0;t<this.logStreamsInfo.length;t++)this.logStreamsInfo[t].info(e,r)}warn(e,t){const r=this.datumDecorator(t);for(let t=0;t<this.logStreamsWarn.length;t++)this.logStreamsWarn[t].warn(e,r)}error(e,t){const r=this.datumDecorator(t);for(let t=0;t<this.logStreamsError.length;t++)this.logStreamsError[t].error(e,r)}fatal(e,t){const r=this.datumDecorator(t);for(let t=0;t<this.logStreamsFatal.length;t++)this.logStreamsFatal[t].fatal(e,r)}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 r=void 0!==e?e:"Time",o=new Date;this.info(`${r} ${o} (epoch ${+o})`,t)}getTimeStamp(){return+new Date}getTimeDelta(e){return+new Date-e}logTimeDelta(e,t,r){let o=void 0!==t?t:"Time Measurement",i=+new Date;this.info(`${o} logged at (epoch ${+i}) took (${e}ms)`,r)}logTimeDeltaHuman(e,t,r){let o=void 0!==t?t:"Time Measurement",i=+new Date,n=parseInt(e%1e3),s=parseInt(e/1e3%60),l=parseInt(e/6e4%60),a=parseInt(e/36e5);n=n<10?"00"+n:n<100?"0"+n:n,s=s<10?"0"+s:s,l=l<10?"0"+l:l,a=a<10?"0"+a:a,this.info(`${o} logged at (epoch ${+i}) took (${e}ms) or (${a}:${l}:${s}.${n})`,r)}logTimeDeltaRelative(e,t,r){this.logTimeDelta(this.getTimeDelta(e),t,r)}logTimeDeltaRelativeHuman(e,t,r){this.logTimeDeltaHuman(this.getTimeDelta(e),t,r)}}t.exports=o,t.exports.new=function(e){return new o(e)},t.exports.LogProviderBase=e("./Fable-Log-BaseLogger.js"),t.exports.LogProviderConsole=e("./Fable-Log-Logger-Console.js"),t.exports.LogProviderConsole=e("./Fable-Log-Logger-SimpleFlatFile.js")},{"./Fable-Log-BaseLogger.js":4,"./Fable-Log-DefaultProviders-Node.js":6,"./Fable-Log-DefaultStreams.json":7,"./Fable-Log-Logger-Console.js":8,"./Fable-Log-Logger-SimpleFlatFile.js":9}]},{},[5])(5)}));
var i=e("./Fable-Log.js");"object"!=typeof window||window.hasOwnProperty("FableLog")||(window.FableLog=i),t.exports=i},{"./Fable-Log.js":12}],8:[function(e,t,r){t.exports=(()=>{let t={};return t.console=e("./Fable-Log-Logger-Console.js"),t.default=t.console,t})()},{"./Fable-Log-Logger-Console.js":10}],9:[function(e,t,r){t.exports=[{loggertype:"console",streamtype:"console",level:"trace"}]},{}],10:[function(e,t,r){let i=e("./Fable-Log-BaseLogger.js");t.exports=class extends i{constructor(e,t){super(e),this._ShowTimeStamps=!this._Settings.hasOwnProperty("showtimestamps")||1==this._Settings.showtimestamps,this._FormattedTimeStamps=!this._Settings.hasOwnProperty("formattedtimestamps")||1==this._Settings.formattedtimestamps,this._ContextMessage=this._Settings.hasOwnProperty("Context")?`(${this._Settings.Context})`:t._Settings.hasOwnProperty("Product")?`(${t._Settings.Product})`:"Unnamed_Log_Context",this._OutputLogLinesToConsole=!this._Settings.hasOwnProperty("outputloglinestoconsole")||this._Settings.outputloglinestoconsole,this._OutputObjectsToConsole=!this._Settings.hasOwnProperty("outputobjectstoconsole")||this._Settings.outputobjectstoconsole,this.prefixCache={};for(let e=0;e<=this.levels.length;e++)this.prefixCache[this.levels[e]]=`[${this.levels[e]}] ${this._ContextMessage}: `,this._ShowTimeStamps&&(this.prefixCache[this.levels[e]]=" "+this.prefixCache[this.levels[e]])}write(e,t,r){let i="";this._ShowTimeStamps&&this._FormattedTimeStamps?i=(new Date).toISOString():this._ShowTimeStamps&&(i=+new Date);let o=`${i}${this.prefixCache[e]}${t}`;return this._OutputLogLinesToConsole&&console.log(o),this._OutputObjectsToConsole&&void 0!==r&&console.log(JSON.stringify(r,null,2)),o}}},{"./Fable-Log-BaseLogger.js":6}],11:[function(e,t,r){const i=e("./Fable-Log-Logger-Console.js"),o=e("fs"),s=e("path");t.exports=class extends i{constructor(e,t){super(e,t),this.logFileRawPath=this._Settings.hasOwnProperty("path")?this._Settings.path:`./${this._ContextMessage}.log`,this.logFilePath=s.normalize(this.logFileRawPath),this.logFileStreamOptions=this._Settings.hasOwnProperty("fileStreamoptions")?this._Settings.fileStreamOptions:{flags:"a",encoding:"utf8"},this.fileWriter=o.createWriteStream(this.logFilePath,this.logFileStreamOptions),this.activelyWriting=!1,this.logLineStrings=[],this.logObjectStrings=[],this.defaultWriteCompleteCallback=()=>{},this.defaultBufferFlushCallback=()=>{}}closeWriter(e){let t="function"==typeof e?e:()=>{};if(this.fileWriter)return this.fileWriter.end("\n"),this.fileWriter.once("finish",t.bind(this))}completeBufferFlushToLogFile(e){this.activelyWriting=!1;let t="function"==typeof e?e:this.defaultBufferFlushCallback;if(!(this.logLineStrings.length>0))return t();this.flushBufferToLogFile(t)}flushBufferToLogFile(e){if(!this.activelyWriting){this.activelyWriting=!0;let t="function"==typeof e?e:this.defaultBufferFlushCallback,r=this.logLineStrings,i=this.logObjectStrings;this.logLineStrings=[],this.logObjectStrings=[];let o="";for(let e=0;e<r.length;e++)o+=`${r[e]}\n`,!1!==i[e]&&(o+=`${i[e]}\n`);if(this.fileWriter.write(o,"utf8"))return this.completeBufferFlushToLogFile(t);this.fileWriter.once("drain",this.completeBufferFlushToLogFile.bind(this,t))}}write(e,t,r){let i=super.write(e,t,r);this.logLineStrings.push(i),void 0!==r?this.logObjectStrings.push(JSON.stringify(r,null,4)):this.logObjectStrings.push(!1),this.flushBufferToLogFile()}}},{"./Fable-Log-Logger-Console.js":10,fs:1,path:4}],12:[function(e,t,r){const i=e("fable-serviceproviderbase").CoreServiceProviderBase;class o extends i{constructor(t,r){super(t,r),this.serviceType="Logging";let i="object"==typeof t?t:{};this._Settings=i,this._Providers=e("./Fable-Log-DefaultProviders-Node.js"),this._StreamDefinitions=i.hasOwnProperty("LogStreams")?i.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 i.Product?i.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 r=this.datumDecorator(t);for(let t=0;t<this.logStreamsTrace.length;t++)this.logStreamsTrace[t].trace(e,r)}debug(e,t){const r=this.datumDecorator(t);for(let t=0;t<this.logStreamsDebug.length;t++)this.logStreamsDebug[t].debug(e,r)}info(e,t){const r=this.datumDecorator(t);for(let t=0;t<this.logStreamsInfo.length;t++)this.logStreamsInfo[t].info(e,r)}warn(e,t){const r=this.datumDecorator(t);for(let t=0;t<this.logStreamsWarn.length;t++)this.logStreamsWarn[t].warn(e,r)}error(e,t){const r=this.datumDecorator(t);for(let t=0;t<this.logStreamsError.length;t++)this.logStreamsError[t].error(e,r)}fatal(e,t){const r=this.datumDecorator(t);for(let t=0;t<this.logStreamsFatal.length;t++)this.logStreamsFatal[t].fatal(e,r)}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 r=void 0!==e?e:"Time",i=new Date;this.info(`${r} ${i} (epoch ${+i})`,t)}getTimeStamp(){return+new Date}getTimeDelta(e){return+new Date-e}logTimeDelta(e,t,r){let i=void 0!==t?t:"Time Measurement",o=+new Date;this.info(`${i} logged at (epoch ${+o}) took (${e}ms)`,r)}logTimeDeltaHuman(e,t,r){let i=void 0!==t?t:"Time Measurement",o=+new Date,s=parseInt(e%1e3),n=parseInt(e/1e3%60),l=parseInt(e/6e4%60),a=parseInt(e/36e5);s=s<10?"00"+s:s<100?"0"+s:s,n=n<10?"0"+n:n,l=l<10?"0"+l:l,a=a<10?"0"+a:a,this.info(`${i} logged at (epoch ${+o}) took (${e}ms) or (${a}:${l}:${n}.${s})`,r)}logTimeDeltaRelative(e,t,r){this.logTimeDelta(this.getTimeDelta(e),t,r)}logTimeDeltaRelativeHuman(e,t,r){this.logTimeDeltaHuman(this.getTimeDelta(e),t,r)}}t.exports=o,t.exports.new=function(e){return new o(e)},t.exports.LogProviderBase=e("./Fable-Log-BaseLogger.js"),t.exports.LogProviderConsole=e("./Fable-Log-Logger-Console.js"),t.exports.LogProviderConsole=e("./Fable-Log-Logger-SimpleFlatFile.js")},{"./Fable-Log-BaseLogger.js":6,"./Fable-Log-DefaultProviders-Node.js":8,"./Fable-Log-DefaultStreams.json":9,"./Fable-Log-Logger-Console.js":10,"./Fable-Log-Logger-SimpleFlatFile.js":11,"fable-serviceproviderbase":3}]},{},[7])(7)}));
//# sourceMappingURL=fable-log.min.js.map
{
"name": "fable-log",
"version": "3.0.7",
"version": "3.0.8",
"description": "A simple logging wrapper.",

@@ -61,3 +61,6 @@ "main": "source/Fable-Log.js",

"vinyl-source-stream": "^2.0.0"
},
"dependencies": {
"fable-serviceproviderbase": "^3.0.2"
}
}
/**
* Fable Logging Add-on
*
* @license MIT
*
* @author Steven Velozo <steven@velozo.com>
* @module Fable Logger
* Fable Logging Service
*/
/**
* Fable Solution Log Wrapper Main Class
*
* @class FableLog
* @constructor
*/
class FableLog
const libFableServiceProviderBase = require('fable-serviceproviderbase').CoreServiceProviderBase;
class FableLog extends libFableServiceProviderBase
{
constructor(pFableSettings, pFable)
constructor(pSettings, pServiceHash)
{
let tmpSettings = (typeof(pFableSettings) === 'object') ? pFableSettings : {}
super(pSettings, pServiceHash);
this.serviceType = 'Logging';
let tmpSettings = (typeof(pSettings) === 'object') ? pSettings : {}
this._Settings = tmpSettings;

@@ -22,0 +17,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc