@alwatr/logger
Advanced tools
Comparing version 0.12.0 to 0.13.0
@@ -6,18 +6,20 @@ # Change Log | ||
# [0.12.0](https://github.com/AliMD/alwatr/compare/v0.11.0...v0.12.0) (2022-07-22) | ||
# [0.13.0](https://github.com/AliMD/alwatr/compare/v0.12.0...v0.13.0) (2022-08-06) | ||
**Note:** Version bump only for package @alwatr/logger | ||
### Bug Fixes | ||
* **logger:** refactor behavior of force ([7d9307b](https://github.com/AliMD/alwatr/commit/7d9307bb78523f3dae17b3bd80fa2fb47c90975f)) | ||
### Features | ||
* **logger:** compatible with node.js ([7ee8b6d](https://github.com/AliMD/alwatr/commit/7ee8b6de3143e39c300345dec6864c9c56a4aae7)) | ||
* **logger:** node coloring support ([2b4aab6](https://github.com/AliMD/alwatr/commit/2b4aab655bc0707761587a7439de98bbd4ad0e08)) | ||
# [0.12.0](https://github.com/AliMD/alwatr/compare/v0.11.0...v0.12.0) (2022-07-22) | ||
### Bug Fixes | ||
- **logger:** refactor behavior of force ([7d9307b](https://github.com/AliMD/alwatr/commit/7d9307bb78523f3dae17b3bd80fa2fb47c90975f)) | ||
### Features | ||
- **logger:** compatible with node.js ([7ee8b6d](https://github.com/AliMD/alwatr/commit/7ee8b6de3143e39c300345dec6864c9c56a4aae7)) | ||
- **logger:** node coloring support ([2b4aab6](https://github.com/AliMD/alwatr/commit/2b4aab655bc0707761587a7439de98bbd4ad0e08)) | ||
@@ -24,0 +26,0 @@ # [0.11.0](https://github.com/AliMD/alwatr/compare/v0.10.1...v0.11.0) (2022-04-16) |
@@ -1,2 +0,3 @@ | ||
import type { Logger } from './type'; | ||
import type { AlwatrLogger } from './type'; | ||
export { AlwatrLogger }; | ||
/** | ||
@@ -26,3 +27,3 @@ * Define `globalThis.Alwatr.registeredList` | ||
*/ | ||
export declare const createLogger: (scope: string, color?: string, debug?: boolean) => Logger; | ||
export declare const createLogger: (scope: string, color?: string, debug?: boolean) => AlwatrLogger; | ||
//# sourceMappingURL=logger.d.ts.map |
@@ -1,2 +0,1 @@ | ||
var _a, _b, _c, _d, _e, _f, _g; | ||
const isBrowser = typeof process === 'undefined'; | ||
@@ -6,4 +5,4 @@ /** | ||
*/ | ||
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 }); | ||
export const alwatrRegisteredList = globalThis.Alwatr?.registeredList || []; | ||
globalThis.Alwatr ?? (globalThis.Alwatr = { registeredList: alwatrRegisteredList }); | ||
alwatrRegisteredList.push({ | ||
@@ -45,8 +44,6 @@ name: '@alwatr/logger', | ||
const debugString = isBrowser ? | ||
(_d = (_c = globalThis.localStorage) === null || _c === void 0 ? void 0 : _c.getItem('ALWATR_DEBUG')) === null || _d === void 0 ? void 0 : _d.trim() : | ||
(_g = (_f = (_e = globalThis.process) === null || _e === void 0 ? void 0 : _e.env) === null || _f === void 0 ? void 0 : _f.ALWATR_DEBUG) === null || _g === void 0 ? void 0 : _g.trim(); | ||
globalThis.localStorage?.getItem('ALWATR_DEBUG')?.trim() : | ||
globalThis.process?.env?.ALWATR_DEBUG?.trim(); | ||
const getDebugState = (scope) => { | ||
if (debugString == null && | ||
isBrowser === false && | ||
globalThis.process.env.NODE_ENV !== 'production') { | ||
if (debugString == null && isBrowser === false && globalThis.process.env.NODE_ENV !== 'production') { | ||
return true; | ||
@@ -53,0 +50,0 @@ } |
{ | ||
"name": "@alwatr/logger", | ||
"version": "0.12.0", | ||
"version": "0.13.0", | ||
"description": "Fancy colorful console debugger with custom scope written in tiny TypeScript, ES module.", | ||
@@ -37,3 +37,3 @@ "keywords": [ | ||
}, | ||
"gitHead": "2da92e22ea946abf6155122d0a28674dd4c0308b" | ||
"gitHead": "2739e45b8d36caf18b25f5d779467c53a3efc835" | ||
} |
@@ -168,4 +168,3 @@ # @alwatr/logger | ||
```ts | ||
const failPromiseTest = (): Promise<never> => | ||
new Promise((_, reject) => reject(new Error('my_error_code'))); | ||
const failPromiseTest = (): Promise<never> => new Promise((_, reject) => reject(new Error('my_error_code'))); | ||
``` | ||
@@ -172,0 +171,0 @@ |
@@ -17,3 +17,3 @@ export interface GlobalAlwatr { | ||
} | ||
export interface Logger { | ||
export interface AlwatrLogger { | ||
/** | ||
@@ -20,0 +20,0 @@ * Debug state for current scope base on localStorage `ALWATR_LOG` pattern. |
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
26262
281
192