@alwatr/logger
Advanced tools
Comparing version 0.24.0 to 0.24.1
@@ -6,2 +6,8 @@ # Change Log | ||
## [0.24.1](https://github.com/AliMD/alwatr/compare/v0.24.0...v0.24.1) (2022-12-01) | ||
### Bug Fixes | ||
- **logger:** optimize for browserify builds ([7afdc1c](https://github.com/AliMD/alwatr/commit/7afdc1cb5baf9b66dedcdc251595c02a79a163b2)) | ||
# [0.24.0](https://github.com/AliMD/alwatr/compare/v0.23.0...v0.24.0) (2022-11-28) | ||
@@ -8,0 +14,0 @@ |
@@ -27,3 +27,3 @@ import type { AlwatrLogger } from './type.js'; | ||
*/ | ||
export declare const createLogger: (scope: string, color?: string, debug?: boolean) => AlwatrLogger; | ||
export declare const createLogger: (scope: string, color?: string | null, debug?: boolean) => AlwatrLogger; | ||
//# sourceMappingURL=logger.d.ts.map |
@@ -44,5 +44,5 @@ const isBrowser = typeof process === 'undefined'; | ||
? globalThis.localStorage?.getItem('ALWATR_DEBUG')?.trim() | ||
: globalThis.process?.env?.ALWATR_DEBUG?.trim(); | ||
: process?.env?.ALWATR_DEBUG?.trim(); | ||
const getDebugState = (scope) => { | ||
if (debugString == null && isBrowser === false && globalThis.process.env.NODE_ENV !== 'production') { | ||
if (debugString == null && isBrowser === false && process.env.NODE_ENV !== 'production') { | ||
return true; | ||
@@ -84,4 +84,6 @@ } | ||
*/ | ||
export const createLogger = (scope, color = getNextColor(), debug = getDebugState(scope)) => { | ||
export const createLogger = (scope, color, debug) => { | ||
scope = scope.trim(); | ||
color ?? (color = getNextColor()); | ||
debug ?? (debug = getDebugState(scope)); | ||
const first = scope.charAt(0); | ||
@@ -88,0 +90,0 @@ if (first !== '[' && first !== '{' && first !== '(' && first !== '<') { |
{ | ||
"name": "@alwatr/logger", | ||
"version": "0.24.0", | ||
"version": "0.24.1", | ||
"description": "Fancy colorful console debugger with custom scope written in tiny TypeScript, ES module.", | ||
@@ -37,3 +37,3 @@ "keywords": [ | ||
}, | ||
"gitHead": "4240c5bbb8b7552e9adfdc7e914c7b09b74cd206" | ||
"gitHead": "5aee7500ddc3a20fd0690f47a954dc55daaffb06" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
28818
283