@alwatr/logger 0.30.0 → 0.32.0
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 +18 -0
- package/README.md +4 -171
- package/logger.d.ts +3 -6
- package/logger.d.ts.map +1 -1
- package/logger.js +52 -79
- package/logger.js.map +1 -1
- package/package.json +3 -3
- package/type.d.ts +35 -19
- package/type.d.ts.map +1 -1
- package/type.js.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,24 @@
|
|
|
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
|
+
# [0.32.0](https://github.com/AliMD/alwatr/compare/v0.31.0...v0.32.0) (2023-05-27)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @alwatr/logger
|
|
9
|
+
|
|
10
|
+
# [0.31.0](https://github.com/AliMD/alwatr/compare/v0.30.0...v0.31.0) (2023-05-08)
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
- **logger:** logMethod args type ([66338b7](https://github.com/AliMD/alwatr/commit/66338b7ba1d4b15af78f9f604f7be0a7e483413d))
|
|
15
|
+
- **logger:** logMethod args type ([1983b3d](https://github.com/AliMD/alwatr/commit/1983b3d2fe260226ca2660e33b9bd924facdf776))
|
|
16
|
+
- new logger api ([9d83a7d](https://github.com/AliMD/alwatr/commit/9d83a7dc5c103bc3bb4282dacfd85fa998915300))
|
|
17
|
+
|
|
18
|
+
### Features
|
|
19
|
+
|
|
20
|
+
- **logger:** add `duration time` to logger time label ([ef188c4](https://github.com/AliMD/alwatr/commit/ef188c41a02789e1b35ab424bab24a393a03a3b0))
|
|
21
|
+
- **logger:** add `time` & `timeEnd` ([0bd4ec5](https://github.com/AliMD/alwatr/commit/0bd4ec5dbd185b17cfb8656a84a782e848ade138))
|
|
22
|
+
- **logger:** optional devMode per package ([cc1eb87](https://github.com/AliMD/alwatr/commit/cc1eb879832807d55ad4cf268a54b2d5e4346fff))
|
|
23
|
+
|
|
6
24
|
# [0.30.0](https://github.com/AliMD/alwatr/compare/v0.29.0...v0.30.0) (2023-03-06)
|
|
7
25
|
|
|
8
26
|
### Features
|
package/README.md
CHANGED
|
@@ -10,184 +10,17 @@ import {createLogger} from 'https://esm.run/@alwatr/logger';
|
|
|
10
10
|
const logger = createLogger('demo');
|
|
11
11
|
|
|
12
12
|
function sayHello(name: string) {
|
|
13
|
-
logger.logMethodArgs('sayHello', {name});
|
|
13
|
+
logger.logMethodArgs?.('sayHello', {name});
|
|
14
14
|
}
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
-
### Debug Mode
|
|
17
|
+
### Debug/Develope Mode (DEV_MODE)
|
|
18
18
|
|
|
19
19
|
Many of the methods in the logger are no-ops when the debug mode is off in the browser.
|
|
20
20
|
Please remember to **reload** the window after changing the debug mode.
|
|
21
21
|
|
|
22
|
-
- Debugging all scopes
|
|
23
|
-
|
|
24
|
-
```ts
|
|
25
|
-
window.localStorage?.setItem('ALWATR_DEBUG', '*');
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
- Debugging specific scope
|
|
29
|
-
|
|
30
|
-
```ts
|
|
31
|
-
window.localStorage?.setItem('ALWATR_DEBUG', 'scope_name');
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
- Debugging some scopes with pattern
|
|
35
|
-
|
|
36
|
-
```ts
|
|
37
|
-
window.localStorage?.setItem('ALWATR_DEBUG', '*alwatr*');
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
> Make sure the [log level](https://developer.chrome.com/docs/devtools/console/log/#browser) in set correctly.
|
|
41
|
-
|
|
42
|
-
## API
|
|
43
|
-
|
|
44
|
-
### `createLogger(scope: string, color: string, force = boolean)`
|
|
45
|
-
|
|
46
|
-
Create a logger function for fancy console debug with custom scope.
|
|
47
|
-
|
|
48
|
-
- **color** is optional and automatically select from internal fancy color list.
|
|
49
|
-
- **debug** is optional and automatically detect from localStorage `ALWATR_DEBUG` item or `process.env.ALWATR_DEBUG`
|
|
50
|
-
|
|
51
|
-
Example:
|
|
52
|
-
|
|
53
|
-
```ts
|
|
54
|
-
import {createLogger} from 'https://esm.run/@alwatr/logger';
|
|
55
|
-
const logger = createLogger('logger/demo');
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
### `logger.debug: boolean`
|
|
59
|
-
|
|
60
|
-
Debug state for current scope base on localStorage `ALWATR_DEBUG` pattern.
|
|
61
|
-
|
|
62
|
-
### `logger.color: string`
|
|
63
|
-
|
|
64
|
-
Debug state for current scope base on localStorage `ALWATR_DEBUG` pattern.
|
|
65
|
-
|
|
66
|
-
### `logger.scope: string`
|
|
67
|
-
|
|
68
|
-
Debug state for current scope base on localStorage `ALWATR_DEBUG` pattern.
|
|
69
|
-
|
|
70
|
-
### `logger.logProperty(property, value)`
|
|
71
|
-
|
|
72
|
-
`console.debug` property change.
|
|
73
|
-
|
|
74
|
-
Example:
|
|
75
|
-
|
|
76
|
-
```ts
|
|
77
|
-
logger.logProperty('name', 'ali');
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
### `logger.logMethod(method)`
|
|
81
|
-
|
|
82
|
-
`console.debug` function or method calls.
|
|
83
|
-
|
|
84
|
-
Example:
|
|
85
|
-
|
|
86
|
-
```ts
|
|
87
|
-
function myMethod() {
|
|
88
|
-
logger.logMethod('myMethod');
|
|
89
|
-
}
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
### `logger.logMethodArgs(method, args)`
|
|
93
|
-
|
|
94
|
-
`console.debug` function or method calls with arguments.
|
|
95
|
-
|
|
96
|
-
Example:
|
|
97
|
-
|
|
98
|
-
```ts
|
|
99
|
-
function myMethod(a: number, b: number) {
|
|
100
|
-
logger.logMethodArgs('myMethod', {a, b});
|
|
101
|
-
}
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
### `logger.logMethodFull(method, args, result)`
|
|
105
|
-
|
|
106
|
-
`console.debug` function or method calls with arguments.
|
|
107
|
-
|
|
108
|
-
Example:
|
|
109
|
-
|
|
110
|
-
```ts
|
|
111
|
-
function add(a: number, b: number): number {
|
|
112
|
-
const result = a + b;
|
|
113
|
-
logger.logMethodFull('add', {a, b}, result);
|
|
114
|
-
return result;
|
|
115
|
-
}
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
### `logger.incident(method, code, description, ...args)`
|
|
119
|
-
|
|
120
|
-
`console.log` an event or expected accident. (not warn or error)
|
|
121
|
-
|
|
122
|
-
Example:
|
|
123
|
-
|
|
124
|
-
```ts
|
|
125
|
-
logger.incident('fetch', 'abort_signal', 'aborted signal received', {url: '/test.json'});
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
### `logger.accident(method, code, description, ...args)`
|
|
129
|
-
|
|
130
|
-
`console.warn` an unexpected accident or error that you handled.
|
|
131
|
-
|
|
132
|
-
Example:
|
|
133
|
-
|
|
134
|
-
```ts
|
|
135
|
-
logger.accident('fetch', 'file_not_found', 'url requested return 404 not found', {
|
|
136
|
-
url: '/test.json',
|
|
137
|
-
});
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
### `logger.error(method, code, errorStack, ...args)`
|
|
141
|
-
|
|
142
|
-
`console.error` an unexpected error.
|
|
143
|
-
|
|
144
|
-
Example:
|
|
145
|
-
|
|
146
22
|
```ts
|
|
147
|
-
|
|
148
|
-
...
|
|
149
|
-
}
|
|
150
|
-
catch (err) {
|
|
151
|
-
logger.error('myMethod', 'error_code', err, {a: 1, b: 2});
|
|
152
|
-
}
|
|
23
|
+
window.localStorage?.setItem('ALWATR_DEBUG', '1');
|
|
153
24
|
```
|
|
154
25
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
Simple `console.debug` with styled scope.
|
|
158
|
-
|
|
159
|
-
Example:
|
|
160
|
-
|
|
161
|
-
```ts
|
|
162
|
-
logger.logOther('foo:', 'bar', {a: 1});
|
|
163
|
-
```
|
|
164
|
-
|
|
165
|
-
### How to handle promises?
|
|
166
|
-
|
|
167
|
-
For example with a promise function with error:
|
|
168
|
-
|
|
169
|
-
```ts
|
|
170
|
-
const failPromiseTest = (): Promise<never> => new Promise((_, reject) => reject(new Error('my_error_code')));
|
|
171
|
-
```
|
|
172
|
-
|
|
173
|
-
Best practices to catch the error and log it:
|
|
174
|
-
|
|
175
|
-
```ts
|
|
176
|
-
// Unhandled promise rejection (just log it)
|
|
177
|
-
failPromiseTest().catch((err) =>
|
|
178
|
-
logger.error('myMethod', (err as Error).message || 'error_code', err)
|
|
179
|
-
);
|
|
180
|
-
|
|
181
|
-
// Handled promise rejection
|
|
182
|
-
try {
|
|
183
|
-
await failPromiseTest();
|
|
184
|
-
} catch (err) {
|
|
185
|
-
logger.accident(
|
|
186
|
-
'myMethod',
|
|
187
|
-
'error_code',
|
|
188
|
-
'failPromiseTest failed!, ' + (err as Error).message,
|
|
189
|
-
err
|
|
190
|
-
);
|
|
191
|
-
// do something to handle the error...
|
|
192
|
-
}
|
|
193
|
-
```
|
|
26
|
+
> Make sure the [log level](https://developer.chrome.com/docs/devtools/console/log/#browser) in set correctly.
|
package/logger.d.ts
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import { globalAlwatr } from './global-alwatr.js';
|
|
2
2
|
import type { AlwatrLogger } from './type.js';
|
|
3
3
|
export { type AlwatrLogger, globalAlwatr };
|
|
4
|
-
export declare const
|
|
5
|
-
export declare const
|
|
6
|
-
scope: string;
|
|
7
|
-
reset: string;
|
|
8
|
-
};
|
|
4
|
+
export declare const NODE_MODE: boolean;
|
|
5
|
+
export declare const DEV_MODE: boolean;
|
|
9
6
|
/**
|
|
10
7
|
* Create a logger function for fancy console debug with custom scope.
|
|
11
8
|
*
|
|
@@ -19,5 +16,5 @@ export declare const style: {
|
|
|
19
16
|
* const logger = createLogger('logger/demo');
|
|
20
17
|
* ```
|
|
21
18
|
*/
|
|
22
|
-
export declare const createLogger: (
|
|
19
|
+
export declare const createLogger: (domain: string, devMode?: boolean) => AlwatrLogger;
|
|
23
20
|
//# sourceMappingURL=logger.d.ts.map
|
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;
|
|
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,YA6CjE,CAAC"}
|
package/logger.js
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
1
|
-
var _a
|
|
1
|
+
var _a;
|
|
2
2
|
import { globalAlwatr } from './global-alwatr.js';
|
|
3
3
|
export { globalAlwatr };
|
|
4
|
-
export const isBrowser = typeof process === 'undefined';
|
|
5
4
|
globalAlwatr.registeredList.push({
|
|
6
5
|
name: '@alwatr/logger',
|
|
7
6
|
version: _ALWATR_VERSION_,
|
|
8
7
|
});
|
|
8
|
+
export const NODE_MODE = typeof process !== 'undefined';
|
|
9
|
+
export const DEV_MODE = NODE_MODE
|
|
10
|
+
? process.env.ALWATR_DEBUG === '1'
|
|
11
|
+
: ((_a = globalThis.localStorage) === null || _a === void 0 ? void 0 : _a.getItem('ALWATR_DEBUG')) === '1';
|
|
9
12
|
/**
|
|
10
13
|
* Color list storage for logger.
|
|
11
14
|
*/
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
+
const colorList = NODE_MODE
|
|
16
|
+
? ['0;36', '0;35', '0;34', '0;33', '0;32'] // red and white omitted
|
|
17
|
+
: [
|
|
15
18
|
'#35b997',
|
|
16
19
|
'#f05561',
|
|
17
20
|
'#ee224a',
|
|
@@ -27,43 +30,28 @@ const colorList = isBrowser
|
|
|
27
30
|
'#1da2dc',
|
|
28
31
|
'#f05123',
|
|
29
32
|
'#ee2524',
|
|
30
|
-
]
|
|
31
|
-
|
|
32
|
-
const
|
|
33
|
-
const color = colorList[
|
|
34
|
-
|
|
35
|
-
if (
|
|
36
|
-
|
|
33
|
+
];
|
|
34
|
+
let _colorIndex = 0;
|
|
35
|
+
const _getNextColor = () => {
|
|
36
|
+
const color = colorList[_colorIndex];
|
|
37
|
+
_colorIndex++;
|
|
38
|
+
if (_colorIndex >= colorList.length) {
|
|
39
|
+
_colorIndex = 0;
|
|
37
40
|
}
|
|
38
41
|
return color;
|
|
39
42
|
};
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
:
|
|
43
|
-
const getDebugState = (scope) => {
|
|
44
|
-
if (debugString == null && isBrowser === false && process.env.NODE_ENV !== 'production') {
|
|
45
|
-
return true;
|
|
46
|
-
}
|
|
47
|
-
// prettier-ignore
|
|
48
|
-
if (debugString == null ||
|
|
49
|
-
debugString == '') {
|
|
50
|
-
return false;
|
|
51
|
-
}
|
|
52
|
-
// prettier-ignore
|
|
53
|
-
if (debugString === scope ||
|
|
54
|
-
debugString === '*' ||
|
|
55
|
-
(debugString.indexOf('*') === 0 && // starts with `*` for example: `*alwatr*`
|
|
56
|
-
scope.indexOf(debugString.replaceAll('*', '')) !== -1) ||
|
|
57
|
-
(debugString.indexOf('*') === debugString.length - 1 && // ends with `*` for example: `alwatr/*`
|
|
58
|
-
scope.indexOf(debugString.replaceAll('*', '')) === 0)) {
|
|
59
|
-
return true;
|
|
60
|
-
}
|
|
61
|
-
// else
|
|
62
|
-
return false;
|
|
43
|
+
const _style = {
|
|
44
|
+
scope: NODE_MODE ? '\x1b[{{color}}m' : 'color: {{color}};',
|
|
45
|
+
reset: NODE_MODE ? '\x1b[0m' : 'color: inherit;',
|
|
63
46
|
};
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
47
|
+
const _keySection = NODE_MODE ? '%s%s%s' : '%c%s%c';
|
|
48
|
+
const _sanitizeDomain = (domain) => {
|
|
49
|
+
domain = domain.trim();
|
|
50
|
+
const first = domain.charAt(0);
|
|
51
|
+
if (first !== '[' && first !== '{' && first !== '<') {
|
|
52
|
+
domain = '[' + domain + ']';
|
|
53
|
+
}
|
|
54
|
+
return domain;
|
|
67
55
|
};
|
|
68
56
|
/**
|
|
69
57
|
* Create a logger function for fancy console debug with custom scope.
|
|
@@ -78,54 +66,39 @@ export const style = {
|
|
|
78
66
|
* const logger = createLogger('logger/demo');
|
|
79
67
|
* ```
|
|
80
68
|
*/
|
|
81
|
-
export const createLogger = (
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
const first = scope.charAt(0);
|
|
86
|
-
if (first !== '[' && first !== '{' && first !== '(' && first !== '<') {
|
|
87
|
-
scope = '[' + scope + ']';
|
|
88
|
-
}
|
|
89
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
90
|
-
const empty = () => { };
|
|
91
|
-
const keySection = isBrowser ? '%c%s%c' : '%s%s%s';
|
|
92
|
-
const styleScope = style.scope.replaceAll('{{color}}', color);
|
|
69
|
+
export const createLogger = (domain, devMode = DEV_MODE) => {
|
|
70
|
+
const color = _getNextColor();
|
|
71
|
+
const styleScope = _style.scope.replaceAll('{{color}}', color);
|
|
72
|
+
domain = _sanitizeDomain(domain);
|
|
93
73
|
/**
|
|
94
|
-
* Required logger object, accident, error always reported even when the
|
|
74
|
+
* Required logger object, accident, error always reported even when the devMode is false.
|
|
95
75
|
*/
|
|
96
76
|
const requiredItems = {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
: console.error.bind(console, `${styleScope}❌\n%s\x1b[31m.%s() Error \`%s\`${style.reset}\n`, scope),
|
|
77
|
+
devMode,
|
|
78
|
+
domain,
|
|
79
|
+
accident: NODE_MODE
|
|
80
|
+
? console.warn.bind(console, `${styleScope}⚠️\n%s\x1b[33m.%s() Accident \`%s\` %s!${_style.reset}`, domain)
|
|
81
|
+
: console.warn.bind(console, '%c%s%c.%s() Accident `%s` %s!', styleScope, domain, _style.reset),
|
|
82
|
+
error: NODE_MODE
|
|
83
|
+
? console.error.bind(console, `${styleScope}❌\n%s\x1b[31m.%s() Error \`%s\`${_style.reset}\n`, domain)
|
|
84
|
+
: console.error.bind(console, '%c%s%c.%s() Error `%s`\n', styleScope, domain, _style.reset),
|
|
106
85
|
};
|
|
107
|
-
if (!
|
|
108
|
-
return
|
|
109
|
-
...requiredItems,
|
|
110
|
-
logProperty: empty,
|
|
111
|
-
logMethod: empty,
|
|
112
|
-
logMethodArgs: empty,
|
|
113
|
-
logMethodFull: empty,
|
|
114
|
-
logOther: empty,
|
|
115
|
-
incident: empty,
|
|
116
|
-
};
|
|
86
|
+
if (!devMode) {
|
|
87
|
+
return requiredItems;
|
|
117
88
|
}
|
|
118
|
-
// else
|
|
89
|
+
// else
|
|
119
90
|
return {
|
|
120
91
|
...requiredItems,
|
|
121
|
-
logProperty: console.debug.bind(console,
|
|
122
|
-
logMethod: console.debug.bind(console,
|
|
123
|
-
logMethodArgs: console.debug.bind(console,
|
|
124
|
-
logMethodFull: console.debug.bind(console,
|
|
125
|
-
logOther: console.debug.bind(console,
|
|
126
|
-
incident:
|
|
127
|
-
? console.log.bind(console,
|
|
128
|
-
: console.log.bind(console,
|
|
92
|
+
logProperty: console.debug.bind(console, _keySection + '.%s = %o;', styleScope, domain, _style.reset),
|
|
93
|
+
logMethod: console.debug.bind(console, _keySection + '.%s();', styleScope, domain, _style.reset),
|
|
94
|
+
logMethodArgs: console.debug.bind(console, _keySection + '.%s(%o);', styleScope, domain, _style.reset),
|
|
95
|
+
logMethodFull: console.debug.bind(console, _keySection + '.%s(%o) => %o', styleScope, domain, _style.reset),
|
|
96
|
+
logOther: console.debug.bind(console, _keySection, styleScope, domain, _style.reset),
|
|
97
|
+
incident: NODE_MODE
|
|
98
|
+
? console.log.bind(console, `${styleScope}🚸\n%s${_style.reset}.%s() Incident \`%s\` %s!${_style.reset}`, domain)
|
|
99
|
+
: console.log.bind(console, '%c%s%c.%s() Incident `%s` %s!', styleScope, domain, 'color: orange;'),
|
|
100
|
+
time: (label) => console.time(domain + '.' + label + ' duration time'),
|
|
101
|
+
timeEnd: (label) => console.timeEnd(domain + '.' + label + ' duration time'),
|
|
129
102
|
};
|
|
130
103
|
};
|
|
131
104
|
//# sourceMappingURL=logger.js.map
|
package/logger.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.js","sourceRoot":"","sources":["src/logger.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,oBAAoB,CAAC;AAIhD,OAAO,EAAoB,YAAY,EAAC,CAAC;AAEzC,
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["src/logger.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,oBAAoB,CAAC;AAIhD,OAAO,EAAoB,YAAY,EAAC,CAAC;AAEzC,YAAY,CAAC,cAAc,CAAC,IAAI,CAAC;IAC/B,IAAI,EAAE,gBAAgB;IACtB,OAAO,EAAE,gBAAgB;CAC1B,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,SAAS,GAAG,OAAO,OAAO,KAAK,WAAW,CAAC;AACxD,MAAM,CAAC,MAAM,QAAQ,GAAG,SAAS;IAC/B,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,YAAY,KAAK,GAA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port {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 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": "0.
|
|
3
|
+
"version": "0.32.0",
|
|
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": "^0.
|
|
35
|
+
"@alwatr/type": "^0.32.0",
|
|
36
36
|
"tslib": "^2.5.0"
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "b20d2574ec144e3d10f5ad9645ab30b58d1d2d77"
|
|
39
39
|
}
|
package/type.d.ts
CHANGED
|
@@ -2,25 +2,21 @@ export interface AlwatrLogger {
|
|
|
2
2
|
/**
|
|
3
3
|
* Debug state for current scope base on localStorage `ALWATR_LOG` pattern.
|
|
4
4
|
*/
|
|
5
|
-
readonly
|
|
5
|
+
readonly devMode: boolean;
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* Domain scope defined for this logger.
|
|
8
8
|
*/
|
|
9
|
-
readonly
|
|
10
|
-
/**
|
|
11
|
-
* Scope defined for this logger.
|
|
12
|
-
*/
|
|
13
|
-
readonly scope: string;
|
|
9
|
+
readonly domain: string;
|
|
14
10
|
/**
|
|
15
11
|
* `console.debug` property change.
|
|
16
12
|
*
|
|
17
13
|
* Example:
|
|
18
14
|
*
|
|
19
15
|
* ```ts
|
|
20
|
-
* logger.logProperty('name', 'ali');
|
|
16
|
+
* logger.logProperty?.('name', 'ali');
|
|
21
17
|
* ```
|
|
22
18
|
*/
|
|
23
|
-
logProperty(property: string, value: unknown): void;
|
|
19
|
+
logProperty?(property: string, value: unknown): void;
|
|
24
20
|
/**
|
|
25
21
|
* `console.debug` function or method calls.
|
|
26
22
|
*
|
|
@@ -28,11 +24,11 @@ export interface AlwatrLogger {
|
|
|
28
24
|
*
|
|
29
25
|
* ```ts
|
|
30
26
|
* function myMethod () {
|
|
31
|
-
* logger.logMethod('myMethod');
|
|
27
|
+
* logger.logMethod?.('myMethod');
|
|
32
28
|
* }
|
|
33
29
|
* ```
|
|
34
30
|
*/
|
|
35
|
-
logMethod(method: string): void;
|
|
31
|
+
logMethod?(method: string): void;
|
|
36
32
|
/**
|
|
37
33
|
* `console.debug` function or method calls with arguments.
|
|
38
34
|
*
|
|
@@ -40,11 +36,11 @@ export interface AlwatrLogger {
|
|
|
40
36
|
*
|
|
41
37
|
* ```ts
|
|
42
38
|
* function myMethod (a: number, b: number) {
|
|
43
|
-
* logger.logMethodArgs('myMethod', {a, b});
|
|
39
|
+
* logger.logMethodArgs?.('myMethod', {a, b});
|
|
44
40
|
* }
|
|
45
41
|
* ```
|
|
46
42
|
*/
|
|
47
|
-
logMethodArgs(method: string, args:
|
|
43
|
+
logMethodArgs?(method: string, args: unknown): void;
|
|
48
44
|
/**
|
|
49
45
|
* `console.debug` function or method calls with arguments.
|
|
50
46
|
*
|
|
@@ -53,12 +49,12 @@ export interface AlwatrLogger {
|
|
|
53
49
|
* ```ts
|
|
54
50
|
* function add (a: number, b: number): number {
|
|
55
51
|
* const result = a + b;
|
|
56
|
-
* logger.logMethodFull('add', {a, b}, result);
|
|
52
|
+
* logger.logMethodFull?.('add', {a, b}, result);
|
|
57
53
|
* return result;
|
|
58
54
|
* }
|
|
59
55
|
* ```
|
|
60
56
|
*/
|
|
61
|
-
logMethodFull(method: string, args:
|
|
57
|
+
logMethodFull?(method: string, args: unknown, result: unknown): void;
|
|
62
58
|
/**
|
|
63
59
|
* `console.log` an event or expected accident.
|
|
64
60
|
* not warn or error just important information.
|
|
@@ -66,10 +62,10 @@ export interface AlwatrLogger {
|
|
|
66
62
|
* Example:
|
|
67
63
|
*
|
|
68
64
|
* ```ts
|
|
69
|
-
* logger.incident('fetch', 'abort_signal', 'aborted signal received', {url: '/test.json'});
|
|
65
|
+
* logger.incident?.('fetch', 'abort_signal', 'aborted signal received', {url: '/test.json'});
|
|
70
66
|
* ```
|
|
71
67
|
*/
|
|
72
|
-
incident(method: string, code: string, desc: string, ...args: unknown[]): void;
|
|
68
|
+
incident?(method: string, code: string, desc: string, ...args: unknown[]): void;
|
|
73
69
|
/**
|
|
74
70
|
* `console.warn` an unexpected accident or error that you handled like warning.
|
|
75
71
|
*
|
|
@@ -101,9 +97,29 @@ export interface AlwatrLogger {
|
|
|
101
97
|
* Example:
|
|
102
98
|
*
|
|
103
99
|
* ```ts
|
|
104
|
-
* logger.logOther('foo:', 'bar', {a: 1});
|
|
100
|
+
* logger.logOther?.('foo:', 'bar', {a: 1});
|
|
101
|
+
* ```
|
|
102
|
+
*/
|
|
103
|
+
logOther?(...args: unknown[]): void;
|
|
104
|
+
/**
|
|
105
|
+
* Simple `console.time` with scope.
|
|
106
|
+
*
|
|
107
|
+
* Example:
|
|
108
|
+
*
|
|
109
|
+
* ```ts
|
|
110
|
+
* logger.time?.('foo');
|
|
111
|
+
* ```
|
|
112
|
+
*/
|
|
113
|
+
time?(label: string): void;
|
|
114
|
+
/**
|
|
115
|
+
* Simple `console.timeEnd` with scope.
|
|
116
|
+
*
|
|
117
|
+
* Example:
|
|
118
|
+
*
|
|
119
|
+
* ```ts
|
|
120
|
+
* logger.timeEnd?.('foo');
|
|
105
121
|
* ```
|
|
106
122
|
*/
|
|
107
|
-
|
|
123
|
+
timeEnd?(label: string): void;
|
|
108
124
|
}
|
|
109
125
|
//# sourceMappingURL=type.d.ts.map
|
package/type.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["src/type.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,QAAQ,CAAC,
|
|
1
|
+
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["src/type.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAE1B;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAExB;;;;;;;;OAQG;IACH,WAAW,CAAC,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;IAErD;;;;;;;;;;OAUG;IACH,SAAS,CAAC,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAEjC;;;;;;;;;;OAUG;IACH,aAAa,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,IAAI,CAAC;IAEpD;;;;;;;;;;;;OAYG;IACH,aAAa,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,GAAG,IAAI,CAAC;IAErE;;;;;;;;;OASG;IACH,QAAQ,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAEhF;;;;;;;;OAQG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAE/E;;;;;;;;;;;;;OAaG;IACH,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,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
|
|
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"]}
|