@nebulaaa/journal 1.1.3 → 1.1.4
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 +0 -1
- package/dist/journal.min.cjs +1 -1
- package/dist/journal.min.mjs +1 -1
- package/dist/journal.mjs +0 -1
- package/dist/package.json +1 -1
- package/package.json +1 -1
package/dist/journal.cjs
CHANGED
|
@@ -111,7 +111,6 @@ const JournalContext = {
|
|
|
111
111
|
function JournalInit(options) {
|
|
112
112
|
var _a, _b, _c;
|
|
113
113
|
if (JournalContext._instance) {
|
|
114
|
-
JournalContext._instance.Warn('[Journal] 已初始化,请勿重复调用');
|
|
115
114
|
return JournalContext._instance;
|
|
116
115
|
}
|
|
117
116
|
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"],l={debug:0,info:1,warn:2,error:3,disable:4},n={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 l;this.Name=e.name,this.Level=null!==(l=e.level)&&void 0!==l?l:"debug"}Debug(e,...l){this.Log("debug",e,...l)}Info(e,...l){this.Log("info",e,...l)}Warn(e,...l){this.Log("warn",e,...l)}Error(e,...l){this.Log("error",e,...l)}Log(e,n,...o){if("disable"===e)return;if(l[this.Level]<l[i()])return;if(l[e]<l[this.Level])return;const t=v(e),s=`[${this.Name}] ${String(n)}`,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({},n),_loggers:new Map};function i(){return s._level}function u(e){s._level=e,s._logger.Level=e}function g(e,...l){_("debug",e,...l)}function c(e,...l){_("info",e,...l)}function a(e,...l){_("warn",e,...l)}function f(e,...l){_("error",e,...l)}function _(e,l,...n){s._logger.Log(e,l,...n)}function v(e){return s._styles[e]}function b(e,l){s._styles[e]=Object.assign(Object.assign({},s._styles[e]),l)}function L(e,l="debug"){const n=s._loggers.get(e);if(n)return n.Level=l,n;const o=new t({name:e,level:l});return s._loggers.set(e,o),o}function d(e){var l;return null!==(l=s._loggers.get(e))&&void 0!==l?l: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=n,exports.JOURNAL_DEFAULT_LOGGER_NAME=o,exports.JOURNAL_LEVELS=e,exports.JOURNAL_LEVEL_WEIGHTS=l,exports.JournalInit=function(l){var n,r,_;if(s._instance)return s._instance;s._level=null!==(n=null==l?void 0:l.level)&&void 0!==n?n:"debug",s._logger=new t({name:o,level:s._level});const A=null==l?void 0:l.levels;if(A)for(const l of e){const e=A[l];e&&(s._styles[l]=Object.assign(Object.assign({},s._styles[l]),e))}for(const e of null!==(r=null==l?void 0:l.loggers)&&void 0!==r?r:[])L(e.name,null!==(_=e.level)&&void 0!==_?_:"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:c,Warn:a,Error:f},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"],l={debug:0,info:1,warn:2,error:3,disable:4},n={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 l;this.Name=e.name,this.Level=null!==(l=e.level)&&void 0!==l?l:"debug"}Debug(e,...l){this.Log("debug",e,...l)}Info(e,...l){this.Log("info",e,...l)}Warn(e,...l){this.Log("warn",e,...l)}Error(e,...l){this.Log("error",e,...l)}Log(e,n,...o){if("disable"===e)return;if(l[this.Level]<l[g()])return;if(l[e]<l[this.Level])return;const t=_(e),i=`[${this.Name}] ${String(n)}`,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({},n),_loggers:new Map};function s(l){var n,r,s;if(i._instance)return i._instance;i._level=null!==(n=null==l?void 0:l.level)&&void 0!==n?n:"debug",i._logger=new t({name:o,level:i._level});const b=null==l?void 0:l.levels;if(b)for(const l of e){const e=b[l];e&&(i._styles[l]=Object.assign(Object.assign({},i._styles[l]),e))}for(const e of null!==(r=null==l?void 0:l.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:g,SetLevel:u,GetLevelStyle:_,SetLevelStyle:d,Debug:c,Info:a,Warn:f,Error:v},i._instance}function g(){return i._level}function u(e){i._level=e,i._logger.Level=e}function c(e,...l){b("debug",e,...l)}function a(e,...l){b("info",e,...l)}function f(e,...l){b("warn",e,...l)}function v(e,...l){b("error",e,...l)}function b(e,l,...n){i._logger.Log(e,l,...n)}function _(e){return i._styles[e]}function d(e,l){i._styles[e]=Object.assign(Object.assign({},i._styles[e]),l)}function L(e,l="debug"){const n=i._loggers.get(e);if(n)return n.Level=l,n;const o=new t({name:e,level:l});return i._loggers.set(e,o),o}function h(e){var l;return null!==(l=i._loggers.get(e))&&void 0!==l?l:L(e,i._level)}function w(e){return i._loggers.delete(e)}function y(){i._loggers.clear()}function m(){return[...i._loggers.values()]}export{n as JOURNAL_DEFAULT_LEVEL_STYLES,o as JOURNAL_DEFAULT_LOGGER_NAME,e as JOURNAL_LEVELS,l as JOURNAL_LEVEL_WEIGHTS,s as JournalInit,t as JournalLogger};
|
package/dist/journal.mjs
CHANGED
|
@@ -109,7 +109,6 @@ const JournalContext = {
|
|
|
109
109
|
function JournalInit(options) {
|
|
110
110
|
var _a, _b, _c;
|
|
111
111
|
if (JournalContext._instance) {
|
|
112
|
-
JournalContext._instance.Warn('[Journal] 已初始化,请勿重复调用');
|
|
113
112
|
return JournalContext._instance;
|
|
114
113
|
}
|
|
115
114
|
JournalContext._level = (_a = options === null || options === void 0 ? void 0 : options.level) !== null && _a !== void 0 ? _a : 'debug';
|
package/dist/package.json
CHANGED