@alwatr/logger
Advanced tools
Comparing version 0.16.0 to 0.17.0
@@ -6,10 +6,12 @@ # Change Log | ||
# [0.16.0](https://github.com/AliMD/alwatr/compare/v0.15.0...v0.16.0) (2022-09-08) | ||
# [0.17.0](https://github.com/AliMD/alwatr/compare/v0.16.1...v0.17.0) (2022-10-21) | ||
**Note:** Version bump only for package @alwatr/logger | ||
### Bug Fixes | ||
- **`logger`:** `accident` sould `console.warn` ([c210c9f](https://github.com/AliMD/alwatr/commit/c210c9f6a864692848ea0c89d6ffbdb19167732a)) | ||
# [0.16.0](https://github.com/AliMD/alwatr/compare/v0.15.0...v0.16.0) (2022-09-08) | ||
**Note:** Version bump only for package @alwatr/logger | ||
# [0.15.0](https://github.com/AliMD/alwatr/compare/v0.14.0...v0.15.0) (2022-09-01) | ||
@@ -16,0 +18,0 @@ |
@@ -15,4 +15,4 @@ const isBrowser = typeof process === 'undefined'; | ||
let colorIndex = 0; | ||
const colorList = isBrowser ? | ||
[ | ||
const colorList = isBrowser | ||
? [ | ||
'#35b997', | ||
@@ -33,4 +33,4 @@ '#f05561', | ||
'#ee2524', | ||
] : | ||
['0;36', '0;35', '0;34', '0;33', '0;32']; // red and white omitted | ||
] | ||
: ['0;36', '0;35', '0;34', '0;33', '0;32']; // red and white omitted | ||
const getNextColor = () => { | ||
@@ -44,5 +44,5 @@ const color = colorList[colorIndex]; | ||
}; | ||
const debugString = isBrowser ? | ||
globalThis.localStorage?.getItem('ALWATR_DEBUG')?.trim() : | ||
globalThis.process?.env?.ALWATR_DEBUG?.trim(); | ||
const debugString = isBrowser | ||
? globalThis.localStorage?.getItem('ALWATR_DEBUG')?.trim() | ||
: globalThis.process?.env?.ALWATR_DEBUG?.trim(); | ||
const getDebugState = (scope) => { | ||
@@ -103,8 +103,8 @@ if (debugString == null && isBrowser === false && globalThis.process.env.NODE_ENV !== 'production') { | ||
scope, | ||
accident: isBrowser ? | ||
console.error.bind(console, '%c%s%c.%s "%s" => Accident: "%s" (%s)!', styleScope, scope, style.reset) : | ||
console.error.bind(console, `${styleScope}⚠️ %s\x1b[33m.%s "%s" =>${style.reset}`, scope), | ||
error: isBrowser ? | ||
console.error.bind(console, '%c%s%c.%s "%s" =>', styleScope, scope, style.reset) : | ||
console.error.bind(console, `${styleScope}❌ %s\x1b[31m.%s "%s" =>\x1b[0;2m`, scope), | ||
accident: isBrowser | ||
? console.warn.bind(console, '%c%s%c.%s "%s" => Accident: "%s" (%s)!', styleScope, scope, style.reset) | ||
: console.warn.bind(console, `${styleScope}⚠️ %s\x1b[33m.%s "%s" =>${style.reset}`, scope), | ||
error: isBrowser | ||
? console.error.bind(console, '%c%s%c.%s "%s" =>', styleScope, scope, style.reset) | ||
: console.error.bind(console, `${styleScope}❌ %s\x1b[31m.%s "%s" =>\x1b[0;2m`, scope), | ||
}; | ||
@@ -129,5 +129,5 @@ if (!debug) { | ||
logMethodFull: console.debug.bind(console, keySection + '.%s(%o); // %o', styleScope, scope, style.reset), | ||
incident: isBrowser ? | ||
console.trace.bind(console, '%c%s%c.%s() => Incident: "%s" (%s)!', styleScope, scope, style.reset) : | ||
console.log.bind(console, `${styleScope}🔸 %s${style.reset}.%s() => Incident: "%s" (%s)!\x1b[0;2m`, scope), | ||
incident: isBrowser | ||
? console.log.bind(console, '%c%s%c.%s() => Incident: "%s" (%s)!', styleScope, scope, style.reset) | ||
: console.log.bind(console, `${styleScope}🔸 %s${style.reset}.%s() => Incident: "%s" (%s)!\x1b[0;2m`, scope), | ||
logOther: console.debug.bind(console, keySection, styleScope, scope, style.reset), | ||
@@ -134,0 +134,0 @@ }; |
{ | ||
"name": "@alwatr/logger", | ||
"version": "0.16.0", | ||
"version": "0.17.0", | ||
"description": "Fancy colorful console debugger with custom scope written in tiny TypeScript, ES module.", | ||
@@ -37,3 +37,3 @@ "keywords": [ | ||
}, | ||
"gitHead": "403b42f686edc84c4a3021b40f5b05dce0289f12" | ||
"gitHead": "f531925ca3db1072c0eaea90cb18e00802c93247" | ||
} |
@@ -19,3 +19,3 @@ # @alwatr/logger | ||
Many of the methods in the logger are no-ops when the debug mode is off. | ||
Many of the methods in the logger are no-ops when the debug mode is off in the browser. | ||
Please remember to **reload** the window after changing the debug mode. | ||
@@ -41,2 +41,4 @@ | ||
> Make sure the [log level](https://developer.chrome.com/docs/devtools/console/log/#browser) in set correctly. | ||
## API | ||
@@ -120,3 +122,3 @@ | ||
`console.trace` an event or expected accident. (not warn or error) | ||
`console.log` an event or expected accident. (not warn or error) | ||
@@ -123,0 +125,0 @@ Example: |
@@ -79,3 +79,3 @@ export interface GlobalAlwatr { | ||
/** | ||
* `console.trace` an event or expected accident. (not warn or error) | ||
* `console.log` an event or expected accident. (not warn or error) | ||
* | ||
@@ -82,0 +82,0 @@ * Example: |
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
27034
194