@paybyrd/logger-js
Advanced tools
Comparing version 1.0.0-rc.3 to 1.0.0-rc.4
@@ -1,4 +0,3 @@ | ||
import { ConsoleLogger } from "./ConsoleLogger"; | ||
import { RestLogger } from "./RestLogger"; | ||
export { ConsoleLogger, RestLogger }; | ||
export default RestLogger; | ||
export { ConsoleLogger } from "./ConsoleLogger"; | ||
export { RestLogger } from "./RestLogger"; | ||
export { ILog, ILogger, LogLevel, IRestLoggerOptions } from "./abstractions"; |
@@ -1,2 +0,2 @@ | ||
function n(){return n=Object.assign?Object.assign.bind():function(n){for(var t=1;t<arguments.length;t++){var e=arguments[t];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r])}return n},n.apply(this,arguments)}var t,e=/*#__PURE__*/function(){function t(){}var e=t.prototype;return e.flush=function(){return Promise.resolve()},e.log=function(t){var e,r=n({},t,{error:null==(e=t.error)?void 0:e.toString()});console.log(r)},t}();function r(n,t,e){if(!n.s){if(e instanceof o){if(!e.s)return void(e.o=r.bind(null,n,t));1&t&&(t=e.s),e=e.v}if(e&&e.then)return void e.then(r.bind(null,n,t),r.bind(null,n,2));n.s=t,n.v=e;const i=n.o;i&&i(n)}}!function(n){n[n.Trace=0]="Trace",n[n.Debug=1]="Debug",n[n.Information=2]="Information",n[n.Warning=3]="Warning",n[n.Error=4]="Error",n[n.Critical=5]="Critical",n[n.None=6]="None"}(t||(t={}));var o=/*#__PURE__*/function(){function n(){}return n.prototype.then=function(t,e){var o=new n,i=this.s;if(i){var s=1&i?t:e;if(s){try{r(o,1,s(this.v))}catch(n){r(o,2,n)}return o}return this}return this.o=function(n){try{var i=n.v;1&n.s?r(o,1,t?t(i):i):e?r(o,1,e(i)):r(o,2,i)}catch(n){r(o,2,n)}},o},n}();function i(n){return n instanceof o&&1&n.s}var s=/*#__PURE__*/function(){function s(n,t){void 0===t&&(t=new e),this._logger=void 0,this._options=void 0,this._logs=[],this._interval=void 0,this._logger=t,this._options=n,this._interval=setInterval(this.sendBatch.bind(this),1e3*(this._options.batchLogIntervalInSeconds||s.DEFAULT_BATCH_TIMEOUT))}var a=s.prototype;return a.log=function(t){var e;this._logger.log(t),this._options.restLoggerUrl&&this._logs.unshift({customMessage:t.message,message:"["+this._options.service.name+"] "+t.message,service:this._options.service,environment:this._options.environment||"Development",executionDate:new Date,entrypoint:"Execute",method:t.method,correlationId:t.correlationId,content:n({},t.content,{error:null==(e=t.error)?void 0:e.toString()}),level:t.level})},a.flush=function(){try{var n=function(){t._interval=setInterval(t.sendBatch.bind(t),1e3*(t._options.batchLogIntervalInSeconds||s.DEFAULT_BATCH_TIMEOUT))},t=this;clearInterval(t._interval);var e=function(n,t,e){for(var s;;){var a=n();if(i(a)&&(a=a.v),!a)return c;if(a.then){s=0;break}var c=e();if(c&&c.then){if(!i(c)){s=1;break}c=c.s}if(t){var h=t();if(h&&h.then&&!i(h)){s=2;break}}}var l=new o,v=r.bind(null,l,2);return(0===s?a.then(f):1===s?c.then(u):h.then(d)).then(void 0,v),l;function u(o){c=o;do{if(t&&(h=t())&&h.then&&!i(h))return void h.then(d).then(void 0,v);if(!(a=n())||i(a)&&!a.v)return void r(l,1,c);if(a.then)return void a.then(f).then(void 0,v);i(c=e())&&(c=c.v)}while(!c||!c.then);c.then(u).then(void 0,v)}function f(n){n?(c=e())&&c.then?c.then(u).then(void 0,v):u(c):r(l,1,c)}function d(){(a=n())?a.then?a.then(f).then(void 0,v):f(a):r(l,1,c)}}(function(){return!!t._logs.length},void 0,function(){return Promise.resolve(t.sendBatch()).then(function(){})});return Promise.resolve(e&&e.then?e.then(n):n())}catch(n){return Promise.reject(n)}},a.sendBatch=function(){try{var n=this,e=n._logs.splice(0,10);if(!e.length)return Promise.resolve();var r=crypto.randomUUID(),o=function(o,i){try{var s=(a=1e3*(n._options.timeoutInSeconds||30),c=new AbortController,h=setTimeout(function(){return c.abort()},a),Promise.resolve(fetch(n._options.restLoggerUrl,{headers:{"content-type":"application/json"},method:"POST",keepalive:!0,body:JSON.stringify(e),signal:c.signal})).then(function(o){clearTimeout(h),o.ok||n._logger.log({message:"Error sending messages to API",content:e,method:"sendBatch",correlationId:r,level:t.Error})}))}catch(n){return i(n)}var a,c,h;return s&&s.then?s.then(void 0,i):s}(0,function(o){n._logger.log({error:o,message:"Error sending messages to API",content:e,method:"sendBatch",correlationId:r,level:t.Error})});return Promise.resolve(o&&o.then?o.then(function(){}):void 0)}catch(n){return Promise.reject(n)}},s}();s.DEFAULT_BATCH_TIMEOUT=5;export{e as ConsoleLogger,s as RestLogger,s as default}; | ||
function n(){return n=Object.assign?Object.assign.bind():function(n){for(var t=1;t<arguments.length;t++){var e=arguments[t];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r])}return n},n.apply(this,arguments)}var t,e=/*#__PURE__*/function(){function t(){}var e=t.prototype;return e.flush=function(){return Promise.resolve()},e.log=function(t){var e,r=n({},t,{error:null==(e=t.error)?void 0:e.toString()});console.log(r)},t}();function r(n,t,e){if(!n.s){if(e instanceof o){if(!e.s)return void(e.o=r.bind(null,n,t));1&t&&(t=e.s),e=e.v}if(e&&e.then)return void e.then(r.bind(null,n,t),r.bind(null,n,2));n.s=t,n.v=e;const i=n.o;i&&i(n)}}!function(n){n[n.Trace=0]="Trace",n[n.Debug=1]="Debug",n[n.Information=2]="Information",n[n.Warning=3]="Warning",n[n.Error=4]="Error",n[n.Critical=5]="Critical",n[n.None=6]="None"}(t||(t={}));var o=/*#__PURE__*/function(){function n(){}return n.prototype.then=function(t,e){var o=new n,i=this.s;if(i){var s=1&i?t:e;if(s){try{r(o,1,s(this.v))}catch(n){r(o,2,n)}return o}return this}return this.o=function(n){try{var i=n.v;1&n.s?r(o,1,t?t(i):i):e?r(o,1,e(i)):r(o,2,i)}catch(n){r(o,2,n)}},o},n}();function i(n){return n instanceof o&&1&n.s}var s=/*#__PURE__*/function(){function s(n,t){void 0===t&&(t=new e),this._logger=void 0,this._options=void 0,this._logs=[],this._interval=void 0,this._logger=t,this._options=n,this._interval=setInterval(this.sendBatch.bind(this),1e3*(this._options.batchLogIntervalInSeconds||s.DEFAULT_BATCH_TIMEOUT))}var a=s.prototype;return a.log=function(t){var e;this._logger.log(t),this._options.restLoggerUrl&&this._logs.unshift({customMessage:t.message,message:"["+this._options.service.name+"] "+t.message,service:this._options.service,environment:this._options.environment||"Development",executionDate:new Date,entrypoint:"Execute",method:t.method,correlationId:t.correlationId,content:n({},t.content,{error:null==(e=t.error)?void 0:e.toString()}),level:t.level})},a.flush=function(){try{var n=function(){t._interval=setInterval(t.sendBatch.bind(t),1e3*(t._options.batchLogIntervalInSeconds||s.DEFAULT_BATCH_TIMEOUT))},t=this;clearInterval(t._interval);var e=function(n,t,e){for(var s;;){var a=n();if(i(a)&&(a=a.v),!a)return c;if(a.then){s=0;break}var c=e();if(c&&c.then){if(!i(c)){s=1;break}c=c.s}if(t){var h=t();if(h&&h.then&&!i(h)){s=2;break}}}var l=new o,v=r.bind(null,l,2);return(0===s?a.then(f):1===s?c.then(u):h.then(d)).then(void 0,v),l;function u(o){c=o;do{if(t&&(h=t())&&h.then&&!i(h))return void h.then(d).then(void 0,v);if(!(a=n())||i(a)&&!a.v)return void r(l,1,c);if(a.then)return void a.then(f).then(void 0,v);i(c=e())&&(c=c.v)}while(!c||!c.then);c.then(u).then(void 0,v)}function f(n){n?(c=e())&&c.then?c.then(u).then(void 0,v):u(c):r(l,1,c)}function d(){(a=n())?a.then?a.then(f).then(void 0,v):f(a):r(l,1,c)}}(function(){return!!t._logs.length},void 0,function(){return Promise.resolve(t.sendBatch()).then(function(){})});return Promise.resolve(e&&e.then?e.then(n):n())}catch(n){return Promise.reject(n)}},a.sendBatch=function(){try{var n=this,e=n._logs.splice(0,10);if(!e.length)return Promise.resolve();var r=crypto.randomUUID(),o=function(o,i){try{var s=(a=1e3*(n._options.timeoutInSeconds||30),c=new AbortController,h=setTimeout(function(){return c.abort()},a),Promise.resolve(fetch(n._options.restLoggerUrl,{headers:{"content-type":"application/json"},method:"POST",keepalive:!0,body:JSON.stringify(e),signal:c.signal})).then(function(o){clearTimeout(h),o.ok||n._logger.log({message:"Error sending messages to API",content:e,method:"sendBatch",correlationId:r,level:t.Error})}))}catch(n){return i(n)}var a,c,h;return s&&s.then?s.then(void 0,i):s}(0,function(o){n._logger.log({error:o,message:"Error sending messages to API",content:e,method:"sendBatch",correlationId:r,level:t.Error})});return Promise.resolve(o&&o.then?o.then(function(){}):void 0)}catch(n){return Promise.reject(n)}},s}();s.DEFAULT_BATCH_TIMEOUT=5;export{e as ConsoleLogger,t as LogLevel,s as RestLogger}; | ||
//# sourceMappingURL=index.module.js.map |
@@ -1,2 +0,2 @@ | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e||self).loggerJs={})}(this,function(e){function n(){return n=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},n.apply(this,arguments)}var t,o=/*#__PURE__*/function(){function e(){}var t=e.prototype;return t.flush=function(){return Promise.resolve()},t.log=function(e){var t,o=n({},e,{error:null==(t=e.error)?void 0:t.toString()});console.log(o)},e}();function r(e,n,t){if(!e.s){if(t instanceof i){if(!t.s)return void(t.o=r.bind(null,e,n));1&n&&(n=t.s),t=t.v}if(t&&t.then)return void t.then(r.bind(null,e,n),r.bind(null,e,2));e.s=n,e.v=t;const o=e.o;o&&o(e)}}!function(e){e[e.Trace=0]="Trace",e[e.Debug=1]="Debug",e[e.Information=2]="Information",e[e.Warning=3]="Warning",e[e.Error=4]="Error",e[e.Critical=5]="Critical",e[e.None=6]="None"}(t||(t={}));var i=/*#__PURE__*/function(){function e(){}return e.prototype.then=function(n,t){var o=new e,i=this.s;if(i){var s=1&i?n:t;if(s){try{r(o,1,s(this.v))}catch(e){r(o,2,e)}return o}return this}return this.o=function(e){try{var i=e.v;1&e.s?r(o,1,n?n(i):i):t?r(o,1,t(i)):r(o,2,i)}catch(e){r(o,2,e)}},o},e}();function s(e){return e instanceof i&&1&e.s}var a=/*#__PURE__*/function(){function e(n,t){void 0===t&&(t=new o),this._logger=void 0,this._options=void 0,this._logs=[],this._interval=void 0,this._logger=t,this._options=n,this._interval=setInterval(this.sendBatch.bind(this),1e3*(this._options.batchLogIntervalInSeconds||e.DEFAULT_BATCH_TIMEOUT))}var a=e.prototype;return a.log=function(e){var t;this._logger.log(e),this._options.restLoggerUrl&&this._logs.unshift({customMessage:e.message,message:"["+this._options.service.name+"] "+e.message,service:this._options.service,environment:this._options.environment||"Development",executionDate:new Date,entrypoint:"Execute",method:e.method,correlationId:e.correlationId,content:n({},e.content,{error:null==(t=e.error)?void 0:t.toString()}),level:e.level})},a.flush=function(){try{var n=function(){t._interval=setInterval(t.sendBatch.bind(t),1e3*(t._options.batchLogIntervalInSeconds||e.DEFAULT_BATCH_TIMEOUT))},t=this;clearInterval(t._interval);var o=function(e,n,t){for(var o;;){var a=e();if(s(a)&&(a=a.v),!a)return c;if(a.then){o=0;break}var c=t();if(c&&c.then){if(!s(c)){o=1;break}c=c.s}if(n){var h=n();if(h&&h.then&&!s(h)){o=2;break}}}var l=new i,u=r.bind(null,l,2);return(0===o?a.then(f):1===o?c.then(v):h.then(d)).then(void 0,u),l;function v(o){c=o;do{if(n&&(h=n())&&h.then&&!s(h))return void h.then(d).then(void 0,u);if(!(a=e())||s(a)&&!a.v)return void r(l,1,c);if(a.then)return void a.then(f).then(void 0,u);s(c=t())&&(c=c.v)}while(!c||!c.then);c.then(v).then(void 0,u)}function f(e){e?(c=t())&&c.then?c.then(v).then(void 0,u):v(c):r(l,1,c)}function d(){(a=e())?a.then?a.then(f).then(void 0,u):f(a):r(l,1,c)}}(function(){return!!t._logs.length},void 0,function(){return Promise.resolve(t.sendBatch()).then(function(){})});return Promise.resolve(o&&o.then?o.then(n):n())}catch(e){return Promise.reject(e)}},a.sendBatch=function(){try{var e=this,n=e._logs.splice(0,10);if(!n.length)return Promise.resolve();var o=crypto.randomUUID(),r=function(r,i){try{var s=(a=1e3*(e._options.timeoutInSeconds||30),c=new AbortController,h=setTimeout(function(){return c.abort()},a),Promise.resolve(fetch(e._options.restLoggerUrl,{headers:{"content-type":"application/json"},method:"POST",keepalive:!0,body:JSON.stringify(n),signal:c.signal})).then(function(r){clearTimeout(h),r.ok||e._logger.log({message:"Error sending messages to API",content:n,method:"sendBatch",correlationId:o,level:t.Error})}))}catch(e){return i(e)}var a,c,h;return s&&s.then?s.then(void 0,i):s}(0,function(r){e._logger.log({error:r,message:"Error sending messages to API",content:n,method:"sendBatch",correlationId:o,level:t.Error})});return Promise.resolve(r&&r.then?r.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},e}();a.DEFAULT_BATCH_TIMEOUT=5,e.ConsoleLogger=o,e.RestLogger=a,e.default=a}); | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e||self).loggerJs={})}(this,function(e){function n(){return n=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},n.apply(this,arguments)}var t,o=/*#__PURE__*/function(){function e(){}var t=e.prototype;return t.flush=function(){return Promise.resolve()},t.log=function(e){var t,o=n({},e,{error:null==(t=e.error)?void 0:t.toString()});console.log(o)},e}();function r(e,n,t){if(!e.s){if(t instanceof i){if(!t.s)return void(t.o=r.bind(null,e,n));1&n&&(n=t.s),t=t.v}if(t&&t.then)return void t.then(r.bind(null,e,n),r.bind(null,e,2));e.s=n,e.v=t;const o=e.o;o&&o(e)}}e.LogLevel=void 0,(t=e.LogLevel||(e.LogLevel={}))[t.Trace=0]="Trace",t[t.Debug=1]="Debug",t[t.Information=2]="Information",t[t.Warning=3]="Warning",t[t.Error=4]="Error",t[t.Critical=5]="Critical",t[t.None=6]="None";var i=/*#__PURE__*/function(){function e(){}return e.prototype.then=function(n,t){var o=new e,i=this.s;if(i){var s=1&i?n:t;if(s){try{r(o,1,s(this.v))}catch(e){r(o,2,e)}return o}return this}return this.o=function(e){try{var i=e.v;1&e.s?r(o,1,n?n(i):i):t?r(o,1,t(i)):r(o,2,i)}catch(e){r(o,2,e)}},o},e}();function s(e){return e instanceof i&&1&e.s}var a=/*#__PURE__*/function(){function t(e,n){void 0===n&&(n=new o),this._logger=void 0,this._options=void 0,this._logs=[],this._interval=void 0,this._logger=n,this._options=e,this._interval=setInterval(this.sendBatch.bind(this),1e3*(this._options.batchLogIntervalInSeconds||t.DEFAULT_BATCH_TIMEOUT))}var a=t.prototype;return a.log=function(e){var t;this._logger.log(e),this._options.restLoggerUrl&&this._logs.unshift({customMessage:e.message,message:"["+this._options.service.name+"] "+e.message,service:this._options.service,environment:this._options.environment||"Development",executionDate:new Date,entrypoint:"Execute",method:e.method,correlationId:e.correlationId,content:n({},e.content,{error:null==(t=e.error)?void 0:t.toString()}),level:e.level})},a.flush=function(){try{var e=function(){n._interval=setInterval(n.sendBatch.bind(n),1e3*(n._options.batchLogIntervalInSeconds||t.DEFAULT_BATCH_TIMEOUT))},n=this;clearInterval(n._interval);var o=function(e,n,t){for(var o;;){var a=e();if(s(a)&&(a=a.v),!a)return l;if(a.then){o=0;break}var l=t();if(l&&l.then){if(!s(l)){o=1;break}l=l.s}if(n){var c=n();if(c&&c.then&&!s(c)){o=2;break}}}var h=new i,v=r.bind(null,h,2);return(0===o?a.then(f):1===o?l.then(u):c.then(g)).then(void 0,v),h;function u(o){l=o;do{if(n&&(c=n())&&c.then&&!s(c))return void c.then(g).then(void 0,v);if(!(a=e())||s(a)&&!a.v)return void r(h,1,l);if(a.then)return void a.then(f).then(void 0,v);s(l=t())&&(l=l.v)}while(!l||!l.then);l.then(u).then(void 0,v)}function f(e){e?(l=t())&&l.then?l.then(u).then(void 0,v):u(l):r(h,1,l)}function g(){(a=e())?a.then?a.then(f).then(void 0,v):f(a):r(h,1,l)}}(function(){return!!n._logs.length},void 0,function(){return Promise.resolve(n.sendBatch()).then(function(){})});return Promise.resolve(o&&o.then?o.then(e):e())}catch(e){return Promise.reject(e)}},a.sendBatch=function(){try{var n=this,t=n._logs.splice(0,10);if(!t.length)return Promise.resolve();var o=crypto.randomUUID(),r=function(r,i){try{var s=(a=1e3*(n._options.timeoutInSeconds||30),l=new AbortController,c=setTimeout(function(){return l.abort()},a),Promise.resolve(fetch(n._options.restLoggerUrl,{headers:{"content-type":"application/json"},method:"POST",keepalive:!0,body:JSON.stringify(t),signal:l.signal})).then(function(r){clearTimeout(c),r.ok||n._logger.log({message:"Error sending messages to API",content:t,method:"sendBatch",correlationId:o,level:e.LogLevel.Error})}))}catch(e){return i(e)}var a,l,c;return s&&s.then?s.then(void 0,i):s}(0,function(r){n._logger.log({error:r,message:"Error sending messages to API",content:t,method:"sendBatch",correlationId:o,level:e.LogLevel.Error})});return Promise.resolve(r&&r.then?r.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},t}();a.DEFAULT_BATCH_TIMEOUT=5,e.ConsoleLogger=o,e.RestLogger=a}); | ||
//# sourceMappingURL=index.umd.js.map |
{ | ||
"name": "@paybyrd/logger-js", | ||
"version": "1.0.0-rc.3", | ||
"version": "1.0.0-rc.4", | ||
"description": "JS logger implementation", | ||
@@ -17,5 +17,7 @@ "repository": { | ||
"exports": { | ||
"import": "./dist/index.module.js", | ||
"require": "./dist/index.cjs", | ||
"default": "./dist/index.umd.js" | ||
".": { | ||
"import": "./dist/index.module.js", | ||
"require": "./dist/index.cjs", | ||
"default": "./dist/index.umd.js" | ||
} | ||
}, | ||
@@ -22,0 +24,0 @@ "scripts": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
42279
109