@alwatr/logger 6.0.17 → 7.0.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/dist/main.js ADDED
@@ -0,0 +1,9 @@
1
+ /* 📦 @alwatr/logger v7.0.0 */
2
+ import{getGlobalThis as X}from"@alwatr/global-this";import{platformInfo as F}from"@alwatr/platform-info";var j=X().console,Y=(()=>{if(F.development)if(F.isCli)return process.env.ALWATR_DEBUG!=="0";else return typeof localStorage<"u"&&localStorage.getItem("ALWATR_DEBUG")!=="0";return F.isCli?Boolean(process.env.DEBUG):typeof localStorage<"u"&&localStorage.getItem("ALWATR_DEBUG")==="1"})(),R=(()=>F.isCli?["0;36","0;35","0;34","0;33","0;32"]:["#35b997","#f05561","#ee224a","#91c13e","#22af4b","#f0e995","#0fe995","#0f89ca","#08b9a5","#fee851","#ee573d","#f9df30","#1da2dc","#f05123","#ee2524"])(),B=(()=>({scope:F.isCli?"\x1B[{{color}}m":"color: {{color}};",reset:F.isCli?"\x1B[0m":"color: inherit;"}))(),J=(()=>F.isCli?"%s%s%s":"%c%s%c")(),O=0;function Z(){let H=R[O];return O=(O+1)%R.length,H}function $(H){if(H=H.trim(),!/^[[{<]/.test(H))H=`{${H}}`;return H}function G(H,P=Y){let W=Z(),E=B.scope.replace("{{color}}",W),A=$(H),Q={debugMode:P,banner:F.isCli?j.log.bind(j,`\x1B[1;37;45m {{{ %s }}} ${B.reset}`):j.log.bind(j,"%c%s","font-size: 2rem; background-color: #5858e8; color: #fff; padding: 1rem 4rem; border-radius: 0.5rem;"),accident:F.isCli?j.warn.bind(j,`${E}⚠️
3
+ %s\x1B[33m.%s() Accident \`%s\`!${B.reset}`,A):j.warn.bind(j,"%c%s%c.%s() Accident `%s`!",E,A,B.reset),error:F.isCli?j.error.bind(j,`${E}❌
4
+ %s\x1B[31m.%s() Error \`%s\`${B.reset}
5
+ `,A):j.error.bind(j,"%c%s%c.%s() Error `%s`\n",E,A,B.reset)};if(!P)return Q;return{...Q,logProperty:j.debug.bind(j,J+".%s = %o;",E,A,B.reset),logMethod:j.debug.bind(j,J+".%s();",E,A,B.reset),logFileModule:j.debug.bind(j,J+"/%s.js;",E,A,B.reset),logMethodArgs:j.debug.bind(j,J+".%s(%o);",E,A,B.reset),logMethodFull:j.debug.bind(j,J+".%s(%o) => %o",E,A,B.reset),logStep:j.debug.bind(j,J+".%s() -> %s",E,A,B.reset),logOther:j.debug.bind(j,J,E,A,B.reset),logTable:j.table.bind(j),incident:F.isCli?j.log.bind(j,`${E}\uD83D\uDEB8
6
+ %s${B.reset}.%s() Incident \`%s\`!${B.reset}`,A):j.log.bind(j,"%c%s%c.%s() Incident `%s`!",E,A,"color: orange;"),time:(K)=>j.time(A+"."+K),timeEnd:(K)=>j.timeEnd(A+"."+K)}}export{G as createLogger};
7
+
8
+ //# debugId=0A6F6C66F7A9296564756E2164756E21
9
+ //# sourceMappingURL=main.js.map
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/logger.ts"],
4
+ "sourcesContent": [
5
+ "import {getGlobalThis} from '@alwatr/global-this';\nimport {platformInfo} from '@alwatr/platform-info';\n\nimport type {AlwatrLogger} from './type.js';\n\nconst console_ = getGlobalThis().console;\n\n/**\n * Default debug mode state, determined by environment variables or localStorage.\n */\nconst defaultDebugMode = (() => {\n if (platformInfo.development) {\n if (platformInfo.isCli) {\n return process.env.ALWATR_DEBUG !== '0';\n }\n else {\n return typeof localStorage !== 'undefined' && localStorage.getItem('ALWATR_DEBUG') !== '0';\n }\n }\n // else\n return platformInfo.isCli\n ? Boolean(process.env.DEBUG)\n : typeof localStorage !== 'undefined' && localStorage.getItem('ALWATR_DEBUG') === '1';\n})();\n\n/**\n * A list of aesthetically pleasing colors for console logging, adapted for CLI and browser environments.\n */\nconst colorList = (() =>\n platformInfo.isCli\n ? ['0;36', '0;35', '0;34', '0;33', '0;32'] // CLI-safe colors\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\n/**\n * Platform-specific styling templates for logger output.\n */\nconst style_ = (() => ({\n scope: platformInfo.isCli ? '\\x1b[{{color}}m' : 'color: {{color}};',\n reset: platformInfo.isCli ? '\\x1b[0m' : 'color: inherit;',\n}))();\n\n/**\n * Platform-specific format for displaying the logger's scope.\n */\nconst keySection_ = (() => (platformInfo.isCli ? '%s%s%s' : '%c%s%c'))();\n\n// --- Utility Functions ---\n\nlet colorIndex_ = 0;\n/**\n * Cycles through the `colorList` to provide a new color for each logger instance.\n */\nfunction getNextColor_(): string {\n const color = colorList[colorIndex_];\n colorIndex_ = (colorIndex_ + 1) % colorList.length;\n return color;\n}\n\n/**\n * Sanitizes and formats the logger domain string by wrapping it in brackets if not already.\n */\nfunction sanitizeDomain_(domain: string): string {\n domain = domain.trim();\n if (!/^[[{<]/.test(domain)) {\n domain = `{${domain}}`;\n }\n return domain;\n}\n\n// --- Core Factory ---\n\n/**\n * Create a logger function for fancy console debug with custom scope.\n *\n * - `color` is optional and automatically selected from an internal list.\n * - `debug` is optional and automatically detected from `ALWATR_DEBUG` in localStorage or `process.env.DEBUG`.\n *\n * @example\n * ```ts\n * import {createLogger} from '@alwatr/logger';\n * const logger = createLogger('my-module');\n *\n * logger.logMethodArgs?.('myMethod', {a: 1}); // This line is ignored if debugMode is false.\n * ```\n */\nexport function createLogger(domain: string, debugMode = defaultDebugMode): AlwatrLogger {\n const color = getNextColor_();\n const styleScope = style_.scope.replace('{{color}}', color);\n const sanitizedDomain = sanitizeDomain_(domain);\n\n /**\n * Logger methods that are always available, regardless of debugMode.\n */\n const requiredItems: AlwatrLogger = {\n debugMode,\n\n banner: platformInfo.isCli\n ? console_.log.bind(console_, `\\x1b[1;37;45m {{{ %s }}} ${style_.reset}`)\n : console_.log.bind(\n console_,\n '%c%s',\n 'font-size: 2rem; background-color: #5858e8; color: #fff; padding: 1rem 4rem; border-radius: 0.5rem;',\n ),\n\n accident: platformInfo.isCli\n ? console_.warn.bind(console_, `${styleScope}⚠️\\n%s\\x1b[33m.%s() Accident \\`%s\\`!${style_.reset}`, sanitizedDomain)\n : console_.warn.bind(console_, '%c%s%c.%s() Accident `%s`!', styleScope, sanitizedDomain, style_.reset),\n\n error: platformInfo.isCli\n ? console_.error.bind(console_, `${styleScope}❌\\n%s\\x1b[31m.%s() Error \\`%s\\`${style_.reset}\\n`, sanitizedDomain)\n : console_.error.bind(console_, '%c%s%c.%s() Error `%s`\\n', styleScope, sanitizedDomain, style_.reset),\n };\n\n if (!debugMode) {\n return requiredItems;\n }\n\n /**\n * Logger methods available only when debugMode is true.\n * Using `console.debug` which is often filtered by default in browsers unless \"Verbose\" logs are enabled.\n */\n return {\n ...requiredItems,\n\n logProperty: console_.debug.bind(console_, keySection_ + '.%s = %o;', styleScope, sanitizedDomain, style_.reset),\n\n logMethod: console_.debug.bind(console_, keySection_ + '.%s();', styleScope, sanitizedDomain, style_.reset),\n\n logFileModule: console_.debug.bind(console_, keySection_ + '/%s.js;', styleScope, sanitizedDomain, style_.reset),\n\n logMethodArgs: console_.debug.bind(console_, keySection_ + '.%s(%o);', styleScope, sanitizedDomain, style_.reset),\n\n logMethodFull: console_.debug.bind(console_, keySection_ + '.%s(%o) => %o', styleScope, sanitizedDomain, style_.reset),\n\n logStep: console_.debug.bind(console_, keySection_ + '.%s() -> %s', styleScope, sanitizedDomain, style_.reset),\n\n logOther: console_.debug.bind(console_, keySection_, styleScope, sanitizedDomain, style_.reset),\n\n logTable: console_.table.bind(console_),\n\n incident: platformInfo.isCli\n ? console_.log.bind(console_, `${styleScope}🚸\\n%s${style_.reset}.%s() Incident \\`%s\\`!${style_.reset}`, sanitizedDomain)\n : console_.log.bind(console_, '%c%s%c.%s() Incident `%s`!', styleScope, sanitizedDomain, 'color: orange;'),\n\n time: (label: string) => console_.time(sanitizedDomain + '.' + label),\n timeEnd: (label: string) => console_.timeEnd(sanitizedDomain + '.' + label),\n } as const;\n}\n"
6
+ ],
7
+ "mappings": ";AAAA,wBAAQ,4BACR,uBAAQ,8BAIR,IAAM,EAAW,EAAc,EAAE,QAK3B,GAAoB,IAAM,CAC9B,GAAI,EAAa,YACf,GAAI,EAAa,MACf,OAAO,QAAQ,IAAI,eAAiB,IAGpC,YAAO,OAAO,aAAiB,KAAe,aAAa,QAAQ,cAAc,IAAM,IAI3F,OAAO,EAAa,MAChB,QAAQ,QAAQ,IAAI,KAAK,EACzB,OAAO,aAAiB,KAAe,aAAa,QAAQ,cAAc,IAAM,MACnF,EAKG,GAAa,IACjB,EAAa,MACT,CAAC,OAAQ,OAAQ,OAAQ,OAAQ,MAAM,EACvC,CACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,SACF,GAAG,EAKD,GAAU,KAAO,CACrB,MAAO,EAAa,MAAQ,kBAAoB,oBAChD,MAAO,EAAa,MAAQ,UAAY,iBAC1C,IAAI,EAKE,GAAe,IAAO,EAAa,MAAQ,SAAW,UAAW,EAInE,EAAc,EAIlB,SAAS,CAAa,EAAW,CAC/B,IAAM,EAAQ,EAAU,GAExB,OADA,GAAe,EAAc,GAAK,EAAU,OACrC,EAMT,SAAS,CAAe,CAAC,EAAwB,CAE/C,GADA,EAAS,EAAO,KAAK,EACjB,CAAC,SAAS,KAAK,CAAM,EACvB,EAAS,IAAI,KAEf,OAAO,EAmBF,SAAS,CAAY,CAAC,EAAgB,EAAY,EAAgC,CACvF,IAAM,EAAQ,EAAc,EACtB,EAAa,EAAO,MAAM,QAAQ,YAAa,CAAK,EACpD,EAAkB,EAAgB,CAAM,EAKxC,EAA8B,CAClC,YAEA,OAAQ,EAAa,MACjB,EAAS,IAAI,KAAK,EAAU,4BAA4B,EAAO,OAAO,EACtE,EAAS,IAAI,KACb,EACA,OACA,qGACF,EAEF,SAAU,EAAa,MACnB,EAAS,KAAK,KAAK,EAAU,GAAG;AAAA,kCAAgD,EAAO,QAAS,CAAe,EAC/G,EAAS,KAAK,KAAK,EAAU,6BAA8B,EAAY,EAAiB,EAAO,KAAK,EAExG,MAAO,EAAa,MAChB,EAAS,MAAM,KAAK,EAAU,GAAG;AAAA,8BAA2C,EAAO;AAAA,EAAW,CAAe,EAC7G,EAAS,MAAM,KAAK,EAAU,2BAA4B,EAAY,EAAiB,EAAO,KAAK,CACzG,EAEA,GAAI,CAAC,EACH,OAAO,EAOT,MAAO,IACF,EAEH,YAAa,EAAS,MAAM,KAAK,EAAU,EAAc,YAAa,EAAY,EAAiB,EAAO,KAAK,EAE/G,UAAW,EAAS,MAAM,KAAK,EAAU,EAAc,SAAU,EAAY,EAAiB,EAAO,KAAK,EAE1G,cAAe,EAAS,MAAM,KAAK,EAAU,EAAc,UAAW,EAAY,EAAiB,EAAO,KAAK,EAE/G,cAAe,EAAS,MAAM,KAAK,EAAU,EAAc,WAAY,EAAY,EAAiB,EAAO,KAAK,EAEhH,cAAe,EAAS,MAAM,KAAK,EAAU,EAAc,gBAAiB,EAAY,EAAiB,EAAO,KAAK,EAErH,QAAS,EAAS,MAAM,KAAK,EAAU,EAAc,cAAe,EAAY,EAAiB,EAAO,KAAK,EAE7G,SAAU,EAAS,MAAM,KAAK,EAAU,EAAa,EAAY,EAAiB,EAAO,KAAK,EAE9F,SAAU,EAAS,MAAM,KAAK,CAAQ,EAEtC,SAAU,EAAa,MACnB,EAAS,IAAI,KAAK,EAAU,GAAG;AAAA,IAAkB,EAAO,8BAA8B,EAAO,QAAS,CAAe,EACrH,EAAS,IAAI,KAAK,EAAU,6BAA8B,EAAY,EAAiB,gBAAgB,EAE3G,KAAM,CAAC,IAAkB,EAAS,KAAK,EAAkB,IAAM,CAAK,EACpE,QAAS,CAAC,IAAkB,EAAS,QAAQ,EAAkB,IAAM,CAAK,CAC5E",
8
+ "debugId": "0A6F6C66F7A9296564756E2164756E21",
9
+ "names": []
10
+ }
package/package.json CHANGED
@@ -1,29 +1,29 @@
1
1
  {
2
2
  "name": "@alwatr/logger",
3
3
  "description": "Fancy colorful console debugger with custom scope written in tiny TypeScript, ES module.",
4
- "version": "6.0.17",
4
+ "version": "7.0.0",
5
5
  "author": "S. Ali Mihandoost <ali.mihandoost@gmail.com>",
6
6
  "bugs": "https://github.com/Alwatr/nanolib/issues",
7
7
  "dependencies": {
8
- "@alwatr/global-this": "5.6.9",
9
- "@alwatr/platform-info": "5.5.28"
8
+ "@alwatr/global-this": "6.0.0",
9
+ "@alwatr/platform-info": "6.0.0"
10
10
  },
11
11
  "devDependencies": {
12
- "@alwatr/nano-build": "6.4.1",
13
- "@alwatr/prettier-config": "6.0.2",
14
- "@alwatr/tsconfig-base": "6.0.4",
15
- "@types/node": "^24.10.13",
12
+ "@alwatr/nano-build": "7.0.0",
13
+ "@alwatr/prettier-config": "7.0.0",
14
+ "@alwatr/tsconfig-base": "7.0.0",
15
+ "@types/node": "^24.12.0",
16
16
  "typescript": "^5.9.3"
17
17
  },
18
18
  "exports": {
19
19
  ".": {
20
20
  "types": "./dist/main.d.ts",
21
- "import": "./dist/main.mjs",
22
- "require": "./dist/main.cjs"
21
+ "default": "./dist/main.js"
23
22
  }
24
23
  },
25
24
  "files": [
26
- "**/*.{js,mjs,cjs,map,d.ts,html,md,LEGAL.txt}",
25
+ "**/*.{js,mjs,cjs,ts,map,d.ts,html,LEGAL.txt}",
26
+ "README.md",
27
27
  "LICENSE",
28
28
  "!demo/**/*",
29
29
  "!**/*.test.js"
@@ -49,8 +49,6 @@
49
49
  "utils"
50
50
  ],
51
51
  "license": "MPL-2.0",
52
- "main": "./dist/main.cjs",
53
- "module": "./dist/main.mjs",
54
52
  "prettier": "@alwatr/prettier-config",
55
53
  "publishConfig": {
56
54
  "access": "public"
@@ -61,21 +59,21 @@
61
59
  "directory": "packages/logger"
62
60
  },
63
61
  "scripts": {
64
- "b": "yarn run build",
65
- "build": "yarn run build:ts && yarn run build:es",
66
- "build:es": "nano-build --preset=module",
62
+ "b": "bun run build",
63
+ "build": "bun run build:ts && bun run build:es",
64
+ "build:es": "nano-build --preset=module src/main.ts",
67
65
  "build:ts": "tsc --build",
68
- "c": "yarn run clean",
69
- "cb": "yarn run clean && yarn run build",
66
+ "c": "bun run clean",
67
+ "cb": "bun run clean && bun run build",
70
68
  "clean": "rm -rfv dist *.tsbuildinfo",
71
- "d": "yarn run build:es && yarn node --enable-source-maps --trace-warnings",
72
- "w": "yarn run watch",
73
- "watch": "yarn run watch:ts & yarn run watch:es",
74
- "watch:es": "yarn run build:es --watch",
75
- "watch:ts": "yarn run build:ts --watch --preserveWatchOutput"
69
+ "d": "bun run build:es && bun",
70
+ "w": "bun run watch",
71
+ "watch": "bun run watch:ts & bun run watch:es",
72
+ "watch:es": "bun run build:es --watch",
73
+ "watch:ts": "bun run build:ts --watch --preserveWatchOutput"
76
74
  },
77
75
  "sideEffects": false,
78
76
  "type": "module",
79
77
  "types": "./dist/main.d.ts",
80
- "gitHead": "f9f9ba54b319ce8ccc6968059b222e89f4b5d149"
78
+ "gitHead": "056102a1c8a563bbae8a290b6830450f467322a3"
81
79
  }
package/src/logger.ts ADDED
@@ -0,0 +1,164 @@
1
+ import {getGlobalThis} from '@alwatr/global-this';
2
+ import {platformInfo} from '@alwatr/platform-info';
3
+
4
+ import type {AlwatrLogger} from './type.js';
5
+
6
+ const console_ = getGlobalThis().console;
7
+
8
+ /**
9
+ * Default debug mode state, determined by environment variables or localStorage.
10
+ */
11
+ const defaultDebugMode = (() => {
12
+ if (platformInfo.development) {
13
+ if (platformInfo.isCli) {
14
+ return process.env.ALWATR_DEBUG !== '0';
15
+ }
16
+ else {
17
+ return typeof localStorage !== 'undefined' && localStorage.getItem('ALWATR_DEBUG') !== '0';
18
+ }
19
+ }
20
+ // else
21
+ return platformInfo.isCli
22
+ ? Boolean(process.env.DEBUG)
23
+ : typeof localStorage !== 'undefined' && localStorage.getItem('ALWATR_DEBUG') === '1';
24
+ })();
25
+
26
+ /**
27
+ * A list of aesthetically pleasing colors for console logging, adapted for CLI and browser environments.
28
+ */
29
+ const colorList = (() =>
30
+ platformInfo.isCli
31
+ ? ['0;36', '0;35', '0;34', '0;33', '0;32'] // CLI-safe colors
32
+ : [
33
+ '#35b997',
34
+ '#f05561',
35
+ '#ee224a',
36
+ '#91c13e',
37
+ '#22af4b',
38
+ '#f0e995',
39
+ '#0fe995',
40
+ '#0f89ca',
41
+ '#08b9a5',
42
+ '#fee851',
43
+ '#ee573d',
44
+ '#f9df30',
45
+ '#1da2dc',
46
+ '#f05123',
47
+ '#ee2524',
48
+ ])();
49
+
50
+ /**
51
+ * Platform-specific styling templates for logger output.
52
+ */
53
+ const style_ = (() => ({
54
+ scope: platformInfo.isCli ? '\x1b[{{color}}m' : 'color: {{color}};',
55
+ reset: platformInfo.isCli ? '\x1b[0m' : 'color: inherit;',
56
+ }))();
57
+
58
+ /**
59
+ * Platform-specific format for displaying the logger's scope.
60
+ */
61
+ const keySection_ = (() => (platformInfo.isCli ? '%s%s%s' : '%c%s%c'))();
62
+
63
+ // --- Utility Functions ---
64
+
65
+ let colorIndex_ = 0;
66
+ /**
67
+ * Cycles through the `colorList` to provide a new color for each logger instance.
68
+ */
69
+ function getNextColor_(): string {
70
+ const color = colorList[colorIndex_];
71
+ colorIndex_ = (colorIndex_ + 1) % colorList.length;
72
+ return color;
73
+ }
74
+
75
+ /**
76
+ * Sanitizes and formats the logger domain string by wrapping it in brackets if not already.
77
+ */
78
+ function sanitizeDomain_(domain: string): string {
79
+ domain = domain.trim();
80
+ if (!/^[[{<]/.test(domain)) {
81
+ domain = `{${domain}}`;
82
+ }
83
+ return domain;
84
+ }
85
+
86
+ // --- Core Factory ---
87
+
88
+ /**
89
+ * Create a logger function for fancy console debug with custom scope.
90
+ *
91
+ * - `color` is optional and automatically selected from an internal list.
92
+ * - `debug` is optional and automatically detected from `ALWATR_DEBUG` in localStorage or `process.env.DEBUG`.
93
+ *
94
+ * @example
95
+ * ```ts
96
+ * import {createLogger} from '@alwatr/logger';
97
+ * const logger = createLogger('my-module');
98
+ *
99
+ * logger.logMethodArgs?.('myMethod', {a: 1}); // This line is ignored if debugMode is false.
100
+ * ```
101
+ */
102
+ export function createLogger(domain: string, debugMode = defaultDebugMode): AlwatrLogger {
103
+ const color = getNextColor_();
104
+ const styleScope = style_.scope.replace('{{color}}', color);
105
+ const sanitizedDomain = sanitizeDomain_(domain);
106
+
107
+ /**
108
+ * Logger methods that are always available, regardless of debugMode.
109
+ */
110
+ const requiredItems: AlwatrLogger = {
111
+ debugMode,
112
+
113
+ banner: platformInfo.isCli
114
+ ? console_.log.bind(console_, `\x1b[1;37;45m {{{ %s }}} ${style_.reset}`)
115
+ : console_.log.bind(
116
+ console_,
117
+ '%c%s',
118
+ 'font-size: 2rem; background-color: #5858e8; color: #fff; padding: 1rem 4rem; border-radius: 0.5rem;',
119
+ ),
120
+
121
+ accident: platformInfo.isCli
122
+ ? console_.warn.bind(console_, `${styleScope}⚠️\n%s\x1b[33m.%s() Accident \`%s\`!${style_.reset}`, sanitizedDomain)
123
+ : console_.warn.bind(console_, '%c%s%c.%s() Accident `%s`!', styleScope, sanitizedDomain, style_.reset),
124
+
125
+ error: platformInfo.isCli
126
+ ? console_.error.bind(console_, `${styleScope}❌\n%s\x1b[31m.%s() Error \`%s\`${style_.reset}\n`, sanitizedDomain)
127
+ : console_.error.bind(console_, '%c%s%c.%s() Error `%s`\n', styleScope, sanitizedDomain, style_.reset),
128
+ };
129
+
130
+ if (!debugMode) {
131
+ return requiredItems;
132
+ }
133
+
134
+ /**
135
+ * Logger methods available only when debugMode is true.
136
+ * Using `console.debug` which is often filtered by default in browsers unless "Verbose" logs are enabled.
137
+ */
138
+ return {
139
+ ...requiredItems,
140
+
141
+ logProperty: console_.debug.bind(console_, keySection_ + '.%s = %o;', styleScope, sanitizedDomain, style_.reset),
142
+
143
+ logMethod: console_.debug.bind(console_, keySection_ + '.%s();', styleScope, sanitizedDomain, style_.reset),
144
+
145
+ logFileModule: console_.debug.bind(console_, keySection_ + '/%s.js;', styleScope, sanitizedDomain, style_.reset),
146
+
147
+ logMethodArgs: console_.debug.bind(console_, keySection_ + '.%s(%o);', styleScope, sanitizedDomain, style_.reset),
148
+
149
+ logMethodFull: console_.debug.bind(console_, keySection_ + '.%s(%o) => %o', styleScope, sanitizedDomain, style_.reset),
150
+
151
+ logStep: console_.debug.bind(console_, keySection_ + '.%s() -> %s', styleScope, sanitizedDomain, style_.reset),
152
+
153
+ logOther: console_.debug.bind(console_, keySection_, styleScope, sanitizedDomain, style_.reset),
154
+
155
+ logTable: console_.table.bind(console_),
156
+
157
+ incident: platformInfo.isCli
158
+ ? console_.log.bind(console_, `${styleScope}🚸\n%s${style_.reset}.%s() Incident \`%s\`!${style_.reset}`, sanitizedDomain)
159
+ : console_.log.bind(console_, '%c%s%c.%s() Incident `%s`!', styleScope, sanitizedDomain, 'color: orange;'),
160
+
161
+ time: (label: string) => console_.time(sanitizedDomain + '.' + label),
162
+ timeEnd: (label: string) => console_.timeEnd(sanitizedDomain + '.' + label),
163
+ } as const;
164
+ }
package/src/main.ts ADDED
@@ -0,0 +1,2 @@
1
+ export * from './logger.js';
2
+ export * from './type.js';
package/src/type.ts ADDED
@@ -0,0 +1,226 @@
1
+ /**
2
+ * Represents the AlwatrLogger interface for logging various types of information at different levels of detail.
3
+ * This interface allows for structured logging of events, method calls, errors, and more,
4
+ * aiding in debugging and understanding application behavior.
5
+ *
6
+ * @example
7
+ * import {createLogger} from '@alwatr/logger';
8
+ * const logger = createLogger('my-module'); // Create a logger with a specific scope
9
+ *
10
+ * function greet(name: string) {
11
+ * logger.logMethodArgs?.('greet', {name}); // Log the method call with its arguments
12
+ * // ...
13
+ * }
14
+ *
15
+ * greet('Ali');
16
+ */
17
+ export interface AlwatrLogger {
18
+ /**
19
+ * Indicates whether debug mode is enabled for the current scope.
20
+ * This state is typically determined based on the `debug` pattern in localStorage.
21
+ */
22
+ debugMode: boolean;
23
+
24
+ /**
25
+ * Logs a property change with its new value using `console.debug`. Useful for tracking changes in application state.
26
+ *
27
+ * @param propertyName The name of the property that has changed.
28
+ * @param value The new value of the property.
29
+ *
30
+ * @example
31
+ * ```ts
32
+ * logger.logProperty?.('name', 'ali');
33
+ * ```
34
+ */
35
+ logProperty?(propertyName: string, value: unknown): void;
36
+
37
+ /**
38
+ * Logs the file name of the current module using `console.debug`.
39
+ * Helpful for identifying the source of log messages.
40
+ *
41
+ * @param fileName The name of the file representing the module.
42
+ *
43
+ * @example
44
+ * ```ts
45
+ * logger.logFileModule?.('app');
46
+ * ```
47
+ */
48
+ logFileModule?(fileName: string): void;
49
+
50
+ /**
51
+ * Logs the entry into a function or method using `console.debug`.
52
+ * Provides a basic trace of program execution.
53
+ *
54
+ * @param methodName The name of the function or method being called.
55
+ *
56
+ * @example
57
+ * ```ts
58
+ * function myMethod () {
59
+ * logger.logMethod?.('myMethod');
60
+ * }
61
+ * ```
62
+ */
63
+ logMethod?(methodName: string): void;
64
+
65
+ /**
66
+ * Logs the entry into a function or method along with its arguments using `console.debug`.
67
+ * Aids in understanding the context of method calls.
68
+ *
69
+ * @param methodName The name of the function or method being called.
70
+ * @param args An object containing the arguments passed to the method.
71
+ *
72
+ * @example
73
+ * ```ts
74
+ * function myMethod (a: number, b: number) {
75
+ * logger.logMethodArgs?.('myMethod', {a, b});
76
+ * }
77
+ * ```
78
+ */
79
+ logMethodArgs?(methodName: string, args: unknown): void;
80
+
81
+ /**
82
+ * Logs specific steps or milestones within a method using `console.debug`.
83
+ * Facilitates tracking progress within complex functions.
84
+ *
85
+ * @param methodName The name of the method where the step occurs.
86
+ * @param stepName The name or identifier of the specific step.
87
+ * @param props (Optional) Additional properties or data related to the step.
88
+ *
89
+ * @example
90
+ * ```ts
91
+ * function myMethod () {
92
+ * logger.logMethod?.('myMethod');
93
+ * ...
94
+ * logger.logStep?.('myMethod', 'step1');
95
+ * ...
96
+ * logger.logStep?.('myMethod', 'step2');
97
+ * ...
98
+ * }
99
+ * ```
100
+ */
101
+ logStep?(methodName: string, stepName: string, props?: unknown): void;
102
+
103
+ /**
104
+ * Logs a complete method call, including its arguments and result, using `console.debug`.
105
+ * Useful for debugging and understanding the output of functions.
106
+ *
107
+ * @param methodName The name of the function or method being called.
108
+ * @param args An object containing the arguments passed to the method.
109
+ * @param result The result returned by the method.
110
+ *
111
+ * @example
112
+ * ```ts
113
+ * function add (a: number, b: number): number {
114
+ * const result = a + b;
115
+ * logger.logMethodFull?.('add', {a, b}, result);
116
+ * return result;
117
+ * }
118
+ * ```
119
+ */
120
+ logMethodFull?(methodName: string, args: unknown, result: unknown): void;
121
+
122
+ /**
123
+ * Logs an event or expected incident using `console.log`. Intended for noteworthy information that doesn't represent an error or warning.
124
+ *
125
+ * @param methodName The name or context of the event or incident.
126
+ * @param warningCode A code or identifier for the specific type of event or incident.
127
+ * @param args Additional details or context related to the event or incident.
128
+ *
129
+ * @example
130
+ * ```ts
131
+ * logger.incident?.('fetch', 'abort_signal', {url: '/test.json'});
132
+ * ```
133
+ */
134
+ incident?(methodName: string, warningCode: string, ...args: unknown[]): void;
135
+
136
+ /**
137
+ * Logs an unexpected incident or handled error as a warning using `console.warn`.
138
+ * Indicates a potential issue that has been addressed but warrants attention.
139
+ *
140
+ * @param methodName The name or context of the incident or error.
141
+ * @param warningCode A code or identifier for the specific type of incident or error.
142
+ * @param args Additional details or context related to the incident or error.
143
+ *
144
+ * @example
145
+ * ```ts
146
+ * logger.accident('fetch', 'file_not_found', {url: '/test.json'});
147
+ * ```
148
+ */
149
+ accident(methodName: string, warningCode: string, ...args: unknown[]): void;
150
+
151
+ /**
152
+ * Logs an unexpected error using `console.error`. Highlights critical issues that need to be addressed.
153
+ *
154
+ * @param methodName The name or context where the error occurred.
155
+ * @param errorCode A code or identifier for the specific type of error.
156
+ * @param args Additional details or context related to the error, including the error object itself.
157
+ *
158
+ * @example
159
+ * ```ts
160
+ * try {
161
+ * ...
162
+ * }
163
+ * catch (err) {
164
+ * logger.error('myMethod', 'error_code', err, {a: 1, b: 2});
165
+ * }
166
+ * ```
167
+ */
168
+ error(methodName: string, errorCode: string, ...args: unknown[]): void;
169
+
170
+ /**
171
+ * Performs a simple `console.debug` log with styled scope for general debugging purposes.
172
+ *
173
+ * @param args Any number of arguments to be logged.
174
+ *
175
+ * @example
176
+ * ```ts
177
+ * logger.logOther?.('foo:', 'bar', {a: 1});
178
+ * ```
179
+ */
180
+ logOther?(...args: unknown[]): void;
181
+
182
+ /**
183
+ * Try to construct a table with the columns of the properties of `tabularData` (or use `properties`)
184
+ * and rows of `tabularData` and log it.
185
+ * Falls back to just logging the argument if it can't be parsed as tabular.
186
+ * @param tabularData Any data that can be represented in tabular form.
187
+ * @param properties Alternate properties for constructing the table.
188
+ */
189
+ logTable?(tabularData: unknown, properties?: readonly string[]): void;
190
+
191
+ /**
192
+ * Starts a timer with a specified label using `console.time`. Useful for measuring performance.
193
+ *
194
+ * @param label The label for the timer.
195
+ *
196
+ * @example
197
+ * ```ts
198
+ * logger.time?.('foo');
199
+ * ```
200
+ */
201
+ time?(label: string): void;
202
+
203
+ /**
204
+ * Ends a timer with a specified label and logs the elapsed time using `console.timeEnd`.
205
+ *
206
+ * @param label The label for the timer.
207
+ *
208
+ * @example
209
+ * ```ts
210
+ * logger.timeEnd?.('foo');
211
+ * ```
212
+ */
213
+ timeEnd?(label: string): void;
214
+
215
+ /**
216
+ * Logs a prominent banner message, typically used for displaying important announcements or version information.
217
+ *
218
+ * @param message The message to be displayed in the banner.
219
+ *
220
+ * @example
221
+ * ```ts
222
+ * logger.banner('Alwatr PWA v2');
223
+ * ```
224
+ */
225
+ banner(message: string): void;
226
+ }
package/CHANGELOG.md DELETED
@@ -1,526 +0,0 @@
1
- # Change Log
2
-
3
- All notable changes to this project will be documented in this file.
4
- See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
-
6
- ## [6.0.17](https://github.com/Alwatr/nanolib/compare/@alwatr/logger@6.0.16...@alwatr/logger@6.0.17) (2026-02-18)
7
-
8
- ### 🔗 Dependencies update
9
-
10
- * update @types/node to version 24.10.13 across multiple packages ([4c6d2a3](https://github.com/Alwatr/nanolib/commit/4c6d2a37ab26b1c86812b2aa38b2eca4ee097cb6))
11
-
12
- ## [6.0.16](https://github.com/Alwatr/nanolib/compare/@alwatr/logger@6.0.15...@alwatr/logger@6.0.16) (2025-12-23)
13
-
14
- ### 🔗 Dependencies update
15
-
16
- * upgrade @types/node to version 24.10.4 and update related dependencies ([acf04df](https://github.com/Alwatr/nanolib/commit/acf04df71647f5a401ef5e6bbfffcc478e4326d2))
17
-
18
- ## [6.0.15](https://github.com/Alwatr/nanolib/compare/@alwatr/logger@6.0.14...@alwatr/logger@6.0.15) (2025-12-13)
19
-
20
- ### 🔗 Dependencies update
21
-
22
- * update `@types/node` and `[@lerna-lite](https://github.com/lerna-lite)` dependencies. ([8daa8fd](https://github.com/Alwatr/nanolib/commit/8daa8fd023d5414c9f95feb4319353c6ea34be31))
23
-
24
- ## [6.0.14](https://github.com/Alwatr/nanolib/compare/@alwatr/logger@6.0.13...@alwatr/logger@6.0.14) (2025-12-10)
25
-
26
- ### 🔗 Dependencies update
27
-
28
- * Upgrade lerna-lite, prettier, types/node, and yarn dependencies. ([42a7fca](https://github.com/Alwatr/nanolib/commit/42a7fca15430aca2ac1eaa19496c2a2ebfc8c470))
29
-
30
- ## [6.0.13](https://github.com/Alwatr/nanolib/compare/@alwatr/logger@6.0.12...@alwatr/logger@6.0.13) (2025-11-18)
31
-
32
- ### 🔨 Code Refactoring
33
-
34
- * remove unnecessary type declarations from tsconfig.json files ([89bcc7d](https://github.com/Alwatr/nanolib/commit/89bcc7db839807110b80f8ba34414ea9734d9c75))
35
-
36
- ## [6.0.12](https://github.com/Alwatr/nanolib/compare/@alwatr/logger@6.0.11...@alwatr/logger@6.0.12) (2025-11-15)
37
-
38
- ### 🔗 Dependencies update
39
-
40
- * bump the npm-dependencies group with 2 updates ([a80b84d](https://github.com/Alwatr/nanolib/commit/a80b84dada6c09b5e5621e7487c8ec13fff3c23a))
41
-
42
- ## [6.0.11](https://github.com/Alwatr/nanolib/compare/@alwatr/logger@6.0.10...@alwatr/logger@6.0.11) (2025-11-15)
43
-
44
- **Note:** Version bump only for package @alwatr/logger
45
-
46
- ## [6.0.10](https://github.com/Alwatr/nanolib/compare/@alwatr/logger@6.0.9...@alwatr/logger@6.0.10) (2025-11-04)
47
-
48
- ### 🔗 Dependencies update
49
-
50
- * bump the npm-dependencies group across 1 directory with 9 updates ([fdf29d5](https://github.com/Alwatr/nanolib/commit/fdf29d5aa89983cb06f79d42650a364521f5c4b9))
51
- * update @types/node from ^22.18.12 to ^24.10.0 across multiple packages ([1169a86](https://github.com/Alwatr/nanolib/commit/1169a86001da2abfbe99a7da33c8e92183f553f6))
52
-
53
- ## [6.0.9](https://github.com/Alwatr/nanolib/compare/@alwatr/logger@6.0.8...@alwatr/logger@6.0.9) (2025-10-06)
54
-
55
- ### 🔗 Dependencies update
56
-
57
- * bump the npm-dependencies group with 4 updates ([9825815](https://github.com/Alwatr/nanolib/commit/982581552bbb4b97dca52af5e93a80937f0c3109))
58
-
59
- ## [6.0.8](https://github.com/Alwatr/nanolib/compare/@alwatr/logger@6.0.7...@alwatr/logger@6.0.8) (2025-09-27)
60
-
61
- ### 🧹 Miscellaneous Chores
62
-
63
- * exclude test files from package distribution ([86f4f2f](https://github.com/Alwatr/nanolib/commit/86f4f2f5985845c5cf3a3a9398de7b2f98ce53e7))
64
-
65
- ## [6.0.7](https://github.com/Alwatr/nanolib/compare/@alwatr/logger@6.0.6...@alwatr/logger@6.0.7) (2025-09-22)
66
-
67
- **Note:** Version bump only for package @alwatr/logger
68
-
69
- ## [6.0.6](https://github.com/Alwatr/nanolib/compare/@alwatr/logger@6.0.5...@alwatr/logger@6.0.6) (2025-09-22)
70
-
71
- **Note:** Version bump only for package @alwatr/logger
72
-
73
- ## [6.0.5](https://github.com/Alwatr/nanolib/compare/@alwatr/logger@6.0.4...@alwatr/logger@6.0.5) (2025-09-21)
74
-
75
- **Note:** Version bump only for package @alwatr/logger
76
-
77
- ## [6.0.4](https://github.com/Alwatr/nanolib/compare/@alwatr/logger@6.0.3...@alwatr/logger@6.0.4) (2025-09-20)
78
-
79
- ### 🐛 Bug Fixes
80
-
81
- * add sideEffects property to package.json files for better tree-shaking ([c7b9e74](https://github.com/Alwatr/nanolib/commit/c7b9e74e1920c8e35b438742de61883ca62da58c))
82
- * add sideEffects property to package.json files for better tree-shaking ([e8402c4](https://github.com/Alwatr/nanolib/commit/e8402c481a14a1f807a37aaa862a936713d26176))
83
- * remove unnecessary pure annotations ([adeb916](https://github.com/Alwatr/nanolib/commit/adeb9166f8e911f59269032b76c36cb1888332cf))
84
- * update console_ declaration and change createLogger to a function declaration ([2252855](https://github.com/Alwatr/nanolib/commit/22528553e1bb4393ad7fc5583ef7391cd8b0f045))
85
-
86
- ### 🧹 Miscellaneous Chores
87
-
88
- * remove duplicate sideEffects property from multiple package.json files ([b123f86](https://github.com/Alwatr/nanolib/commit/b123f86be81481de2314aae9bb2eeb629743d24c))
89
-
90
- ## [6.0.3](https://github.com/Alwatr/nanolib/compare/@alwatr/logger@6.0.2...@alwatr/logger@6.0.3) (2025-09-19)
91
-
92
- **Note:** Version bump only for package @alwatr/logger
93
-
94
- ## [6.0.2](https://github.com/Alwatr/nanolib/compare/@alwatr/logger@6.0.1...@alwatr/logger@6.0.2) (2025-09-19)
95
-
96
- ### 🐛 Bug Fixes
97
-
98
- * improve default debug mode logic for CLI and browser environments ([2b339bc](https://github.com/Alwatr/nanolib/commit/2b339bc80dc8ce82e49ec8d83f690230f543c930))
99
-
100
- ## [6.0.1](https://github.com/Alwatr/nanolib/compare/@alwatr/logger@6.0.0...@alwatr/logger@6.0.1) (2025-09-15)
101
-
102
- **Note:** Version bump only for package @alwatr/logger
103
-
104
- ## [6.0.0](https://github.com/Alwatr/nanolib/compare/@alwatr/logger@5.6.2...@alwatr/logger@6.0.0) (2025-09-14)
105
-
106
- ### ⚠ BREAKING CHANGES
107
-
108
- * Internal logger config keys renamed and Color API now returns normalized values; callers must update config and run tests.
109
-
110
- با توکل بر خدا آپدیت کنید طوری نمیشه ان‌شاالله
111
-
112
- ### ✨ Features
113
-
114
- * add logTable method to AlwatrLogger interface and implement in createLogger ([33682dd](https://github.com/Alwatr/nanolib/commit/33682dde84814b121234e58a97de300d4f8b09ee))
115
-
116
- ### 🐛 Bug Fixes
117
-
118
- * access self in logger ([4898e2a](https://github.com/Alwatr/nanolib/commit/4898e2ab42482662444fede6459284004fe2ec9e))
119
- * change logTable parameter type from any to unknown for better type safety ([8f7d632](https://github.com/Alwatr/nanolib/commit/8f7d632139d0387af224b7779b3f8e3d7c061791))
120
- * correct regex in sanitizeDomain function to properly validate domain format ([831c56d](https://github.com/Alwatr/nanolib/commit/831c56d2cb77a6d8b053121cd4a034bb060b82e1))
121
- * replace globalThis initialization with getGlobalThis for improved consistency ([dff4090](https://github.com/Alwatr/nanolib/commit/dff40901f060815ff0f8800487a7bb091c2367ff))
122
- * update default debug mode logic to include NODE_ENV check for CLI environments ([c334071](https://github.com/Alwatr/nanolib/commit/c33407167a4be02b450249d985f43daac46b52f0))
123
-
124
- ### 🔨 Code Refactoring
125
-
126
- * enhance logger configuration and improve color handling ([7ab540d](https://github.com/Alwatr/nanolib/commit/7ab540dc5ac81561810ab1e6922b80be617f8dd6))
127
-
128
- ### 🧹 Miscellaneous Chores
129
-
130
- * remove unnecessary types from tsconfig.json for cleaner configuration ([986afde](https://github.com/Alwatr/nanolib/commit/986afde2dc976cf69f550f715d74fc5eb7a96086))
131
-
132
- ## [5.6.2](https://github.com/Alwatr/nanolib/compare/@alwatr/logger@5.6.1...@alwatr/logger@5.6.2) (2025-09-13)
133
-
134
- ### 🔗 Dependencies update
135
-
136
- * update @types/node version to ^22.18.3 in multiple package.json files ([13db6fc](https://github.com/Alwatr/nanolib/commit/13db6fc176bc6cdcefedc50d77ac550bd5052c9a))
137
-
138
- ## [5.6.1](https://github.com/Alwatr/nanolib/compare/@alwatr/logger@5.6.0...@alwatr/logger@5.6.1) (2025-09-13)
139
-
140
- ### 🧹 Miscellaneous Chores
141
-
142
- * remove package-tracer dependency and related code from fetch package ([96fe4e9](https://github.com/Alwatr/nanolib/commit/96fe4e9552a205f218ceed187c55e4e904a07089))
143
- * remove package-tracer dependency and related code from logger ([7dcc7e2](https://github.com/Alwatr/nanolib/commit/7dcc7e27d6d4aeb1b3efe262b10e12cb80363fd1))
144
-
145
- ## [5.6.0](https://github.com/Alwatr/nanolib/compare/@alwatr/logger@5.5.10...@alwatr/logger@5.6.0) (2025-09-13)
146
-
147
- ### ✨ Features
148
-
149
- * **logger:** change domain sanitization to use curly braces instead of square brackets ([b1898c5](https://github.com/Alwatr/nanolib/commit/b1898c5f0805901af7a137bb064e3e23e61f0591))
150
-
151
- ## [5.5.10](https://github.com/Alwatr/nanolib/compare/@alwatr/logger@5.5.9...@alwatr/logger@5.5.10) (2025-09-09)
152
-
153
- ### 🧹 Miscellaneous Chores
154
-
155
- * remove trailing newlines from contributing sections in README files ([e8ab1bc](https://github.com/Alwatr/nanolib/commit/e8ab1bc43e0addea5ccd4c897c2cec597cb9e15f))
156
-
157
- ## [5.5.9](https://github.com/Alwatr/nanolib/compare/@alwatr/logger@5.5.8...@alwatr/logger@5.5.9) (2025-09-06)
158
-
159
- **Note:** Version bump only for package @alwatr/logger
160
-
161
- ## [5.5.8](https://github.com/Alwatr/nanolib/compare/@alwatr/logger@5.5.7...@alwatr/logger@5.5.8) (2025-09-05)
162
-
163
- ### 🔗 Dependencies update
164
-
165
- * update jest to version 30.1.3 and @types/node to version 22.18.1 ([754212b](https://github.com/Alwatr/nanolib/commit/754212b1523cfc4cfe26c9e9f6d634aa8311e0b7))
166
-
167
- ## [5.5.7](https://github.com/Alwatr/nanolib/compare/@alwatr/logger@5.5.6...@alwatr/logger@5.5.7) (2025-09-01)
168
-
169
- ### 🔗 Dependencies update
170
-
171
- * update lerna-lite dependencies to version 4.7.3 and jest to 30.1.2 ([95d7870](https://github.com/Alwatr/nanolib/commit/95d7870ec7ad1e6ed2688bafddcabf46857f6981))
172
-
173
- ## [5.5.6](https://github.com/Alwatr/nanolib/compare/@alwatr/logger@5.5.5...@alwatr/logger@5.5.6) (2025-08-23)
174
-
175
- **Note:** Version bump only for package @alwatr/logger
176
-
177
- ## [5.5.5](https://github.com/Alwatr/nanolib/compare/@alwatr/logger@5.5.3...@alwatr/logger@5.5.5) (2025-08-23)
178
-
179
- ### 🐛 Bug Fixes
180
-
181
- * update license from AGPL-3.0-only to MPL-2.0 ([d20968e](https://github.com/Alwatr/nanolib/commit/d20968e60cc89b1dcdf9b96507178da6ed562f55))
182
- * update package versions in multiple package.json files ([7638b1c](https://github.com/Alwatr/nanolib/commit/7638b1cafee2b4e0f97db7a89ac9fba6384b9b10))
183
-
184
- ### 🔨 Code Refactoring
185
-
186
- * Updated all package.json files in the project to change dependency version specifiers from "workspace:^" to "workspace:*" for consistency and to allow for more flexible version resolution. ([db6a4f7](https://github.com/Alwatr/nanolib/commit/db6a4f76deec2d1d8039978144e4bc51b6f1a0e3))
187
-
188
- ### 🧹 Miscellaneous Chores
189
-
190
- * reformat all package.json files ([ceda45d](https://github.com/Alwatr/nanolib/commit/ceda45de186667790474f729cb4b161a5148ce19))
191
-
192
- ### 🔗 Dependencies update
193
-
194
- * revert @types/node version to ^22.17.2 (LTS) ([49f8101](https://github.com/Alwatr/nanolib/commit/49f8101eac5c41aa7684112f4308254dbfab9787))
195
- * update TypeScript and Jest versions across all packages to improve compatibility and performance ([31baf36](https://github.com/Alwatr/nanolib/commit/31baf366101e92e27db66a21c849fb101f19be47))
196
-
197
- ## [5.5.4](https://github.com/Alwatr/nanolib/compare/@alwatr/logger@5.5.3...@alwatr/logger@5.5.4) (2025-08-23)
198
-
199
- ### Code Refactoring
200
-
201
- * Updated all package.json files in the project to change dependency version specifiers from "workspace:^" to "workspace:*" for consistency and to allow for more flexible version resolution. ([db6a4f7](https://github.com/Alwatr/nanolib/commit/db6a4f76deec2d1d8039978144e4bc51b6f1a0e3)) by @alimd
202
-
203
- ## <small>5.5.3 (2025-04-15)</small>
204
-
205
- **Note:** Version bump only for package @alwatr/logger
206
-
207
- ## [5.5.2](https://github.com/Alwatr/nanolib/compare/@alwatr/logger@5.5.1...@alwatr/logger@5.5.2) (2025-04-01)
208
-
209
- ### Dependencies update
210
-
211
- * bump the development-dependencies group across 1 directory with 2 updates ([c1320b4](https://github.com/Alwatr/nanolib/commit/c1320b447a492c5e720e25ad71e9df81eeea3670)) by @dependabot[bot]
212
-
213
- ## [5.5.1](https://github.com/Alwatr/nanolib/compare/@alwatr/logger@5.5.0...@alwatr/logger@5.5.1) (2025-03-18)
214
-
215
- ### Dependencies update
216
-
217
- * bump the development-dependencies group with 9 updates ([7290aa3](https://github.com/Alwatr/nanolib/commit/7290aa3b52ce66ca237d2a12d28a7687b113f83d)) by @dependabot[bot]
218
-
219
- ## [5.5.0](https://github.com/Alwatr/nanolib/compare/@alwatr/logger@5.4.0...@alwatr/logger@5.5.0) (2025-03-06)
220
-
221
- ### Miscellaneous Chores
222
-
223
- * update username casing in changelog entries ([9722ac9](https://github.com/Alwatr/nanolib/commit/9722ac9a078438a4e8ebfa5826ea70e0e3a52ca6)) by @
224
-
225
- ### Dependencies update
226
-
227
- * bump the development-dependencies group across 1 directory with 11 updates ([720c395](https://github.com/Alwatr/nanolib/commit/720c3954da55c929fe8fb16957121f4c51fb7f0c)) by @dependabot[bot]
228
-
229
- ## [5.4.0](https://github.com/Alwatr/nanolib/compare/@alwatr/logger@4.0.8...@alwatr/logger@5.4.0) (2025-02-18)
230
-
231
- ### Dependencies update
232
-
233
- * bump @types/node from ^22.13.0 to ^22.13.4 and prettier from 3.4.2 to 3.5.1; update eslint-import-resolver-typescript to 3.8.2 ([b9a8399](https://github.com/Alwatr/nanolib/commit/b9a8399add39509e90bfdc589fb5e2321718029d)) by @
234
-
235
- ## 5.3.0 (2025-02-03)
236
-
237
- ### Miscellaneous Chores
238
-
239
- * edit README ([3860b3d](https://github.com/Alwatr/nanolib/commit/3860b3df48ab82dc479d5236c2e8579df614aabf)) by @
240
-
241
- ### Dependencies update
242
-
243
- * bump the development-dependencies group across 1 directory with 11 updates ([cb79d07](https://github.com/Alwatr/nanolib/commit/cb79d072a57c79e1c01abff1a293d6757bb65350)) by @
244
- * update typescript and @types/node to version 5.7.3 and 22.13.0 respectively across multiple packages ([ddab05b](https://github.com/Alwatr/nanolib/commit/ddab05b5d767c30191f36a065e4bc88744e8e3fe)) by @
245
-
246
- ## 5.0.0 (2024-11-02)
247
-
248
- ### ⚠ BREAKING CHANGES
249
-
250
- * To simplify version management and ensure consistency, all nanolib packages now use the same version as @alwatr/nanolib. This may require updates to your project's dependencies.
251
-
252
- ### Code Refactoring
253
-
254
- * use the same version as @alwatr/nanolib ([60eb860](https://github.com/Alwatr/nanolib/commit/60eb860a0e33dfffe2d1d95e63ce54c60876be06)) by @
255
-
256
- ## [5.3.0](https://github.com/Alwatr/nanolib/compare/v5.2.1...v5.3.0) (2025-02-03)
257
-
258
- ### Miscellaneous Chores
259
-
260
- * edit README ([3860b3d](https://github.com/Alwatr/nanolib/commit/3860b3df48ab82dc479d5236c2e8579df614aabf)) by @ArmanAsadian
261
-
262
- ### Dependencies update
263
-
264
- * bump the development-dependencies group across 1 directory with 11 updates ([cb79d07](https://github.com/Alwatr/nanolib/commit/cb79d072a57c79e1c01abff1a293d6757bb65350)) by @dependabot[bot]
265
- * update typescript and @types/node to version 5.7.3 and 22.13.0 respectively across multiple packages ([ddab05b](https://github.com/Alwatr/nanolib/commit/ddab05b5d767c30191f36a065e4bc88744e8e3fe)) by @alimd
266
-
267
- ## 5.0.0 (2024-11-02)
268
-
269
- ### ⚠ BREAKING CHANGES
270
-
271
- * To simplify version management and ensure consistency, all nanolib packages now use the same version as @alwatr/nanolib. This may require updates to your project's dependencies.
272
- * **logger:** logModule renamed to logFileModule
273
- * **logger:** definePackage and dedupt remove!
274
- * **logger:** define packages removed and must use @alwatr/dedupe instead
275
- * **logger:** use DEBUG in cli and debug in browser
276
-
277
- ### Features
278
-
279
- * **logger:** add logStep method to logger ([860aeed](https://github.com/Alwatr/nanolib/commit/860aeedb2da390ee3d47c037b22a37f73e6dbbbc)) by @
280
- * **logger:** change devMode env name ([ad549dc](https://github.com/Alwatr/nanolib/commit/ad549dc39e52242261c78939bd62ca10f69cea60)) by @
281
- * **logger:** debugMode in definePackage ([9799320](https://github.com/Alwatr/nanolib/commit/97993203d76db57e55b31bef485ea77cfd32a64c)) by @
282
- * **logger:** definePackage ([dfd090e](https://github.com/Alwatr/nanolib/commit/dfd090ebd691c9a589370094d49f950524f71369)) by @
283
- * **logger:** Update debugMode to enabled by default in development mode ([bc7c7ee](https://github.com/Alwatr/nanolib/commit/bc7c7ee1118a259ceaa1be1dade90f2f9ccf9e1d)) by @
284
- * **logger:** use alwatr dedupe ([d89d076](https://github.com/Alwatr/nanolib/commit/d89d076c9fd0dd311804831b1ac0ea955efd4b6d)) by @
285
- * use `package-tracer` ([cc3c5f9](https://github.com/Alwatr/nanolib/commit/cc3c5f9c1a3d03f0d81b46835665f16a0426fd0d)) by @
286
-
287
- ### Bug Fixes
288
-
289
- * __package_version__ global type ([de8a3f9](https://github.com/Alwatr/nanolib/commit/de8a3f93bdb5a786c42f56324072b4b9520ce3a1)) by @
290
- * all dependeny topology ([1c17f34](https://github.com/Alwatr/nanolib/commit/1c17f349adf3e98e2a80ab2da4f0f81028dc9c5f)) by @
291
- * exported types by add .js extensions to all imports ([fc3d83e](https://github.com/Alwatr/nanolib/commit/fc3d83e8f375da97ba276314b2e6966aa82c9b3f)) by @
292
- * **logger:** defaultDebugMode ([bab9f7c](https://github.com/Alwatr/nanolib/commit/bab9f7c7b26fc2f50476ebc74d484a4b39c9dbda)) by @
293
- * **logger:** definePackage ([e2e5c6c](https://github.com/Alwatr/nanolib/commit/e2e5c6c8175d6f7bfba1d103c1cac2f647aa6116)) by @
294
- * **logger:** Update default debug mode logic for prevent side-effects ([42101d6](https://github.com/Alwatr/nanolib/commit/42101d6471bd0d4e88e47dc8321dddc1cd63cec8)) by @
295
-
296
- ### Code Refactoring
297
-
298
- * **logger:** prevent side-effects ([e084894](https://github.com/Alwatr/nanolib/commit/e084894cdc4b46d52d99be872f5f789fe83c3cc0)) by @
299
- * **logger:** remove definePackage from logger ([c8a9d0c](https://github.com/Alwatr/nanolib/commit/c8a9d0cdcc3e45e7a33731ec6ee6a496451e9eb1)) by @
300
- * **logger:** rename logModule to logFileModule ([1f6bd71](https://github.com/Alwatr/nanolib/commit/1f6bd71272007f5bbc90258ffa13b7d851e0918c)) by @
301
- * prevent side-effects ([01e00e1](https://github.com/Alwatr/nanolib/commit/01e00e191385cc92b28677df0c01a085916ae677)) by @
302
- * use the same version as @alwatr/nanolib ([60eb860](https://github.com/Alwatr/nanolib/commit/60eb860a0e33dfffe2d1d95e63ce54c60876be06)) by @
303
-
304
- ### Miscellaneous Chores
305
-
306
- * **dedupe:** fix version ([9754409](https://github.com/Alwatr/nanolib/commit/9754409d978265ba2ce08a9f86af1d1e143940e4)) by @
307
- * **deps-dev:** bump the development-dependencies group with 3 updates ([0e0ec0f](https://github.com/Alwatr/nanolib/commit/0e0ec0f7c66c849727563cabe0e88606aee49035)) by @
308
- * **deps:** update ([1a45030](https://github.com/Alwatr/nanolib/commit/1a450305440b710a300787d4ca24b1ed8c6a39d7)) by @
309
- * **deps:** update ([8e70dff](https://github.com/Alwatr/nanolib/commit/8e70dffb1e751496ef2e72d6cffd685f1fea44e3)) by @
310
- * **deps:** update ([f0b60d2](https://github.com/Alwatr/nanolib/commit/f0b60d24c9fae6190940baf95167a1175360d4b3)) by @
311
- * fix all typescript reference ([dea4c44](https://github.com/Alwatr/nanolib/commit/dea4c4414167602ea2f13888c6ecee24eb65ed93)) by @
312
- * include LICENSE and LEGAL files to publish ([09f366f](https://github.com/Alwatr/nanolib/commit/09f366f680bfa9fb26acb2cd1ccbc68c5a9e9ad8)) by @
313
- * **logger:** add reference ([2f30ef1](https://github.com/Alwatr/nanolib/commit/2f30ef15240a3629c7697409c322c7fdfc91a5f8)) by @
314
- * **logger:** change the license to AGPL-3.0 ([4bb4673](https://github.com/Alwatr/nanolib/commit/4bb4673972069a307e799cad9a5078b0288a9340)) by @
315
- * **logger:** Fix import file extensions ([faeef41](https://github.com/Alwatr/nanolib/commit/faeef41b0115fc5b9b22ba297e936bad68a71343)) by @
316
- * **logger:** Fix import file extensions ([f620739](https://github.com/Alwatr/nanolib/commit/f6207396504fe3a2a708ad0feaf988d14f99d130)) by @
317
- * **logger:** rename main file ([618d008](https://github.com/Alwatr/nanolib/commit/618d008c23561105ba45acb31dedcf2daafe4202)) by @
318
- * **logger:** update dedupe version ([9704dc9](https://github.com/Alwatr/nanolib/commit/9704dc92a4614aaa9ba25d88bcc1beee2bc826f4)) by @
319
- * Update build and lint scripts ([392d0b7](https://github.com/Alwatr/nanolib/commit/392d0b71f446bce336b0256119a80f07aff794ba)) by @
320
- * Update debug command in package.json ([be8403d](https://github.com/Alwatr/nanolib/commit/be8403dec754f2117259bb915b110ea386596401)) by @
321
- * Update package.json exports for [@alwatr](https://github.com/alwatr) packages ([dacb362](https://github.com/Alwatr/nanolib/commit/dacb362b145e3c51b4aba00ff643687a3fac11d2)) by @
322
-
323
- ### Dependencies update
324
-
325
- * bump @types/node ([3d80fed](https://github.com/Alwatr/nanolib/commit/3d80fedaf720af792feb060c2f81c737ebb84e11)) by @
326
- * bump the development-dependencies group across 1 directory with 10 updates ([9ed98ff](https://github.com/Alwatr/nanolib/commit/9ed98ffd0668d5a36e255c82edab3af53bffda8f)) by @
327
- * bump the development-dependencies group across 1 directory with 2 updates ([2dfda9e](https://github.com/Alwatr/nanolib/commit/2dfda9ec38a595f1fd961490d1a2fbf060f20a66)) by @
328
- * bump the development-dependencies group with 10 updates ([fa4aaf0](https://github.com/Alwatr/nanolib/commit/fa4aaf04c907ecae06aa14000ce35216170c15ad)) by @
329
- * bump the development-dependencies group with 2 updates ([be5d6c2](https://github.com/Alwatr/nanolib/commit/be5d6c2d86b937f32cebc6848aaff85af07055dd)) by @
330
- * bump the development-dependencies group with 8 updates ([16847ac](https://github.com/Alwatr/nanolib/commit/16847acba91da027c422e3910d0f2dcc1f084e93)) by @
331
- * upd ([451d025](https://github.com/Alwatr/nanolib/commit/451d0255ba96ed55f897a6f44f62cf4e6d2b12be)) by @
332
- * update ([4434ba6](https://github.com/Alwatr/nanolib/commit/4434ba67c3f576bb1a0c307fbdb263c43cd9733a)) by @
333
- * update ([c36ed50](https://github.com/Alwatr/nanolib/commit/c36ed50f68da2f5608ccd96119963a16cfacb4ce)) by @
334
- * update all ([53342f6](https://github.com/Alwatr/nanolib/commit/53342f67a8a013127f073540bc11929f1813c05c)) by @
335
- * update all dependencies ([1e0c30e](https://github.com/Alwatr/nanolib/commit/1e0c30e6a3a8e19deb5185814e24ab6c08dca573)) by @
336
- * update all dependencies ([0e908b4](https://github.com/Alwatr/nanolib/commit/0e908b476a6b976ec2447f864c8cafcbb8a0f099)) by @
337
- * upgrade ([6dbd300](https://github.com/Alwatr/nanolib/commit/6dbd300642c9bcc9e7d0b281e244bf1b06eb1c38)) by @
338
-
339
- ## [4.0.8](https://github.com/Alwatr/nanolib/compare/@alwatr/logger@4.0.7...@alwatr/logger@4.0.8) (2024-11-02)
340
-
341
- ### Dependencies update
342
-
343
- * update ([4434ba6](https://github.com/Alwatr/nanolib/commit/4434ba67c3f576bb1a0c307fbdb263c43cd9733a)) by @alimd
344
-
345
- ## [4.0.7](https://github.com/Alwatr/nanolib/compare/@alwatr/logger@4.0.6...@alwatr/logger@4.0.7) (2024-10-25)
346
-
347
- ### Dependencies update
348
-
349
- * bump the development-dependencies group across 1 directory with 2 updates ([2dfda9e](https://github.com/Alwatr/nanolib/commit/2dfda9ec38a595f1fd961490d1a2fbf060f20a66)) by @dependabot[bot]
350
- * bump the development-dependencies group with 8 updates ([16847ac](https://github.com/Alwatr/nanolib/commit/16847acba91da027c422e3910d0f2dcc1f084e93)) by @dependabot[bot]
351
-
352
- ## [4.0.6](https://github.com/Alwatr/nanolib/compare/@alwatr/logger@4.0.5...@alwatr/logger@4.0.6) (2024-10-12)
353
-
354
- **Note:** Version bump only for package @alwatr/logger
355
-
356
- ## [4.0.5](https://github.com/Alwatr/nanolib/compare/@alwatr/logger@4.0.4...@alwatr/logger@4.0.5) (2024-10-11)
357
-
358
- ### Bug Fixes
359
-
360
- - **logger:** Update default debug mode logic for prevent side-effects ([42101d6](https://github.com/Alwatr/nanolib/commit/42101d6471bd0d4e88e47dc8321dddc1cd63cec8)) by @alimd
361
-
362
- ### Code Refactoring
363
-
364
- - **logger:** prevent side-effects ([e084894](https://github.com/Alwatr/nanolib/commit/e084894cdc4b46d52d99be872f5f789fe83c3cc0)) by @mohammadhonarvar
365
- - prevent side-effects ([01e00e1](https://github.com/Alwatr/nanolib/commit/01e00e191385cc92b28677df0c01a085916ae677)) by @mohammadhonarvar
366
-
367
- ## [4.0.4](https://github.com/Alwatr/nanolib/compare/@alwatr/logger@4.0.3...@alwatr/logger@4.0.4) (2024-10-11)
368
-
369
- ### Miscellaneous Chores
370
-
371
- - include LICENSE and LEGAL files to publish ([09f366f](https://github.com/Alwatr/nanolib/commit/09f366f680bfa9fb26acb2cd1ccbc68c5a9e9ad8)) by @alimd
372
-
373
- ## [4.0.3](https://github.com/Alwatr/nanolib/compare/@alwatr/logger@4.0.2...@alwatr/logger@4.0.3) (2024-10-11)
374
-
375
- **Note:** Version bump only for package @alwatr/logger
376
-
377
- ## [4.0.2](https://github.com/Alwatr/nanolib/compare/@alwatr/logger@4.0.1...@alwatr/logger@4.0.2) (2024-10-10)
378
-
379
- ### Dependencies update
380
-
381
- - bump the development-dependencies group with 10 updates ([fa4aaf0](https://github.com/Alwatr/nanolib/commit/fa4aaf04c907ecae06aa14000ce35216170c15ad)) by @dependabot[bot]
382
-
383
- ## [4.0.1](https://github.com/Alwatr/nanolib/compare/@alwatr/logger@4.0.0...@alwatr/logger@4.0.1) (2024-10-08)
384
-
385
- **Note:** Version bump only for package @alwatr/logger
386
-
387
- ## [4.0.0](https://github.com/Alwatr/nanolib/compare/@alwatr/logger@3.2.14...@alwatr/logger@4.0.0) (2024-09-29)
388
-
389
- ### ⚠ BREAKING CHANGES
390
-
391
- - **logger:** logModule renamed to logFileModule
392
- - **logger:** definePackage and dedupt remove!
393
-
394
- ### Features
395
-
396
- - **logger:** add logStep method to logger ([860aeed](https://github.com/Alwatr/nanolib/commit/860aeedb2da390ee3d47c037b22a37f73e6dbbbc)) by @alimd
397
- - use `package-tracer` ([cc3c5f9](https://github.com/Alwatr/nanolib/commit/cc3c5f9c1a3d03f0d81b46835665f16a0426fd0d)) by @mohammadhonarvar
398
-
399
- ### Bug Fixes
400
-
401
- - all dependeny topology ([1c17f34](https://github.com/Alwatr/nanolib/commit/1c17f349adf3e98e2a80ab2da4f0f81028dc9c5f)) by @mohammadhonarvar
402
-
403
- ### Code Refactoring
404
-
405
- - **logger:** remove definePackage from logger ([c8a9d0c](https://github.com/Alwatr/nanolib/commit/c8a9d0cdcc3e45e7a33731ec6ee6a496451e9eb1)) by @mohammadhonarvar
406
- - **logger:** rename logModule to logFileModule ([1f6bd71](https://github.com/Alwatr/nanolib/commit/1f6bd71272007f5bbc90258ffa13b7d851e0918c)) by @alimd
407
-
408
- ### Miscellaneous Chores
409
-
410
- - **logger:** change the license to AGPL-3.0 ([4bb4673](https://github.com/Alwatr/nanolib/commit/4bb4673972069a307e799cad9a5078b0288a9340)) by @alimd
411
- - Update build and lint scripts ([392d0b7](https://github.com/Alwatr/nanolib/commit/392d0b71f446bce336b0256119a80f07aff794ba)) by @alimd
412
-
413
- ### Dependencies update
414
-
415
- - bump @types/node ([3d80fed](https://github.com/Alwatr/nanolib/commit/3d80fedaf720af792feb060c2f81c737ebb84e11)) by @dependabot[bot]
416
-
417
- ## [3.2.14](https://github.com/Alwatr/nanolib/compare/@alwatr/logger@3.2.13...@alwatr/logger@3.2.14) (2024-09-21)
418
-
419
- **Note:** Version bump only for package @alwatr/logger
420
-
421
- ## [3.2.13](https://github.com/Alwatr/nanolib/compare/@alwatr/logger@3.2.12...@alwatr/logger@3.2.13) (2024-09-15)
422
-
423
- ### Dependencies update
424
-
425
- - bump the development-dependencies group across 1 directory with 10 updates ([9ed98ff](https://github.com/Alwatr/nanolib/commit/9ed98ffd0668d5a36e255c82edab3af53bffda8f)) by @dependabot[bot]
426
- - update ([c36ed50](https://github.com/Alwatr/nanolib/commit/c36ed50f68da2f5608ccd96119963a16cfacb4ce)) by @alimd
427
-
428
- ## [3.2.12](https://github.com/Alwatr/nanolib/compare/@alwatr/logger@3.2.11...@alwatr/logger@3.2.12) (2024-08-31)
429
-
430
- ### Miscellaneous Chores
431
-
432
- - Update package.json exports for [@alwatr](https://github.com/alwatr) packages ([dacb362](https://github.com/Alwatr/nanolib/commit/dacb362b145e3c51b4aba00ff643687a3fac11d2)) by @
433
-
434
- ## [3.2.11](https://github.com/Alwatr/nanolib/compare/@alwatr/logger@3.2.10...@alwatr/logger@3.2.11) (2024-08-31)
435
-
436
- **Note:** Version bump only for package @alwatr/logger
437
-
438
- ## [3.2.10](https://github.com/Alwatr/nanolib/compare/@alwatr/logger@3.2.9...@alwatr/logger@3.2.10) (2024-08-31)
439
-
440
- ### Dependencies update
441
-
442
- - update all dependencies ([1e0c30e](https://github.com/Alwatr/nanolib/commit/1e0c30e6a3a8e19deb5185814e24ab6c08dca573)) by @alimd
443
-
444
- ## [3.2.9](https://github.com/Alwatr/nanolib/compare/@alwatr/logger@3.2.8...@alwatr/logger@3.2.9) (2024-07-04)
445
-
446
- ### Dependencies update
447
-
448
- - update all dependencies ([0e908b4](https://github.com/Alwatr/nanolib/commit/0e908b476a6b976ec2447f864c8cafcbb8a0f099)) by @
449
-
450
- ## [3.2.8](https://github.com/Alwatr/nanolib/compare/@alwatr/logger@3.2.7...@alwatr/logger@3.2.8) (2024-05-12)
451
-
452
- ### Dependencies update
453
-
454
- - upgrade ([6dbd300](https://github.com/Alwatr/nanolib/commit/6dbd300642c9bcc9e7d0b281e244bf1b06eb1c38)) by @alimd
455
-
456
- ## [3.2.7](https://github.com/Alwatr/nanolib/compare/@alwatr/logger@3.2.6...@alwatr/logger@3.2.7) (2024-04-25)
457
-
458
- **Note:** Version bump only for package @alwatr/logger
459
-
460
- ## [3.2.6](https://github.com/Alwatr/nanolib/compare/@alwatr/logger@3.2.5...@alwatr/logger@3.2.6) (2024-03-28)
461
-
462
- **Note:** Version bump only for package @alwatr/logger
463
-
464
- ## [3.2.5](https://github.com/Alwatr/nanolib/compare/@alwatr/logger@3.2.4...@alwatr/logger@3.2.5) (2024-01-31)
465
-
466
- ### Bug Fixes
467
-
468
- - exported types by add .js extensions to all imports ([fc3d83e](https://github.com/Alwatr/nanolib/commit/fc3d83e8f375da97ba276314b2e6966aa82c9b3f)) by @alimd
469
-
470
- ### Miscellaneous Chores
471
-
472
- - **deps:** update ([1a45030](https://github.com/Alwatr/nanolib/commit/1a450305440b710a300787d4ca24b1ed8c6a39d7)) by @alimd
473
-
474
- ## [3.2.4](https://github.com/Alwatr/nanolib/compare/@alwatr/logger@3.2.3...@alwatr/logger@3.2.4) (2024-01-24)
475
-
476
- **Note:** Version bump only for package @alwatr/logger
477
-
478
- ## [3.2.3](https://github.com/Alwatr/nanolib/compare/@alwatr/logger@3.2.2...@alwatr/logger@3.2.3) (2024-01-20)
479
-
480
- **Note:** Version bump only for package @alwatr/logger
481
-
482
- ## [3.2.2](https://github.com/Alwatr/nanolib/compare/@alwatr/logger@3.2.1...@alwatr/logger@3.2.2) (2024-01-16)
483
-
484
- **Note:** Version bump only for package @alwatr/logger
485
-
486
- ## [3.2.1](https://github.com/Alwatr/nanolib/compare/@alwatr/logger@3.2.0...@alwatr/logger@3.2.1) (2024-01-08)
487
-
488
- **Note:** Version bump only for package @alwatr/logger
489
-
490
- # [3.2.0](https://github.com/Alwatr/nanolib/compare/@alwatr/logger@3.1.0...@alwatr/logger@3.2.0) (2024-01-08)
491
-
492
- ### Bug Fixes
493
-
494
- - **logger:** defaultDebugMode ([bab9f7c](https://github.com/Alwatr/nanolib/commit/bab9f7c7b26fc2f50476ebc74d484a4b39c9dbda)) by @alimd
495
-
496
- ### Features
497
-
498
- - **logger:** debugMode in definePackage ([9799320](https://github.com/Alwatr/nanolib/commit/97993203d76db57e55b31bef485ea77cfd32a64c)) by @njfamirm
499
-
500
- # [3.1.0](https://github.com/Alwatr/nanolib/compare/@alwatr/logger@3.0.1...@alwatr/logger@3.1.0) (2024-01-06)
501
-
502
- ### Features
503
-
504
- - **logger:** definePackage ([dfd090e](https://github.com/Alwatr/nanolib/commit/dfd090ebd691c9a589370094d49f950524f71369)) by @alimd
505
-
506
- ## [3.0.1](https://github.com/Alwatr/nanolib/compare/@alwatr/logger@3.0.0...@alwatr/logger@3.0.1) (2024-01-03)
507
-
508
- **Note:** Version bump only for package @alwatr/logger
509
-
510
- # 3.0.0 (2024-01-03)
511
-
512
- ### Bug Fixes
513
-
514
- - `__package_version__` global type ([de8a3f9](https://github.com/Alwatr/nanolib/commit/de8a3f93bdb5a786c42f56324072b4b9520ce3a1)) by @alimd
515
- - **logger:** definePackage ([e2e5c6c](https://github.com/Alwatr/nanolib/commit/e2e5c6c8175d6f7bfba1d103c1cac2f647aa6116)) by @alimd
516
-
517
- ### Features
518
-
519
- - **logger:** change devMode env name ([ad549dc](https://github.com/Alwatr/nanolib/commit/ad549dc39e52242261c78939bd62ca10f69cea60)) by @njfamirm
520
- - **logger:** Update debugMode to enabled by default in development mode ([bc7c7ee](https://github.com/Alwatr/nanolib/commit/bc7c7ee1118a259ceaa1be1dade90f2f9ccf9e1d)) by @alimd
521
- - **logger:** use alwatr dedupe ([d89d076](https://github.com/Alwatr/nanolib/commit/d89d076c9fd0dd311804831b1ac0ea955efd4b6d)) by @njfamirm
522
-
523
- ### BREAKING CHANGES
524
-
525
- - **logger:** define packages removed and must use @alwatr/dedupe instead
526
- - **logger:** use DEBUG in cli and debug in browser
package/dist/main.cjs DELETED
@@ -1,8 +0,0 @@
1
- /** 📦 @alwatr/logger v6.0.17 */
2
- __dev_mode__: console.debug("📦 @alwatr/logger v6.0.17");
3
- "use strict";var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __hasOwnProp=Object.prototype.hasOwnProperty;var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:true})};var __copyProps=(to,from,except,desc)=>{if(from&&typeof from==="object"||typeof from==="function"){for(let key of __getOwnPropNames(from))if(!__hasOwnProp.call(to,key)&&key!==except)__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable})}return to};var __toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:true}),mod);var main_exports={};__export(main_exports,{createLogger:()=>createLogger});module.exports=__toCommonJS(main_exports);var import_global_this=require("@alwatr/global-this");var import_platform_info=require("@alwatr/platform-info");var console_=(0,import_global_this.getGlobalThis)().console;var defaultDebugMode=(()=>{if(import_platform_info.platformInfo.development){if(import_platform_info.platformInfo.isCli){return process.env.ALWATR_DEBUG!=="0"}else{return typeof localStorage!=="undefined"&&localStorage.getItem("ALWATR_DEBUG")!=="0"}}return import_platform_info.platformInfo.isCli?Boolean(process.env.DEBUG):typeof localStorage!=="undefined"&&localStorage.getItem("ALWATR_DEBUG")==="1"})();var colorList=(()=>import_platform_info.platformInfo.isCli?["0;36","0;35","0;34","0;33","0;32"]:["#35b997","#f05561","#ee224a","#91c13e","#22af4b","#f0e995","#0fe995","#0f89ca","#08b9a5","#fee851","#ee573d","#f9df30","#1da2dc","#f05123","#ee2524"])();var style_=(()=>({scope:import_platform_info.platformInfo.isCli?"\x1B[{{color}}m":"color: {{color}};",reset:import_platform_info.platformInfo.isCli?"\x1B[0m":"color: inherit;"}))();var keySection_=(()=>import_platform_info.platformInfo.isCli?"%s%s%s":"%c%s%c")();var colorIndex_=0;function getNextColor_(){const color=colorList[colorIndex_];colorIndex_=(colorIndex_+1)%colorList.length;return color}function sanitizeDomain_(domain){domain=domain.trim();if(!/^[[{<]/.test(domain)){domain=`{${domain}}`}return domain}function createLogger(domain,debugMode=defaultDebugMode){const color=getNextColor_();const styleScope=style_.scope.replace("{{color}}",color);const sanitizedDomain=sanitizeDomain_(domain);const requiredItems={debugMode,banner:import_platform_info.platformInfo.isCli?console_.log.bind(console_,`\x1B[1;37;45m {{{ %s }}} ${style_.reset}`):console_.log.bind(console_,"%c%s","font-size: 2rem; background-color: #5858e8; color: #fff; padding: 1rem 4rem; border-radius: 0.5rem;"),accident:import_platform_info.platformInfo.isCli?console_.warn.bind(console_,`${styleScope}⚠️
4
- %s\x1B[33m.%s() Accident \`%s\`!${style_.reset}`,sanitizedDomain):console_.warn.bind(console_,"%c%s%c.%s() Accident `%s`!",styleScope,sanitizedDomain,style_.reset),error:import_platform_info.platformInfo.isCli?console_.error.bind(console_,`${styleScope}❌
5
- %s\x1B[31m.%s() Error \`%s\`${style_.reset}
6
- `,sanitizedDomain):console_.error.bind(console_,"%c%s%c.%s() Error `%s`\n",styleScope,sanitizedDomain,style_.reset)};if(!debugMode){return requiredItems}return{...requiredItems,logProperty:console_.debug.bind(console_,keySection_+".%s = %o;",styleScope,sanitizedDomain,style_.reset),logMethod:console_.debug.bind(console_,keySection_+".%s();",styleScope,sanitizedDomain,style_.reset),logFileModule:console_.debug.bind(console_,keySection_+"/%s.js;",styleScope,sanitizedDomain,style_.reset),logMethodArgs:console_.debug.bind(console_,keySection_+".%s(%o);",styleScope,sanitizedDomain,style_.reset),logMethodFull:console_.debug.bind(console_,keySection_+".%s(%o) => %o",styleScope,sanitizedDomain,style_.reset),logStep:console_.debug.bind(console_,keySection_+".%s() -> %s",styleScope,sanitizedDomain,style_.reset),logOther:console_.debug.bind(console_,keySection_,styleScope,sanitizedDomain,style_.reset),logTable:console_.table.bind(console_),incident:import_platform_info.platformInfo.isCli?console_.log.bind(console_,`${styleScope}🚸
7
- %s${style_.reset}.%s() Incident \`%s\`!${style_.reset}`,sanitizedDomain):console_.log.bind(console_,"%c%s%c.%s() Incident `%s`!",styleScope,sanitizedDomain,"color: orange;"),time:label=>console_.time(sanitizedDomain+"."+label),timeEnd:label=>console_.timeEnd(sanitizedDomain+"."+label)}}0&&(module.exports={createLogger});
8
- //# sourceMappingURL=main.cjs.map
package/dist/main.cjs.map DELETED
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/main.ts", "../src/logger.ts"],
4
- "sourcesContent": ["export * from './logger.js';\nexport * from './type.js';\n", "import {getGlobalThis} from '@alwatr/global-this';\nimport {platformInfo} from '@alwatr/platform-info';\n\nimport type {AlwatrLogger} from './type.js';\n\nconst console_ = getGlobalThis().console;\n\n/**\n * Default debug mode state, determined by environment variables or localStorage.\n */\nconst defaultDebugMode = (() => {\n if (platformInfo.development) {\n if (platformInfo.isCli) {\n return process.env.ALWATR_DEBUG !== '0';\n }\n else {\n return typeof localStorage !== 'undefined' && localStorage.getItem('ALWATR_DEBUG') !== '0';\n }\n }\n // else\n return platformInfo.isCli\n ? Boolean(process.env.DEBUG)\n : typeof localStorage !== 'undefined' && localStorage.getItem('ALWATR_DEBUG') === '1';\n})();\n\n/**\n * A list of aesthetically pleasing colors for console logging, adapted for CLI and browser environments.\n */\nconst colorList = (() =>\n platformInfo.isCli\n ? ['0;36', '0;35', '0;34', '0;33', '0;32'] // CLI-safe colors\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\n/**\n * Platform-specific styling templates for logger output.\n */\nconst style_ = (() => ({\n scope: platformInfo.isCli ? '\\x1b[{{color}}m' : 'color: {{color}};',\n reset: platformInfo.isCli ? '\\x1b[0m' : 'color: inherit;',\n}))();\n\n/**\n * Platform-specific format for displaying the logger's scope.\n */\nconst keySection_ = (() => (platformInfo.isCli ? '%s%s%s' : '%c%s%c'))();\n\n// --- Utility Functions ---\n\nlet colorIndex_ = 0;\n/**\n * Cycles through the `colorList` to provide a new color for each logger instance.\n */\nfunction getNextColor_(): string {\n const color = colorList[colorIndex_];\n colorIndex_ = (colorIndex_ + 1) % colorList.length;\n return color;\n}\n\n/**\n * Sanitizes and formats the logger domain string by wrapping it in brackets if not already.\n */\nfunction sanitizeDomain_(domain: string): string {\n domain = domain.trim();\n if (!/^[[{<]/.test(domain)) {\n domain = `{${domain}}`;\n }\n return domain;\n}\n\n// --- Core Factory ---\n\n/**\n * Create a logger function for fancy console debug with custom scope.\n *\n * - `color` is optional and automatically selected from an internal list.\n * - `debug` is optional and automatically detected from `ALWATR_DEBUG` in localStorage or `process.env.DEBUG`.\n *\n * @example\n * ```ts\n * import {createLogger} from '@alwatr/logger';\n * const logger = createLogger('my-module');\n *\n * logger.logMethodArgs?.('myMethod', {a: 1}); // This line is ignored if debugMode is false.\n * ```\n */\nexport function createLogger(domain: string, debugMode = defaultDebugMode): AlwatrLogger {\n const color = getNextColor_();\n const styleScope = style_.scope.replace('{{color}}', color);\n const sanitizedDomain = sanitizeDomain_(domain);\n\n /**\n * Logger methods that are always available, regardless of debugMode.\n */\n const requiredItems: AlwatrLogger = {\n debugMode,\n\n banner: platformInfo.isCli\n ? console_.log.bind(console_, `\\x1b[1;37;45m {{{ %s }}} ${style_.reset}`)\n : console_.log.bind(\n console_,\n '%c%s',\n 'font-size: 2rem; background-color: #5858e8; color: #fff; padding: 1rem 4rem; border-radius: 0.5rem;',\n ),\n\n accident: platformInfo.isCli\n ? console_.warn.bind(console_, `${styleScope}⚠️\\n%s\\x1b[33m.%s() Accident \\`%s\\`!${style_.reset}`, sanitizedDomain)\n : console_.warn.bind(console_, '%c%s%c.%s() Accident `%s`!', styleScope, sanitizedDomain, style_.reset),\n\n error: platformInfo.isCli\n ? console_.error.bind(console_, `${styleScope}❌\\n%s\\x1b[31m.%s() Error \\`%s\\`${style_.reset}\\n`, sanitizedDomain)\n : console_.error.bind(console_, '%c%s%c.%s() Error `%s`\\n', styleScope, sanitizedDomain, style_.reset),\n };\n\n if (!debugMode) {\n return requiredItems;\n }\n\n /**\n * Logger methods available only when debugMode is true.\n * Using `console.debug` which is often filtered by default in browsers unless \"Verbose\" logs are enabled.\n */\n return {\n ...requiredItems,\n\n logProperty: console_.debug.bind(console_, keySection_ + '.%s = %o;', styleScope, sanitizedDomain, style_.reset),\n\n logMethod: console_.debug.bind(console_, keySection_ + '.%s();', styleScope, sanitizedDomain, style_.reset),\n\n logFileModule: console_.debug.bind(console_, keySection_ + '/%s.js;', styleScope, sanitizedDomain, style_.reset),\n\n logMethodArgs: console_.debug.bind(console_, keySection_ + '.%s(%o);', styleScope, sanitizedDomain, style_.reset),\n\n logMethodFull: console_.debug.bind(console_, keySection_ + '.%s(%o) => %o', styleScope, sanitizedDomain, style_.reset),\n\n logStep: console_.debug.bind(console_, keySection_ + '.%s() -> %s', styleScope, sanitizedDomain, style_.reset),\n\n logOther: console_.debug.bind(console_, keySection_, styleScope, sanitizedDomain, style_.reset),\n\n logTable: console_.table.bind(console_),\n\n incident: platformInfo.isCli\n ? console_.log.bind(console_, `${styleScope}🚸\\n%s${style_.reset}.%s() Incident \\`%s\\`!${style_.reset}`, sanitizedDomain)\n : console_.log.bind(console_, '%c%s%c.%s() Incident `%s`!', styleScope, sanitizedDomain, 'color: orange;'),\n\n time: (label: string) => console_.time(sanitizedDomain + '.' + label),\n timeEnd: (label: string) => console_.timeEnd(sanitizedDomain + '.' + label),\n } as const;\n}\n"],
5
- "mappings": "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",
6
- "names": []
7
- }
package/dist/main.mjs DELETED
@@ -1,8 +0,0 @@
1
- /** 📦 @alwatr/logger v6.0.17 */
2
- __dev_mode__: console.debug("📦 @alwatr/logger v6.0.17");
3
- import{getGlobalThis}from"@alwatr/global-this";import{platformInfo}from"@alwatr/platform-info";var console_=getGlobalThis().console;var defaultDebugMode=(()=>{if(platformInfo.development){if(platformInfo.isCli){return process.env.ALWATR_DEBUG!=="0"}else{return typeof localStorage!=="undefined"&&localStorage.getItem("ALWATR_DEBUG")!=="0"}}return platformInfo.isCli?Boolean(process.env.DEBUG):typeof localStorage!=="undefined"&&localStorage.getItem("ALWATR_DEBUG")==="1"})();var colorList=(()=>platformInfo.isCli?["0;36","0;35","0;34","0;33","0;32"]:["#35b997","#f05561","#ee224a","#91c13e","#22af4b","#f0e995","#0fe995","#0f89ca","#08b9a5","#fee851","#ee573d","#f9df30","#1da2dc","#f05123","#ee2524"])();var style_=(()=>({scope:platformInfo.isCli?"\x1B[{{color}}m":"color: {{color}};",reset:platformInfo.isCli?"\x1B[0m":"color: inherit;"}))();var keySection_=(()=>platformInfo.isCli?"%s%s%s":"%c%s%c")();var colorIndex_=0;function getNextColor_(){const color=colorList[colorIndex_];colorIndex_=(colorIndex_+1)%colorList.length;return color}function sanitizeDomain_(domain){domain=domain.trim();if(!/^[[{<]/.test(domain)){domain=`{${domain}}`}return domain}function createLogger(domain,debugMode=defaultDebugMode){const color=getNextColor_();const styleScope=style_.scope.replace("{{color}}",color);const sanitizedDomain=sanitizeDomain_(domain);const requiredItems={debugMode,banner:platformInfo.isCli?console_.log.bind(console_,`\x1B[1;37;45m {{{ %s }}} ${style_.reset}`):console_.log.bind(console_,"%c%s","font-size: 2rem; background-color: #5858e8; color: #fff; padding: 1rem 4rem; border-radius: 0.5rem;"),accident:platformInfo.isCli?console_.warn.bind(console_,`${styleScope}⚠️
4
- %s\x1B[33m.%s() Accident \`%s\`!${style_.reset}`,sanitizedDomain):console_.warn.bind(console_,"%c%s%c.%s() Accident `%s`!",styleScope,sanitizedDomain,style_.reset),error:platformInfo.isCli?console_.error.bind(console_,`${styleScope}❌
5
- %s\x1B[31m.%s() Error \`%s\`${style_.reset}
6
- `,sanitizedDomain):console_.error.bind(console_,"%c%s%c.%s() Error `%s`\n",styleScope,sanitizedDomain,style_.reset)};if(!debugMode){return requiredItems}return{...requiredItems,logProperty:console_.debug.bind(console_,keySection_+".%s = %o;",styleScope,sanitizedDomain,style_.reset),logMethod:console_.debug.bind(console_,keySection_+".%s();",styleScope,sanitizedDomain,style_.reset),logFileModule:console_.debug.bind(console_,keySection_+"/%s.js;",styleScope,sanitizedDomain,style_.reset),logMethodArgs:console_.debug.bind(console_,keySection_+".%s(%o);",styleScope,sanitizedDomain,style_.reset),logMethodFull:console_.debug.bind(console_,keySection_+".%s(%o) => %o",styleScope,sanitizedDomain,style_.reset),logStep:console_.debug.bind(console_,keySection_+".%s() -> %s",styleScope,sanitizedDomain,style_.reset),logOther:console_.debug.bind(console_,keySection_,styleScope,sanitizedDomain,style_.reset),logTable:console_.table.bind(console_),incident:platformInfo.isCli?console_.log.bind(console_,`${styleScope}🚸
7
- %s${style_.reset}.%s() Incident \`%s\`!${style_.reset}`,sanitizedDomain):console_.log.bind(console_,"%c%s%c.%s() Incident `%s`!",styleScope,sanitizedDomain,"color: orange;"),time:label=>console_.time(sanitizedDomain+"."+label),timeEnd:label=>console_.timeEnd(sanitizedDomain+"."+label)}}export{createLogger};
8
- //# sourceMappingURL=main.mjs.map
package/dist/main.mjs.map DELETED
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/logger.ts"],
4
- "sourcesContent": ["import {getGlobalThis} from '@alwatr/global-this';\nimport {platformInfo} from '@alwatr/platform-info';\n\nimport type {AlwatrLogger} from './type.js';\n\nconst console_ = getGlobalThis().console;\n\n/**\n * Default debug mode state, determined by environment variables or localStorage.\n */\nconst defaultDebugMode = (() => {\n if (platformInfo.development) {\n if (platformInfo.isCli) {\n return process.env.ALWATR_DEBUG !== '0';\n }\n else {\n return typeof localStorage !== 'undefined' && localStorage.getItem('ALWATR_DEBUG') !== '0';\n }\n }\n // else\n return platformInfo.isCli\n ? Boolean(process.env.DEBUG)\n : typeof localStorage !== 'undefined' && localStorage.getItem('ALWATR_DEBUG') === '1';\n})();\n\n/**\n * A list of aesthetically pleasing colors for console logging, adapted for CLI and browser environments.\n */\nconst colorList = (() =>\n platformInfo.isCli\n ? ['0;36', '0;35', '0;34', '0;33', '0;32'] // CLI-safe colors\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\n/**\n * Platform-specific styling templates for logger output.\n */\nconst style_ = (() => ({\n scope: platformInfo.isCli ? '\\x1b[{{color}}m' : 'color: {{color}};',\n reset: platformInfo.isCli ? '\\x1b[0m' : 'color: inherit;',\n}))();\n\n/**\n * Platform-specific format for displaying the logger's scope.\n */\nconst keySection_ = (() => (platformInfo.isCli ? '%s%s%s' : '%c%s%c'))();\n\n// --- Utility Functions ---\n\nlet colorIndex_ = 0;\n/**\n * Cycles through the `colorList` to provide a new color for each logger instance.\n */\nfunction getNextColor_(): string {\n const color = colorList[colorIndex_];\n colorIndex_ = (colorIndex_ + 1) % colorList.length;\n return color;\n}\n\n/**\n * Sanitizes and formats the logger domain string by wrapping it in brackets if not already.\n */\nfunction sanitizeDomain_(domain: string): string {\n domain = domain.trim();\n if (!/^[[{<]/.test(domain)) {\n domain = `{${domain}}`;\n }\n return domain;\n}\n\n// --- Core Factory ---\n\n/**\n * Create a logger function for fancy console debug with custom scope.\n *\n * - `color` is optional and automatically selected from an internal list.\n * - `debug` is optional and automatically detected from `ALWATR_DEBUG` in localStorage or `process.env.DEBUG`.\n *\n * @example\n * ```ts\n * import {createLogger} from '@alwatr/logger';\n * const logger = createLogger('my-module');\n *\n * logger.logMethodArgs?.('myMethod', {a: 1}); // This line is ignored if debugMode is false.\n * ```\n */\nexport function createLogger(domain: string, debugMode = defaultDebugMode): AlwatrLogger {\n const color = getNextColor_();\n const styleScope = style_.scope.replace('{{color}}', color);\n const sanitizedDomain = sanitizeDomain_(domain);\n\n /**\n * Logger methods that are always available, regardless of debugMode.\n */\n const requiredItems: AlwatrLogger = {\n debugMode,\n\n banner: platformInfo.isCli\n ? console_.log.bind(console_, `\\x1b[1;37;45m {{{ %s }}} ${style_.reset}`)\n : console_.log.bind(\n console_,\n '%c%s',\n 'font-size: 2rem; background-color: #5858e8; color: #fff; padding: 1rem 4rem; border-radius: 0.5rem;',\n ),\n\n accident: platformInfo.isCli\n ? console_.warn.bind(console_, `${styleScope}⚠️\\n%s\\x1b[33m.%s() Accident \\`%s\\`!${style_.reset}`, sanitizedDomain)\n : console_.warn.bind(console_, '%c%s%c.%s() Accident `%s`!', styleScope, sanitizedDomain, style_.reset),\n\n error: platformInfo.isCli\n ? console_.error.bind(console_, `${styleScope}❌\\n%s\\x1b[31m.%s() Error \\`%s\\`${style_.reset}\\n`, sanitizedDomain)\n : console_.error.bind(console_, '%c%s%c.%s() Error `%s`\\n', styleScope, sanitizedDomain, style_.reset),\n };\n\n if (!debugMode) {\n return requiredItems;\n }\n\n /**\n * Logger methods available only when debugMode is true.\n * Using `console.debug` which is often filtered by default in browsers unless \"Verbose\" logs are enabled.\n */\n return {\n ...requiredItems,\n\n logProperty: console_.debug.bind(console_, keySection_ + '.%s = %o;', styleScope, sanitizedDomain, style_.reset),\n\n logMethod: console_.debug.bind(console_, keySection_ + '.%s();', styleScope, sanitizedDomain, style_.reset),\n\n logFileModule: console_.debug.bind(console_, keySection_ + '/%s.js;', styleScope, sanitizedDomain, style_.reset),\n\n logMethodArgs: console_.debug.bind(console_, keySection_ + '.%s(%o);', styleScope, sanitizedDomain, style_.reset),\n\n logMethodFull: console_.debug.bind(console_, keySection_ + '.%s(%o) => %o', styleScope, sanitizedDomain, style_.reset),\n\n logStep: console_.debug.bind(console_, keySection_ + '.%s() -> %s', styleScope, sanitizedDomain, style_.reset),\n\n logOther: console_.debug.bind(console_, keySection_, styleScope, sanitizedDomain, style_.reset),\n\n logTable: console_.table.bind(console_),\n\n incident: platformInfo.isCli\n ? console_.log.bind(console_, `${styleScope}🚸\\n%s${style_.reset}.%s() Incident \\`%s\\`!${style_.reset}`, sanitizedDomain)\n : console_.log.bind(console_, '%c%s%c.%s() Incident `%s`!', styleScope, sanitizedDomain, 'color: orange;'),\n\n time: (label: string) => console_.time(sanitizedDomain + '.' + label),\n timeEnd: (label: string) => console_.timeEnd(sanitizedDomain + '.' + label),\n } as const;\n}\n"],
5
- "mappings": "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",
6
- "names": []
7
- }