@nebulaaa/journal 1.1.2 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/journal.cjs +1 -1
- package/dist/journal.min.cjs +1 -1
- package/dist/journal.min.mjs +1 -1
- package/dist/journal.mjs +1 -1
- package/dist/package.json +1 -1
- package/package.json +1 -1
package/dist/journal.cjs
CHANGED
|
@@ -111,7 +111,7 @@ const JournalContext = {
|
|
|
111
111
|
function JournalInit(options) {
|
|
112
112
|
var _a, _b, _c;
|
|
113
113
|
if (JournalContext._instance) {
|
|
114
|
-
|
|
114
|
+
JournalContext._instance.Warn('[Journal] 已初始化,请勿重复调用');
|
|
115
115
|
return JournalContext._instance;
|
|
116
116
|
}
|
|
117
117
|
JournalContext._level = (_a = options === null || options === void 0 ? void 0 : options.level) !== null && _a !== void 0 ? _a : 'debug';
|
package/dist/journal.min.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e=["debug","info","warn","error","disable"],
|
|
1
|
+
"use strict";const e=["debug","info","warn","error","disable"],n={debug:0,info:1,warn:2,error:3,disable:4},l={debug:{label:"[Debug]",color:"#8C8C8C"},info:{label:"[Info]",color:"#0986FF"},warn:{label:"[Warn]",color:"#E6A23C"},error:{label:"[Error]",color:"#D93026"},disable:{label:"[Disable]",color:""}},o="journal",r={debug:"log",info:"info",warn:"warn",error:"error"};class t{constructor(e){var n;this.Name=e.name,this.Level=null!==(n=e.level)&&void 0!==n?n:"debug"}Debug(e,...n){this.Log("debug",e,...n)}Info(e,...n){this.Log("info",e,...n)}Warn(e,...n){this.Log("warn",e,...n)}Error(e,...n){this.Log("error",e,...n)}Log(e,l,...o){if("disable"===e)return;if(n[this.Level]<n[i()])return;if(n[e]<n[this.Level])return;const t=v(e),s=`[${this.Name}] ${String(l)}`,u=r[e];t.color?console[u](`%c${t.label}%c ${s}`,`color:${t.color};font-weight:bold;`,"color:inherit;font-weight:inherit;",...o):console[u](`${t.label} ${s}`,...o)}}const s={_instance:null,_level:"disable",_logger:null,_styles:Object.assign({},l),_loggers:new Map};function i(){return s._level}function u(e){s._level=e,s._logger.Level=e}function g(e,...n){f("debug",e,...n)}function a(e,...n){f("info",e,...n)}function c(e,...n){f("warn",e,...n)}function _(e,...n){f("error",e,...n)}function f(e,n,...l){s._logger.Log(e,n,...l)}function v(e){return s._styles[e]}function b(e,n){s._styles[e]=Object.assign(Object.assign({},s._styles[e]),n)}function L(e,n="debug"){const l=s._loggers.get(e);if(l)return l.Level=n,l;const o=new t({name:e,level:n});return s._loggers.set(e,o),o}function d(e){var n;return null!==(n=s._loggers.get(e))&&void 0!==n?n:L(e,s._level)}function E(e){return s._loggers.delete(e)}function h(){s._loggers.clear()}function w(){return[...s._loggers.values()]}exports.JOURNAL_DEFAULT_LEVEL_STYLES=l,exports.JOURNAL_DEFAULT_LOGGER_NAME=o,exports.JOURNAL_LEVELS=e,exports.JOURNAL_LEVEL_WEIGHTS=n,exports.JournalInit=function(n){var l,r,f;if(s._instance)return s._instance.Warn("[Journal] 已初始化,请勿重复调用"),s._instance;s._level=null!==(l=null==n?void 0:n.level)&&void 0!==l?l:"debug",s._logger=new t({name:o,level:s._level});const A=null==n?void 0:n.levels;if(A)for(const n of e){const e=A[n];e&&(s._styles[n]=Object.assign(Object.assign({},s._styles[n]),e))}for(const e of null!==(r=null==n?void 0:n.loggers)&&void 0!==r?r:[])L(e.name,null!==(f=e.level)&&void 0!==f?f:"debug");return s._instance={Acquire:d,Create:L,Remove:E,Clear:h,All:w,GetLevel:i,SetLevel:u,GetLevelStyle:v,SetLevelStyle:b,Debug:g,Info:a,Warn:c,Error:_},s._instance},exports.JournalLogger=t;
|
package/dist/journal.min.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=["debug","info","warn","error","disable"],
|
|
1
|
+
const e=["debug","info","warn","error","disable"],n={debug:0,info:1,warn:2,error:3,disable:4},l={debug:{label:"[Debug]",color:"#8C8C8C"},info:{label:"[Info]",color:"#0986FF"},warn:{label:"[Warn]",color:"#E6A23C"},error:{label:"[Error]",color:"#D93026"},disable:{label:"[Disable]",color:""}},o="journal",r={debug:"log",info:"info",warn:"warn",error:"error"};class t{constructor(e){var n;this.Name=e.name,this.Level=null!==(n=e.level)&&void 0!==n?n:"debug"}Debug(e,...n){this.Log("debug",e,...n)}Info(e,...n){this.Log("info",e,...n)}Warn(e,...n){this.Log("warn",e,...n)}Error(e,...n){this.Log("error",e,...n)}Log(e,l,...o){if("disable"===e)return;if(n[this.Level]<n[u()])return;if(n[e]<n[this.Level])return;const t=_(e),i=`[${this.Name}] ${String(l)}`,s=r[e];t.color?console[s](`%c${t.label}%c ${i}`,`color:${t.color};font-weight:bold;`,"color:inherit;font-weight:inherit;",...o):console[s](`${t.label} ${i}`,...o)}}const i={_instance:null,_level:"disable",_logger:null,_styles:Object.assign({},l),_loggers:new Map};function s(n){var l,r,s;if(i._instance)return i._instance.Warn("[Journal] 已初始化,请勿重复调用"),i._instance;i._level=null!==(l=null==n?void 0:n.level)&&void 0!==l?l:"debug",i._logger=new t({name:o,level:i._level});const b=null==n?void 0:n.levels;if(b)for(const n of e){const e=b[n];e&&(i._styles[n]=Object.assign(Object.assign({},i._styles[n]),e))}for(const e of null!==(r=null==n?void 0:n.loggers)&&void 0!==r?r:[])L(e.name,null!==(s=e.level)&&void 0!==s?s:"debug");return i._instance={Acquire:h,Create:L,Remove:w,Clear:y,All:m,GetLevel:u,SetLevel:g,GetLevelStyle:_,SetLevelStyle:d,Debug:c,Info:a,Warn:f,Error:v},i._instance}function u(){return i._level}function g(e){i._level=e,i._logger.Level=e}function c(e,...n){b("debug",e,...n)}function a(e,...n){b("info",e,...n)}function f(e,...n){b("warn",e,...n)}function v(e,...n){b("error",e,...n)}function b(e,n,...l){i._logger.Log(e,n,...l)}function _(e){return i._styles[e]}function d(e,n){i._styles[e]=Object.assign(Object.assign({},i._styles[e]),n)}function L(e,n="debug"){const l=i._loggers.get(e);if(l)return l.Level=n,l;const o=new t({name:e,level:n});return i._loggers.set(e,o),o}function h(e){var n;return null!==(n=i._loggers.get(e))&&void 0!==n?n:L(e,i._level)}function w(e){return i._loggers.delete(e)}function y(){i._loggers.clear()}function m(){return[...i._loggers.values()]}export{l as JOURNAL_DEFAULT_LEVEL_STYLES,o as JOURNAL_DEFAULT_LOGGER_NAME,e as JOURNAL_LEVELS,n as JOURNAL_LEVEL_WEIGHTS,s as JournalInit,t as JournalLogger};
|
package/dist/journal.mjs
CHANGED
|
@@ -109,7 +109,7 @@ const JournalContext = {
|
|
|
109
109
|
function JournalInit(options) {
|
|
110
110
|
var _a, _b, _c;
|
|
111
111
|
if (JournalContext._instance) {
|
|
112
|
-
|
|
112
|
+
JournalContext._instance.Warn('[Journal] 已初始化,请勿重复调用');
|
|
113
113
|
return JournalContext._instance;
|
|
114
114
|
}
|
|
115
115
|
JournalContext._level = (_a = options === null || options === void 0 ? void 0 : options.level) !== null && _a !== void 0 ? _a : 'debug';
|
package/dist/package.json
CHANGED