@alwatr/logger 1.0.1 → 1.1.1
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/CHANGELOG.md +62 -1
- package/logger.d.ts.map +1 -1
- package/logger.js +2 -2
- package/logger.js.map +1 -1
- package/package.json +4 -4
- package/type.d.ts +10 -0
- package/type.d.ts.map +1 -1
- package/type.js.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,10 +3,71 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
## [1.
|
|
6
|
+
## [1.1.1](https://github.com/AliMD/alwatr/compare/@alwatr/logger@1.1.0...@alwatr/logger@1.1.1) (2023-09-12)
|
|
7
7
|
|
|
8
8
|
**Note:** Version bump only for package @alwatr/logger
|
|
9
9
|
|
|
10
|
+
# 1.1.0 (2023-09-12)
|
|
11
|
+
|
|
12
|
+
### Features
|
|
13
|
+
|
|
14
|
+
* **logger:** add logModule ([2e37bef](https://github.com/AliMD/alwatr/commit/2e37befd5f66094c5a521424e2a9d60796384f88))
|
|
15
|
+
|
|
16
|
+
# 1.0.0 (2023-06-14)
|
|
17
|
+
|
|
18
|
+
# 0.32.0 (2023-05-27)
|
|
19
|
+
|
|
20
|
+
# 0.31.0 (2023-05-08)
|
|
21
|
+
|
|
22
|
+
### Bug Fixes
|
|
23
|
+
|
|
24
|
+
* **logger:** logMethod args type ([66338b7](https://github.com/AliMD/alwatr/commit/66338b7ba1d4b15af78f9f604f7be0a7e483413d))
|
|
25
|
+
* **logger:** logMethod args type ([1983b3d](https://github.com/AliMD/alwatr/commit/1983b3d2fe260226ca2660e33b9bd924facdf776))
|
|
26
|
+
* new logger api ([9d83a7d](https://github.com/AliMD/alwatr/commit/9d83a7dc5c103bc3bb4282dacfd85fa998915300))
|
|
27
|
+
|
|
28
|
+
### Features
|
|
29
|
+
|
|
30
|
+
* **logger:** add `duration time` to logger time label ([ef188c4](https://github.com/AliMD/alwatr/commit/ef188c41a02789e1b35ab424bab24a393a03a3b0))
|
|
31
|
+
* **logger:** add `time` & `timeEnd` ([0bd4ec5](https://github.com/AliMD/alwatr/commit/0bd4ec5dbd185b17cfb8656a84a782e848ade138))
|
|
32
|
+
* **logger:** optional devMode per package ([cc1eb87](https://github.com/AliMD/alwatr/commit/cc1eb879832807d55ad4cf268a54b2d5e4346fff))
|
|
33
|
+
|
|
34
|
+
# 0.30.0 (2023-03-06)
|
|
35
|
+
|
|
36
|
+
### Features
|
|
37
|
+
|
|
38
|
+
* **logger:** export isBrowser ([5b5be8b](https://github.com/AliMD/alwatr/commit/5b5be8b2312ca67f186d1614506423f1fdb90877))
|
|
39
|
+
|
|
40
|
+
# 0.29.0 (2023-02-10)
|
|
41
|
+
|
|
42
|
+
# 0.28.0 (2023-01-20)
|
|
43
|
+
|
|
44
|
+
### Bug Fixes
|
|
45
|
+
|
|
46
|
+
* **logger:** _ALWATR_VERSION_ ([9cf8f20](https://github.com/AliMD/alwatr/commit/9cf8f208e8adbfa2e2c622a8465453d5554cbd37))
|
|
47
|
+
|
|
48
|
+
# 0.27.0 (2022-12-29)
|
|
49
|
+
|
|
50
|
+
### Bug Fixes
|
|
51
|
+
|
|
52
|
+
* **logger:** version ([2295fee](https://github.com/AliMD/alwatr/commit/2295fee74e8eebd9db399129de31f2b0d6d6b168))
|
|
53
|
+
|
|
54
|
+
### Features
|
|
55
|
+
|
|
56
|
+
* **type:** define alwatrRegistredList ([25406c2](https://github.com/AliMD/alwatr/commit/25406c268f39cf3e055ea05c9fc7b50bd3dd0a17))
|
|
57
|
+
|
|
58
|
+
# 0.26.0 (2022-12-22)
|
|
59
|
+
|
|
60
|
+
### Bug Fixes
|
|
61
|
+
|
|
62
|
+
* set correct path ([d01ce6f](https://github.com/AliMD/alwatr/commit/d01ce6ffa749a5e3e0e11e35b4ed61d75d61fec9))
|
|
63
|
+
* tsconfig ([e96dcd3](https://github.com/AliMD/alwatr/commit/e96dcd30774a9f06f7d051e0504192cbbe019e35))
|
|
64
|
+
|
|
65
|
+
### Features
|
|
66
|
+
|
|
67
|
+
* improve error debugging ([1fba504](https://github.com/AliMD/alwatr/commit/1fba50400a1e8ececc10bbe8ea11cc8dcea2289c))
|
|
68
|
+
* **logger:** add root version ([2ac01c1](https://github.com/AliMD/alwatr/commit/2ac01c1d12323a6c8591b3dd4826d08a55647dc1))
|
|
69
|
+
* **logger:** move incident to deployment mode ([4ee8dac](https://github.com/AliMD/alwatr/commit/4ee8dac5c54ce8a897382d3d4fb5bb852d24cf24))
|
|
70
|
+
|
|
10
71
|
# [1.0.0](https://github.com/AliMD/alwatr/compare/v0.32.0...v1.0.0) (2023-06-14)
|
|
11
72
|
|
|
12
73
|
**Note:** Version bump only for package @alwatr/logger
|
package/logger.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["src/logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,oBAAoB,CAAC;AAEhD,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,WAAW,CAAC;AAE5C,OAAO,EAAC,KAAK,YAAY,EAAE,YAAY,EAAC,CAAC;AAOzC,eAAO,MAAM,SAAS,SAAiC,CAAC;AACxD,eAAO,MAAM,QAAQ,SAEuC,CAAC;AAmD7D;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,YAAY,WAAY,MAAM,wBAAuB,
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["src/logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,oBAAoB,CAAC;AAEhD,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,WAAW,CAAC;AAE5C,OAAO,EAAC,KAAK,YAAY,EAAE,YAAY,EAAC,CAAC;AAOzC,eAAO,MAAM,SAAS,SAAiC,CAAC;AACxD,eAAO,MAAM,QAAQ,SAEuC,CAAC;AAmD7D;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,YAAY,WAAY,MAAM,wBAAuB,YA+CjE,CAAC"}
|
package/logger.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
var _a;
|
|
2
1
|
import { globalAlwatr } from './global-alwatr.js';
|
|
3
2
|
export { globalAlwatr };
|
|
4
3
|
globalAlwatr.registeredList.push({
|
|
@@ -8,7 +7,7 @@ globalAlwatr.registeredList.push({
|
|
|
8
7
|
export const NODE_MODE = typeof process !== 'undefined';
|
|
9
8
|
export const DEV_MODE = NODE_MODE
|
|
10
9
|
? process.env.ALWATR_DEBUG === '1'
|
|
11
|
-
:
|
|
10
|
+
: globalThis.localStorage?.getItem('ALWATR_DEBUG') === '1';
|
|
12
11
|
/**
|
|
13
12
|
* Color list storage for logger.
|
|
14
13
|
*/
|
|
@@ -91,6 +90,7 @@ export const createLogger = (domain, devMode = DEV_MODE) => {
|
|
|
91
90
|
...requiredItems,
|
|
92
91
|
logProperty: console.debug.bind(console, _keySection + '.%s = %o;', styleScope, domain, _style.reset),
|
|
93
92
|
logMethod: console.debug.bind(console, _keySection + '.%s();', styleScope, domain, _style.reset),
|
|
93
|
+
logModule: console.debug.bind(console, _keySection + '/%s.js;', styleScope, domain, _style.reset),
|
|
94
94
|
logMethodArgs: console.debug.bind(console, _keySection + '.%s(%o);', styleScope, domain, _style.reset),
|
|
95
95
|
logMethodFull: console.debug.bind(console, _keySection + '.%s(%o) => %o', styleScope, domain, _style.reset),
|
|
96
96
|
logOther: console.debug.bind(console, _keySection, styleScope, domain, _style.reset),
|
package/logger.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.js","sourceRoot":"","sources":["src/logger.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["src/logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,oBAAoB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AC,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,EAAE,+BAA+B,EAAE,UAAU,EAAE,MAAM,EAAE,gBAAgB,CAAC;QAEpG,IAAI,EAAE,CAAC,KAAa,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,GAAG,GAAG,GAAG,KAAK,GAAG,gBAAgB,CAAC;QAC9E,OAAO,EAAE,CAAC,KAAa,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,GAAG,GAAG,GAAG,KAAK,GAAG,gBAAgB,CAAC;KAC5E,CAAC;AACb,CAAC,CAAC","sourcesContent":["import {globalAlwatr} from './global-alwatr.js';\n\nimport type {AlwatrLogger} from './type.js';\n\nexport {type AlwatrLogger, globalAlwatr};\n\nglobalAlwatr.registeredList.push({\n name: '@alwatr/logger',\n version: _ALWATR_VERSION_,\n});\n\nexport const NODE_MODE = typeof process !== 'undefined';\nexport const DEV_MODE = NODE_MODE\n ? process.env.ALWATR_DEBUG === '1'\n : globalThis.localStorage?.getItem('ALWATR_DEBUG') === '1';\n\n/**\n * Color list storage for logger.\n */\nconst colorList = NODE_MODE\n ? ['0;36', '0;35', '0;34', '0;33', '0;32'] // red and white omitted\n : [\n '#35b997',\n '#f05561',\n '#ee224a',\n '#91c13e',\n '#22af4b',\n '#f0e995',\n '#0fe995',\n '#0f89ca',\n '#08b9a5',\n '#fee851',\n '#ee573d',\n '#f9df30',\n '#1da2dc',\n '#f05123',\n '#ee2524',\n ];\n\nlet _colorIndex = 0;\nconst _getNextColor = (): string => {\n const color = colorList[_colorIndex];\n _colorIndex++;\n if (_colorIndex >= colorList.length) {\n _colorIndex = 0;\n }\n return color;\n};\n\nconst _style = {\n scope: NODE_MODE ? '\\x1b[{{color}}m' : 'color: {{color}};',\n reset: NODE_MODE ? '\\x1b[0m' : 'color: inherit;',\n};\n\nconst _keySection = NODE_MODE ? '%s%s%s' : '%c%s%c';\n\nconst _sanitizeDomain = (domain: string): string => {\n domain = domain.trim();\n const first = domain.charAt(0);\n if (first !== '[' && first !== '{' && first !== '<') {\n domain = '[' + domain + ']';\n }\n return domain;\n};\n\n/**\n * Create a logger function for fancy console debug with custom scope.\n *\n * - **color** is optional and automatically select from internal fancy color list.\n * - **debug** is optional and automatically detect from localStorage `ALWATR_DEBUG` item or `process.env.ALWATR_DEBUG`\n *\n * Example:\n *\n * ```ts\n * import {createLogger} from 'https://esm.run/@alwatr/logger';\n * const logger = createLogger('logger/demo');\n * ```\n */\nexport const createLogger = (domain: string, devMode = DEV_MODE): AlwatrLogger => {\n const color = _getNextColor();\n const styleScope = _style.scope.replaceAll('{{color}}', color);\n domain = _sanitizeDomain(domain);\n\n /**\n * Required logger object, accident, error always reported even when the devMode is false.\n */\n const requiredItems = {\n devMode,\n domain,\n\n accident: NODE_MODE\n ? console.warn.bind(console, `${styleScope}⚠️\\n%s\\x1b[33m.%s() Accident \\`%s\\` %s!${_style.reset}`, domain)\n : console.warn.bind(console, '%c%s%c.%s() Accident `%s` %s!', styleScope, domain, _style.reset),\n\n error: NODE_MODE\n ? console.error.bind(console, `${styleScope}❌\\n%s\\x1b[31m.%s() Error \\`%s\\`${_style.reset}\\n`, domain)\n : console.error.bind(console, '%c%s%c.%s() Error `%s`\\n', styleScope, domain, _style.reset),\n } as const;\n\n if (!devMode) {\n return requiredItems;\n }\n // else\n return {\n ...requiredItems,\n\n logProperty: console.debug.bind(console, _keySection + '.%s = %o;', styleScope, domain, _style.reset),\n\n logMethod: console.debug.bind(console, _keySection + '.%s();', styleScope, domain, _style.reset),\n\n logModule: console.debug.bind(console, _keySection + '/%s.js;', styleScope, domain, _style.reset),\n\n logMethodArgs: console.debug.bind(console, _keySection + '.%s(%o);', styleScope, domain, _style.reset),\n\n logMethodFull: console.debug.bind(console, _keySection + '.%s(%o) => %o', styleScope, domain, _style.reset),\n\n logOther: console.debug.bind(console, _keySection, styleScope, domain, _style.reset),\n\n incident: NODE_MODE\n ? console.log.bind(console, `${styleScope}🚸\\n%s${_style.reset}.%s() Incident \\`%s\\` %s!${_style.reset}`, domain)\n : console.log.bind(console, '%c%s%c.%s() Incident `%s` %s!', styleScope, domain, 'color: orange;'),\n\n time: (label: string) => console.time(domain + '.' + label + ' duration time'),\n timeEnd: (label: string) => console.timeEnd(domain + '.' + label + ' duration time'),\n } as const;\n};\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alwatr/logger",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "Fancy colorful console debugger with custom scope written in tiny TypeScript, ES module.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"log",
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
"url": "https://github.com/AliMD/alwatr/issues"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@alwatr/type": "^1.
|
|
36
|
-
"tslib": "^2.
|
|
35
|
+
"@alwatr/type": "^1.1.1",
|
|
36
|
+
"tslib": "^2.6.2"
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "ebc98f75330ab77c7a5bfeebe0fd1f4748bf3821"
|
|
39
39
|
}
|
package/type.d.ts
CHANGED
|
@@ -17,6 +17,16 @@ export interface AlwatrLogger {
|
|
|
17
17
|
* ```
|
|
18
18
|
*/
|
|
19
19
|
logProperty?(property: string, value: unknown): void;
|
|
20
|
+
/**
|
|
21
|
+
* `console.debug` module name.
|
|
22
|
+
*
|
|
23
|
+
* Example:
|
|
24
|
+
*
|
|
25
|
+
* ```ts
|
|
26
|
+
* logger.logModule?.('app');
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
logModule?(name: string): void;
|
|
20
30
|
/**
|
|
21
31
|
* `console.debug` function or method calls.
|
|
22
32
|
*
|
package/type.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type.d.ts","sourceRoot":"","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AI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAE9D;;;;;;;;OAQG;IACH,QAAQ,CAAC,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAEpC;;;;;;;;OAQG;IACH,IAAI,CAAC,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAE3B;;;;;;;;OAQG;IACH,OAAO,CAAC,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B"}
|
package/type.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type.js","sourceRoot":"","sources":["src/type.ts"],"names":[],"mappings":"","sourcesContent":["export interface AlwatrLogger {\n /**\n * Debug state for current scope base on localStorage `ALWATR_LOG` pattern.\n */\n readonly devMode: boolean;\n\n /**\n * Domain scope defined for this logger.\n */\n readonly domain: string;\n\n /**\n * `console.debug` property change.\n *\n * Example:\n *\n * ```ts\n * logger.logProperty?.('name', 'ali');\n * ```\n */\n logProperty?(property: string, value: unknown): void;\n\n /**\n * `console.debug` function or method calls.\n *\n * Example:\n *\n * ```ts\n * function myMethod () {\n * logger.logMethod?.('myMethod');\n * }\n * ```\n */\n logMethod?(method: string): void;\n\n /**\n * `console.debug` function or method calls with arguments.\n *\n * Example:\n *\n * ```ts\n * function myMethod (a: number, b: number) {\n * logger.logMethodArgs?.('myMethod', {a, b});\n * }\n * ```\n */\n logMethodArgs?(method: string, args: unknown): void;\n\n /**\n * `console.debug` function or method calls with arguments.\n *\n * Example:\n *\n * ```ts\n * function add (a: number, b: number): number {\n * const result = a + b;\n * logger.logMethodFull?.('add', {a, b}, result);\n * return result;\n * }\n * ```\n */\n logMethodFull?(method: string, args: unknown, result: unknown): void;\n\n /**\n * `console.log` an event or expected accident.\n * not warn or error just important information.\n *\n * Example:\n *\n * ```ts\n * logger.incident?.('fetch', 'abort_signal', 'aborted signal received', {url: '/test.json'});\n * ```\n */\n incident?(method: string, code: string, desc: string, ...args: unknown[]): void;\n\n /**\n * `console.warn` an unexpected accident or error that you handled like warning.\n *\n * Example:\n *\n * ```ts\n * logger.accident('fetch', 'file_not_found', 'url requested return 404 not found', {url: '/test.json'});\n * ```\n */\n accident(method: string, code: string, desc: string, ...args: unknown[]): void;\n\n /**\n * `console.error` an unexpected error.\n *\n * Example:\n *\n * ```ts\n * try {\n * ...\n * }\n * catch (err) {\n * logger.error('myMethod', 'error_code', err, {a: 1, b: 2});\n * }\n * ```\n */\n error(method: string, code: string, ...args: unknown[]): void;\n\n /**\n * Simple `console.debug` with styled scope.\n *\n * Example:\n *\n * ```ts\n * logger.logOther?.('foo:', 'bar', {a: 1});\n * ```\n */\n logOther?(...args: unknown[]): void;\n\n /**\n * Simple `console.time` with scope.\n *\n * Example:\n *\n * ```ts\n * logger.time?.('foo');\n * ```\n */\n time?(label: string): void;\n\n /**\n * Simple `console.timeEnd` with scope.\n *\n * Example:\n *\n * ```ts\n * logger.timeEnd?.('foo');\n * ```\n */\n timeEnd?(label: string): void;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"type.js","sourceRoot":"","sources":["src/type.ts"],"names":[],"mappings":"","sourcesContent":["export interface AlwatrLogger {\n /**\n * Debug state for current scope base on localStorage `ALWATR_LOG` pattern.\n */\n readonly devMode: boolean;\n\n /**\n * Domain scope defined for this logger.\n */\n readonly domain: string;\n\n /**\n * `console.debug` property change.\n *\n * Example:\n *\n * ```ts\n * logger.logProperty?.('name', 'ali');\n * ```\n */\n logProperty?(property: string, value: unknown): void;\n\n /**\n * `console.debug` module name.\n *\n * Example:\n *\n * ```ts\n * logger.logModule?.('app');\n * ```\n */\n logModule?(name: string): void;\n\n /**\n * `console.debug` function or method calls.\n *\n * Example:\n *\n * ```ts\n * function myMethod () {\n * logger.logMethod?.('myMethod');\n * }\n * ```\n */\n logMethod?(method: string): void;\n\n /**\n * `console.debug` function or method calls with arguments.\n *\n * Example:\n *\n * ```ts\n * function myMethod (a: number, b: number) {\n * logger.logMethodArgs?.('myMethod', {a, b});\n * }\n * ```\n */\n logMethodArgs?(method: string, args: unknown): void;\n\n /**\n * `console.debug` function or method calls with arguments.\n *\n * Example:\n *\n * ```ts\n * function add (a: number, b: number): number {\n * const result = a + b;\n * logger.logMethodFull?.('add', {a, b}, result);\n * return result;\n * }\n * ```\n */\n logMethodFull?(method: string, args: unknown, result: unknown): void;\n\n /**\n * `console.log` an event or expected accident.\n * not warn or error just important information.\n *\n * Example:\n *\n * ```ts\n * logger.incident?.('fetch', 'abort_signal', 'aborted signal received', {url: '/test.json'});\n * ```\n */\n incident?(method: string, code: string, desc: string, ...args: unknown[]): void;\n\n /**\n * `console.warn` an unexpected accident or error that you handled like warning.\n *\n * Example:\n *\n * ```ts\n * logger.accident('fetch', 'file_not_found', 'url requested return 404 not found', {url: '/test.json'});\n * ```\n */\n accident(method: string, code: string, desc: string, ...args: unknown[]): void;\n\n /**\n * `console.error` an unexpected error.\n *\n * Example:\n *\n * ```ts\n * try {\n * ...\n * }\n * catch (err) {\n * logger.error('myMethod', 'error_code', err, {a: 1, b: 2});\n * }\n * ```\n */\n error(method: string, code: string, ...args: unknown[]): void;\n\n /**\n * Simple `console.debug` with styled scope.\n *\n * Example:\n *\n * ```ts\n * logger.logOther?.('foo:', 'bar', {a: 1});\n * ```\n */\n logOther?(...args: unknown[]): void;\n\n /**\n * Simple `console.time` with scope.\n *\n * Example:\n *\n * ```ts\n * logger.time?.('foo');\n * ```\n */\n time?(label: string): void;\n\n /**\n * Simple `console.timeEnd` with scope.\n *\n * Example:\n *\n * ```ts\n * logger.timeEnd?.('foo');\n * ```\n */\n timeEnd?(label: string): void;\n}\n"]}
|