@alwatr/logger
Advanced tools
Comparing version 0.24.1 to 0.25.0
@@ -6,2 +6,8 @@ # Change Log | ||
# [0.25.0](https://github.com/AliMD/alwatr/compare/v0.24.1...v0.25.0) (2022-12-07) | ||
### Features | ||
- **logger:** log incident in production mode ([c9b6c56](https://github.com/AliMD/alwatr/commit/c9b6c56182750444b1cced3343b02eea6a9f24c5)) | ||
## [0.24.1](https://github.com/AliMD/alwatr/compare/v0.24.0...v0.24.1) (2022-12-01) | ||
@@ -8,0 +14,0 @@ |
@@ -0,1 +1,2 @@ | ||
var _a, _b, _c, _d, _e, _f; | ||
const isBrowser = typeof process === 'undefined'; | ||
@@ -5,4 +6,4 @@ /** | ||
*/ | ||
export const alwatrRegisteredList = globalThis.Alwatr?.registeredList || []; | ||
globalThis.Alwatr ?? (globalThis.Alwatr = { registeredList: alwatrRegisteredList }); | ||
export const alwatrRegisteredList = ((_a = globalThis.Alwatr) === null || _a === void 0 ? void 0 : _a.registeredList) || []; | ||
(_b = globalThis.Alwatr) !== null && _b !== void 0 ? _b : (globalThis.Alwatr = { registeredList: alwatrRegisteredList }); | ||
alwatrRegisteredList.push({ | ||
@@ -44,4 +45,4 @@ name: '@alwatr/logger', | ||
const debugString = isBrowser | ||
? globalThis.localStorage?.getItem('ALWATR_DEBUG')?.trim() | ||
: process?.env?.ALWATR_DEBUG?.trim(); | ||
? (_d = (_c = globalThis.localStorage) === null || _c === void 0 ? void 0 : _c.getItem('ALWATR_DEBUG')) === null || _d === void 0 ? void 0 : _d.trim() | ||
: (_f = (_e = process === null || process === void 0 ? void 0 : process.env) === null || _e === void 0 ? void 0 : _e.ALWATR_DEBUG) === null || _f === void 0 ? void 0 : _f.trim(); | ||
const getDebugState = (scope) => { | ||
@@ -87,4 +88,4 @@ if (debugString == null && isBrowser === false && process.env.NODE_ENV !== 'production') { | ||
scope = scope.trim(); | ||
color ?? (color = getNextColor()); | ||
debug ?? (debug = getDebugState(scope)); | ||
color !== null && color !== void 0 ? color : (color = getNextColor()); | ||
debug !== null && debug !== void 0 ? debug : (debug = getDebugState(scope)); | ||
const first = scope.charAt(0); | ||
@@ -105,2 +106,5 @@ if (first !== '[' && first !== '{' && first !== '(' && first !== '<') { | ||
scope, | ||
incident: isBrowser | ||
? console.log.bind(console, '%c%s%c.%s() Incident `%s` %s!', styleScope, scope, 'color: orange;') | ||
: console.log.bind(console, `${styleScope}🚸\n%s${style.reset}.%s() Incident \`%s\` %s!${style.reset}`, scope), | ||
accident: isBrowser | ||
@@ -120,3 +124,2 @@ ? console.warn.bind(console, '%c%s%c.%s() Accident `%s` %s!', styleScope, scope, style.reset) | ||
logMethodFull: empty, | ||
incident: empty, | ||
logOther: empty, | ||
@@ -132,5 +135,2 @@ }; | ||
logMethodFull: console.debug.bind(console, keySection + '.%s(%o) => %o', styleScope, scope, style.reset), | ||
incident: isBrowser | ||
? console.log.bind(console, '%c%s%c.%s() Incident `%s` %s!', styleScope, scope, 'color: orange;') | ||
: console.log.bind(console, `${styleScope}🚸\n%s${style.reset}.%s() Incident \`%s\` %s!${style.reset}`, scope), | ||
logOther: console.debug.bind(console, keySection, styleScope, scope, style.reset), | ||
@@ -137,0 +137,0 @@ }; |
{ | ||
"name": "@alwatr/logger", | ||
"version": "0.24.1", | ||
"version": "0.25.0", | ||
"description": "Fancy colorful console debugger with custom scope written in tiny TypeScript, ES module.", | ||
@@ -37,3 +37,3 @@ "keywords": [ | ||
}, | ||
"gitHead": "5aee7500ddc3a20fd0690f47a954dc55daaffb06" | ||
"gitHead": "03cf3c146f075309527bcf1e762a589696d0ce1d" | ||
} |
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
37806