@alwatr/logger 0.27.0 → 0.29.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 +14 -0
- package/global-alwatr.d.ts +2 -0
- package/global-alwatr.d.ts.map +1 -0
- package/global-alwatr.js +17 -0
- package/global-alwatr.js.map +1 -0
- package/logger.d.ts +2 -8
- package/logger.d.ts.map +1 -1
- package/logger.js +7 -10
- package/logger.js.map +1 -1
- package/package.json +4 -3
- package/type.d.ts +0 -17
- package/type.d.ts.map +1 -1
- package/type.js.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,20 @@
|
|
|
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.29.0](https://github.com/AliMD/alwatr/compare/v0.28.0...v0.29.0) (2023-02-10)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @alwatr/logger
|
|
9
|
+
|
|
10
|
+
# [0.28.0](https://github.com/AliMD/alwatr/compare/v0.27.0...v0.28.0) (2023-01-20)
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
- **logger:** _ALWATR_VERSION_ ([9cf8f20](https://github.com/AliMD/alwatr/commit/9cf8f208e8adbfa2e2c622a8465453d5554cbd37))
|
|
15
|
+
|
|
16
|
+
### Features
|
|
17
|
+
|
|
18
|
+
- **type:** define alwatrRegistredList ([25406c2](https://github.com/AliMD/alwatr/commit/25406c268f39cf3e055ea05c9fc7b50bd3dd0a17))
|
|
19
|
+
|
|
6
20
|
# [0.27.0](https://github.com/AliMD/alwatr/compare/v0.26.0...v0.27.0) (2022-12-29)
|
|
7
21
|
|
|
8
22
|
### Bug Fixes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"global-alwatr.d.ts","sourceRoot":"","sources":["src/global-alwatr.ts"],"names":[],"mappings":"AAoBA,eAAO,MAAM,YAAY,+CAAS,CAAC"}
|
package/global-alwatr.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
if (globalThis.Alwatr == null) {
|
|
2
|
+
globalThis.Alwatr = {
|
|
3
|
+
registeredList: [],
|
|
4
|
+
};
|
|
5
|
+
}
|
|
6
|
+
try {
|
|
7
|
+
_ALWATR_VERSION_;
|
|
8
|
+
}
|
|
9
|
+
catch {
|
|
10
|
+
globalThis._ALWATR_VERSION_ = 'ERROR';
|
|
11
|
+
console.warn('!! SCRIPTS LOADED OUTSIDE OF ALWATR BUILD ENVIRONMENT !!');
|
|
12
|
+
}
|
|
13
|
+
if (Alwatr.registeredList == null) {
|
|
14
|
+
Alwatr.registeredList = [];
|
|
15
|
+
}
|
|
16
|
+
export const globalAlwatr = Alwatr;
|
|
17
|
+
//# sourceMappingURL=global-alwatr.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"global-alwatr.js","sourceRoot":"","sources":["src/global-alwatr.ts"],"names":[],"mappings":"AAEA,IAAI,UAAU,CAAC,MAAM,IAAI,IAAI,EAAE;IAC7B,UAAU,CAAC,MAAM,GAAG;QAClB,cAAc,EAAE,EAAE;KACnB,CAAC;CACH;AAED,IAAI;IACF,gBAAgB,CAAC;CAClB;AACD,MAAM;IACJ,UAAU,CAAC,gBAAgB,GAAG,OAAO,CAAC;IACtC,OAAO,CAAC,IAAI,CAAC,0DAA0D,CAAC,CAAC;CAC1E;AAED,IAAI,MAAM,CAAC,cAAc,IAAI,IAAI,EAAE;IACjC,MAAM,CAAC,cAAc,GAAG,EAAE,CAAC;CAC5B;AAED,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC","sourcesContent":["import type {} from '@alwatr/type/global.js';\n\nif (globalThis.Alwatr == null) {\n globalThis.Alwatr = {\n registeredList: [],\n };\n}\n\ntry {\n _ALWATR_VERSION_;\n}\ncatch {\n globalThis._ALWATR_VERSION_ = 'ERROR';\n console.warn('!! SCRIPTS LOADED OUTSIDE OF ALWATR BUILD ENVIRONMENT !!');\n}\n\nif (Alwatr.registeredList == null) {\n Alwatr.registeredList = [];\n}\n\nexport const globalAlwatr = Alwatr;\n"]}
|
package/logger.d.ts
CHANGED
|
@@ -1,12 +1,6 @@
|
|
|
1
|
+
import { globalAlwatr } from './global-alwatr.js';
|
|
1
2
|
import type { AlwatrLogger } from './type.js';
|
|
2
|
-
export { AlwatrLogger };
|
|
3
|
-
/**
|
|
4
|
-
* Define `globalThis.Alwatr.registeredList`
|
|
5
|
-
*/
|
|
6
|
-
export declare const alwatrRegisteredList: {
|
|
7
|
-
name: string;
|
|
8
|
-
version: string;
|
|
9
|
-
}[];
|
|
3
|
+
export { type AlwatrLogger, globalAlwatr };
|
|
10
4
|
export declare const style: {
|
|
11
5
|
scope: string;
|
|
12
6
|
reset: string;
|
package/logger.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["src/logger.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
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;AA+EzC,eAAO,MAAM,KAAK;;;CAGjB,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,YAAY,UAAW,MAAM,UAAU,MAAM,GAAG,IAAI,UAAU,OAAO,KAAG,YA+DpF,CAAC"}
|
package/logger.js
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
var _a, _b, _c, _d
|
|
1
|
+
var _a, _b, _c, _d;
|
|
2
|
+
import { globalAlwatr } from './global-alwatr.js';
|
|
3
|
+
export { globalAlwatr };
|
|
2
4
|
const isBrowser = typeof process === 'undefined';
|
|
3
|
-
|
|
4
|
-
* Define `globalThis.Alwatr.registeredList`
|
|
5
|
-
*/
|
|
6
|
-
export const alwatrRegisteredList = ((_a = globalThis.Alwatr) === null || _a === void 0 ? void 0 : _a.registeredList) || [];
|
|
7
|
-
(_b = globalThis.Alwatr) !== null && _b !== void 0 ? _b : (globalThis.Alwatr = { version: '0.26.0', registeredList: alwatrRegisteredList });
|
|
8
|
-
alwatrRegisteredList.push({
|
|
5
|
+
globalAlwatr.registeredList.push({
|
|
9
6
|
name: '@alwatr/logger',
|
|
10
|
-
version:
|
|
7
|
+
version: _ALWATR_VERSION_,
|
|
11
8
|
});
|
|
12
9
|
/**
|
|
13
10
|
* Color list storage for logger.
|
|
@@ -41,8 +38,8 @@ const getNextColor = () => {
|
|
|
41
38
|
return color;
|
|
42
39
|
};
|
|
43
40
|
const debugString = isBrowser
|
|
44
|
-
? (
|
|
45
|
-
: (
|
|
41
|
+
? (_b = (_a = globalThis.localStorage) === null || _a === void 0 ? void 0 : _a.getItem('ALWATR_DEBUG')) === null || _b === void 0 ? void 0 : _b.trim()
|
|
42
|
+
: (_d = (_c = process === null || process === void 0 ? void 0 : process.env) === null || _c === void 0 ? void 0 : _c.ALWATR_DEBUG) === null || _d === void 0 ? void 0 : _d.trim();
|
|
46
43
|
const getDebugState = (scope) => {
|
|
47
44
|
if (debugString == null && isBrowser === false && process.env.NODE_ENV !== 'production') {
|
|
48
45
|
return true;
|
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,CAAC;AAIhD,OAAO,EAAoB,YAAY,EAAC,CAAC;AAEzC,MAAM,SAAS,GAAG,OAAO,OAAO,KAAK,WAAW,CAA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a;QAEhB,WAAW,EAAE,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,UAAU,GAAG,WAAW,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC;QAElG,SAAS,EAAE,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,UAAU,GAAG,QAAQ,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC;QAE7F,aAAa,EAAE,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,UAAU,GAAG,UAAU,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC;QAEnG,aAAa,EAAE,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,UAAU,GAAG,eAAe,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC;QAExG,QAAQ,EAAE,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC;QAEjF,QAAQ,EAAE,SAAS;YACjB,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,EAAE,+BAA+B,EAAE,UAAU,EAAE,KAAK,EAAE,gBAAgB,CAAC;YACjG,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,UAAU,SAAS,KAAK,CAAC,KAAK,4BAA4B,KAAK,CAAC,KAAK,EAAE,EAAE,KAAK,CAAC;KACjH,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import {globalAlwatr} from './global-alwatr.js';\n\nimport type {AlwatrLogger} from './type.js';\n\nexport {type AlwatrLogger, globalAlwatr};\n\nconst isBrowser = typeof process === 'undefined';\n\nglobalAlwatr.registeredList.push({\n name: '@alwatr/logger',\n version: _ALWATR_VERSION_,\n});\n\n/**\n * Color list storage for logger.\n */\nlet colorIndex = 0;\nconst colorList = isBrowser\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 : ['0;36', '0;35', '0;34', '0;33', '0;32']; // red and white omitted\n\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 debugString = isBrowser\n ? globalThis.localStorage?.getItem('ALWATR_DEBUG')?.trim()\n : process?.env?.ALWATR_DEBUG?.trim();\n\nconst getDebugState = (scope: string): boolean => {\n if (debugString == null && isBrowser === false && process.env.NODE_ENV !== 'production') {\n return true;\n }\n\n // prettier-ignore\n if (\n debugString == null ||\n debugString == ''\n ) {\n return false;\n }\n\n // prettier-ignore\n if (\n debugString === scope ||\n debugString === '*' ||\n (\n debugString.indexOf('*') === 0 && // starts with `*` for example: `*alwatr*`\n scope.indexOf(debugString.replaceAll('*', '')) !== -1\n ) ||\n (\n debugString.indexOf('*') === debugString.length - 1 && // ends with `*` for example: `alwatr/*`\n scope.indexOf(debugString.replaceAll('*', '')) === 0\n )\n ) {\n return true;\n }\n\n // else\n return false;\n};\n\nexport const style = {\n scope: isBrowser ? 'color: {{color}};' : '\\x1b[{{color}}m',\n reset: isBrowser ? 'color: inherit;' : '\\x1b[0m',\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 = (scope: string, color?: string | null, debug?: boolean): AlwatrLogger => {\n scope = scope.trim();\n color ??= getNextColor();\n debug ??= getDebugState(scope);\n\n const first = scope.charAt(0);\n if (first !== '[' && first !== '{' && first !== '(' && first !== '<') {\n scope = '[' + scope + ']';\n }\n\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n const empty = (): void => {};\n\n const keySection = isBrowser ? '%c%s%c' : '%s%s%s';\n const styleScope = style.scope.replaceAll('{{color}}', color);\n\n /**\n * Required logger object, accident, error always reported even when the debug is false.\n */\n const requiredItems = {\n debug,\n color,\n scope,\n\n accident: isBrowser\n ? console.warn.bind(console, '%c%s%c.%s() Accident `%s` %s!', styleScope, scope, style.reset)\n : console.warn.bind(console, `${styleScope}⚠️\\n%s\\x1b[33m.%s() Accident \\`%s\\` %s!${style.reset}`, scope),\n\n error: isBrowser\n ? console.error.bind(console, '%c%s%c.%s() Error `%s`\\n', styleScope, scope, style.reset)\n : console.error.bind(console, `${styleScope}❌\\n%s\\x1b[31m.%s() Error \\`%s\\`${style.reset}\\n`, scope),\n };\n\n if (!debug) {\n return {\n ...requiredItems,\n logProperty: empty,\n logMethod: empty,\n logMethodArgs: empty,\n logMethodFull: empty,\n logOther: empty,\n incident: empty,\n };\n }\n\n // else if debug is true for this scope\n return {\n ...requiredItems,\n\n logProperty: console.debug.bind(console, keySection + '.%s = %o;', styleScope, scope, style.reset),\n\n logMethod: console.debug.bind(console, keySection + '.%s();', styleScope, scope, style.reset),\n\n logMethodArgs: console.debug.bind(console, keySection + '.%s(%o);', styleScope, scope, style.reset),\n\n logMethodFull: console.debug.bind(console, keySection + '.%s(%o) => %o', styleScope, scope, style.reset),\n\n logOther: console.debug.bind(console, keySection, styleScope, scope, style.reset),\n\n incident: isBrowser\n ? console.log.bind(console, '%c%s%c.%s() Incident `%s` %s!', styleScope, scope, 'color: orange;')\n : console.log.bind(console, `${styleScope}🚸\\n%s${style.reset}.%s() Incident \\`%s\\` %s!${style.reset}`, scope),\n };\n};\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alwatr/logger",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.29.0",
|
|
4
4
|
"description": "Fancy colorful console debugger with custom scope written in tiny TypeScript, ES module.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"log",
|
|
@@ -32,7 +32,8 @@
|
|
|
32
32
|
"url": "https://github.com/AliMD/alwatr/issues"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"
|
|
35
|
+
"@alwatr/type": "^0.29.0",
|
|
36
|
+
"tslib": "^2.5.0"
|
|
36
37
|
},
|
|
37
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "801487f183f8afd8cba25e0fec5d508c0b4fe809"
|
|
38
39
|
}
|
package/type.d.ts
CHANGED
|
@@ -1,20 +1,3 @@
|
|
|
1
|
-
export interface GlobalAlwatr {
|
|
2
|
-
version: string;
|
|
3
|
-
registeredList: Array<{
|
|
4
|
-
name: string;
|
|
5
|
-
version: string;
|
|
6
|
-
}>;
|
|
7
|
-
}
|
|
8
|
-
declare global {
|
|
9
|
-
var Alwatr: GlobalAlwatr;
|
|
10
|
-
var ALWATR_DEBUG: string | undefined;
|
|
11
|
-
/**
|
|
12
|
-
* @TODO: Make an issue to TS, WTF is this way! any better solution for more args in bind?!
|
|
13
|
-
*/
|
|
14
|
-
interface CallableFunction {
|
|
15
|
-
bind<T, A0, A1, A2, A3, A4, A extends unknown[], R>(this: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, arg4: A4, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, arg4: A4): (...args: A) => R;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
1
|
export interface AlwatrLogger {
|
|
19
2
|
/**
|
|
20
3
|
* Debug state for current scope base on localStorage `ALWATR_LOG` pattern.
|
package/type.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["src/type.ts"],"names":[],"mappings":"
|
|
1
|
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E,GAAG,IAAI,CAAC;IAE9D;;;;;;;;OAQG;IACH,QAAQ,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;CACpC"}
|
package/type.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type.js","sourceRoot":"","sources":["src/type.ts"],"names":[],"mappings":"","sourcesContent":["
|
|
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 debug: boolean;\n\n /**\n * Color picked for current scope.\n */\n readonly color: string;\n\n /**\n * Scope defined for this logger.\n */\n readonly scope: 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: Record<string, unknown> | string | number | boolean): 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: Record<string, unknown> | string | number | boolean, 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"]}
|