@alwatr/logger 1.1.5 → 1.2.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 +7 -1
- package/logger.d.ts.map +1 -1
- package/logger.js +3 -0
- package/logger.js.map +1 -1
- package/package.json +2 -2
- package/type.d.ts +10 -0
- package/type.d.ts.map +1 -1
- package/type.js.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,11 +3,17 @@
|
|
|
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.2.0](https://github.com/AliMD/alwatr-eslib/compare/@alwatr/logger@1.1.5...@alwatr/logger@1.2.0) (2023-10-23)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* **logger:** banner method ([3e3af6d](https://github.com/AliMD/alwatr-eslib/commit/3e3af6d71ccecaaf14ca9d63a8a14c7239afe697)) by @
|
|
11
|
+
|
|
6
12
|
## [1.1.5](https://github.com/AliMD/alwatr-eslib/compare/@alwatr/logger@1.1.4...@alwatr/logger@1.1.5) (2023-09-19)
|
|
7
13
|
|
|
8
14
|
### Bug Fixes
|
|
9
15
|
|
|
10
|
-
|
|
16
|
+
- package repo urls ([466cbe9](https://github.com/AliMD/alwatr-eslib/commit/466cbe9188f24e1a1bc36d879a95b52538a58f16)) by @AliMD
|
|
11
17
|
|
|
12
18
|
## [1.1.4](https://github.com/AliMD/alwatr-eslib/compare/@alwatr/logger@1.1.3...@alwatr/logger@1.1.4) (2023-09-19)
|
|
13
19
|
|
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,SAEsC,CAAC;AAmD5D;;;;;;;;;;;;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,SAEsC,CAAC;AAmD5D;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,YAAY,WAAY,MAAM,wBAAuB,YAoDjE,CAAC"}
|
package/logger.js
CHANGED
|
@@ -75,6 +75,9 @@ export const createLogger = (domain, devMode = DEV_MODE) => {
|
|
|
75
75
|
const requiredItems = {
|
|
76
76
|
devMode,
|
|
77
77
|
domain,
|
|
78
|
+
banner: NODE_MODE
|
|
79
|
+
? console.log.bind(console, `\x1b[1;37;45m\n\n %s${_style.reset}`)
|
|
80
|
+
: console.log.bind(console, '%c%s', 'font-size: 2rem; background-color: #5858e8; color: #fff; padding: 1rem 4rem; border-radius: 0.5rem;'),
|
|
78
81
|
accident: NODE_MODE
|
|
79
82
|
? console.warn.bind(console, `${styleScope}⚠️\n%s\x1b[33m.%s() Accident \`%s\` %s!${_style.reset}`, domain)
|
|
80
83
|
: console.warn.bind(console, '%c%s%c.%s() Accident `%s` %s!', styleScope, domain, _style.reset),
|
package/logger.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.js","sourceRoot":"","sources":["src/logger.ts"],"names":[],"mappings":"AAAA,OAAO,E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AAI,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('alwatrDebug') === '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: AlwatrLogger = {\n devMode,\n domain,\n\n banner: NODE_MODE\n ? console.log.bind(console, `\\x1b[1;37;45m\\n\\n %s${_style.reset}`)\n : console.log.bind(console, '%c%s',\n 'font-size: 2rem; background-color: #5858e8; color: #fff; padding: 1rem 4rem; border-radius: 0.5rem;'),\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 };\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.2.0",
|
|
4
4
|
"description": "Fancy colorful console debugger with custom scope written in tiny TypeScript, ES module.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"log",
|
|
@@ -35,5 +35,5 @@
|
|
|
35
35
|
"@alwatr/type": "^1.1.4",
|
|
36
36
|
"tslib": "^2.6.2"
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "26313bbc24641dcfdaa3a0f94159218e634f390d"
|
|
39
39
|
}
|
package/type.d.ts
CHANGED
|
@@ -131,5 +131,15 @@ export interface AlwatrLogger {
|
|
|
131
131
|
* ```
|
|
132
132
|
*/
|
|
133
133
|
timeEnd?(label: string): void;
|
|
134
|
+
/**
|
|
135
|
+
* log big banner
|
|
136
|
+
*
|
|
137
|
+
* Example:
|
|
138
|
+
*
|
|
139
|
+
* ```ts
|
|
140
|
+
* logger.banner('Alwatr PWA v2');
|
|
141
|
+
* ```
|
|
142
|
+
*/
|
|
143
|
+
banner?(message: string): void;
|
|
134
144
|
}
|
|
135
145
|
//# 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,OAAO,EAAE,OAAO,CAAC;IA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;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;IAE9B;;;;;;;;OAQG;IACH,MAAM,CAAC,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC"}
|
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` 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"]}
|
|
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 /**\n * log big banner\n *\n * Example:\n *\n * ```ts\n * logger.banner('Alwatr PWA v2');\n * ```\n */\n banner?(message: string): void;\n}\n"]}
|