ba-js-logger
Advanced tools
Comparing version 2.0.1 to 2.0.2
@@ -1,1 +0,1 @@ | ||
(function(n,r){typeof exports=="object"&&typeof module!="undefined"?module.exports=r():typeof define=="function"&&define.amd?define(r):(n=typeof globalThis!="undefined"?globalThis:n||self,n.baJsLogger=r())})(this,function(){"use strict";class n{static get LEVEL_DEBUG(){return"d"}static get LEVEL_INFO(){return"i"}static get LEVEL_WARN(){return"w"}static get LEVEL_ERROR(){return"e"}static get LEVEL_FATAL(){return"f"}static LEVEL(t){return["d","i","w","e","f"].indexOf(t)}constructor(t,e,s=n.LEVEL_INFO){this.url=t,this.context=e,this.lvl=n.LEVEL(s)}level(t){return t&&(this.lvl=n.LEVEL(t)),this}postRequest(t,e){const s=`${this.url}/${e}?_=${new Date().getTime()}`,o=` [ua: ${navigator.userAgent}] [platform: ${navigator.platform}] [cookie: ${document.cookie}]`,i=new URLSearchParams;return i.append("context",this.context),i.append("message",`${t}${o}`),fetch(s,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"},body:i.toString()}).catch(u=>{console.error(u)})}send(t,e,s){return n.LEVEL(e)>=this.lvl?this.postRequest(t,e,s):Promise.resolve()}debug(t,e){return this.send(t,n.LEVEL_DEBUG,e)}info(t,e){return this.send(t,n.LEVEL_INFO,e)}warn(t,e){return this.send(t,n.LEVEL_WARN,e)}error(t,e){return this.send(t,n.LEVEL_ERROR,e)}fatal(t,e){return this.send(t,n.LEVEL_FATAL,e)}}return n}); | ||
(function(e,s){typeof exports=="object"&&typeof module!="undefined"?module.exports=s():typeof define=="function"&&define.amd?define(s):(e=typeof globalThis!="undefined"?globalThis:e||self,e.baJsLogger=s())})(this,function(){"use strict";class e{static get LEVEL_DEBUG(){return"d"}static get LEVEL_INFO(){return"i"}static get LEVEL_WARN(){return"w"}static get LEVEL_ERROR(){return"e"}static get LEVEL_FATAL(){return"f"}static LEVEL(t){return["d","i","w","e","f"].indexOf(t)}constructor(t,n,r=e.LEVEL_INFO){this.url=t,this.context=n,this.lvl=e.LEVEL(r)}level(t){return t&&(this.lvl=e.LEVEL(t)),this}postRequest(t,n){const r=`${this.url}/${n}?_=${new Date().getTime()}`,o=` [ua: ${navigator.userAgent}] [platform: ${navigator.platform}] [cookie: ${document.cookie}]`,i=new URLSearchParams;return i.append("context",this.context),i.append("message",`${t}${o}`),fetch(r,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"},body:i.toString()}).catch(u=>{console.error(u)})}send(t,n){return e.LEVEL(n)>=this.lvl?this.postRequest(t,n):Promise.resolve()}debug(t){return this.send(t,e.LEVEL_DEBUG)}info(t){return this.send(t,e.LEVEL_INFO)}warn(t){return this.send(t,e.LEVEL_WARN)}error(t){return this.send(t,e.LEVEL_ERROR)}fatal(t){return this.send(t,e.LEVEL_FATAL)}}return e}); |
{ | ||
"name": "ba-js-logger", | ||
"version": "2.0.1", | ||
"version": "2.0.2", | ||
"scripts": { | ||
@@ -5,0 +5,0 @@ "dev": "vite", |
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
3631
64