@alwatr/logger 2.4.1 → 3.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/CHANGELOG.md CHANGED
@@ -3,412 +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
- ## [2.4.1](https://github.com/Alwatr/alwatr-es-sdk/compare/@alwatr/logger@2.4.0...@alwatr/logger@2.4.1) (2023-12-19)
6
+ # 3.0.0 (2024-01-03)
7
7
 
8
8
  ### Bug Fixes
9
9
 
10
- * **logger:** define package scope ([b54c2ef](https://github.com/Alwatr/alwatr-es-sdk/commit/b54c2ef08a7b9e61068fd6a3faeccd3e4e7a6a09)) by @njfamirm
11
-
12
- # [2.4.0](https://github.com/Alwatr/alwatr-es-sdk/compare/@alwatr/logger@2.3.3...@alwatr/logger@2.4.0) (2023-12-19)
13
-
14
- ### Bug Fixes
15
-
16
- * **logger:** duplicate package definition and throw error ([640ce6a](https://github.com/Alwatr/alwatr-es-sdk/commit/640ce6acff999205569d978e8c32c458834d85ed)) by @AliMD
17
- * **logger:** styleScope.replace in createLogger function ([d209a9b](https://github.com/Alwatr/alwatr-es-sdk/commit/d209a9ba770a4e939726e80731c08a4bc00c6202)) by @AliMD
18
-
19
- ### Features
20
-
21
- * use globalScope instead globalThis ([94342bb](https://github.com/Alwatr/alwatr-es-sdk/commit/94342bb7b467376173a65d8cdf6bb106338f425b)) by @njfamirm
22
-
23
- ## [2.3.3](https://github.com/Alwatr/alwatr-es-sdk/compare/@alwatr/logger@2.3.2...@alwatr/logger@2.3.3) (2023-12-11)
24
-
25
- ### Bug Fixes
26
-
27
- * **logger/define-package:** throw error if duplicate_package_defined ([c32be46](https://github.com/Alwatr/alwatr-es-sdk/commit/c32be4680bd8b8315c54f63d380634448a989bff)) by @njfamirm
28
-
29
- ## [2.3.2](https://github.com/Alwatr/alwatr-es-sdk/compare/@alwatr/logger@2.3.1...@alwatr/logger@2.3.2) (2023-12-09)
30
-
31
- **Note:** Version bump only for package @alwatr/logger
32
-
33
- ## [2.3.1](https://github.com/Alwatr/eslib/compare/@alwatr/logger@2.3.0...@alwatr/logger@2.3.1) (2023-11-29)
34
-
35
- **Note:** Version bump only for package @alwatr/logger
36
-
37
- # [2.3.0](https://github.com/Alwatr/eslib/compare/@alwatr/logger@2.2.0...@alwatr/logger@2.3.0) (2023-11-23)
38
-
39
- ### Features
40
-
41
- * **logger/global:** globalScope ([8111c10](https://github.com/Alwatr/eslib/commit/8111c108edff13d433d5f2f50470d00058e761ba)) by @AliMD
42
-
43
- # [2.2.0](https://github.com/Alwatr/eslib/compare/@alwatr/logger@2.1.3...@alwatr/logger@2.2.0) (2023-11-14)
44
-
45
- ### Bug Fixes
46
-
47
- * **logger:** logger.banner type ([1f2586d](https://github.com/Alwatr/eslib/commit/1f2586dab65608c4a54f20859f4ea2dda6028c7c)) by @
48
-
49
- ### Features
50
-
51
- * **yarn:** pnp ([b6a562c](https://github.com/Alwatr/eslib/commit/b6a562c909a35b3e626442e5c325da3fce448e1b)) by @AliMD
52
-
53
- ## [2.1.3](https://github.com/Alwatr/eslib/compare/@alwatr/logger@2.1.2...@alwatr/logger@2.1.3) (2023-11-08)
54
-
55
- ### Bug Fixes
56
-
57
- * move repo urls ([719aa3e](https://github.com/Alwatr/eslib/commit/719aa3e7462d3c9c6272958fc93f89fda6793fb1)) by @AliMD
58
-
59
- ## [2.1.2](https://github.com/Alwatr/eslib/compare/@alwatr/logger@2.1.1...@alwatr/logger@2.1.2) (2023-11-01)
60
-
61
- ### Bug Fixes
62
-
63
- * **logger:** show duplicate_old_package_defined error after all packages designed ([8bb3410](https://github.com/Alwatr/eslib/commit/8bb341033091d25d1128127e00fafdafc25d1827)) by @
64
-
65
- ## [2.1.1](https://github.com/Alwatr/eslib/compare/@alwatr/logger@2.1.0...@alwatr/logger@2.1.1) (2023-10-23)
66
-
67
- **Note:** Version bump only for package @alwatr/logger
68
-
69
- # [2.1.0](https://github.com/Alwatr/eslib/compare/@alwatr/logger@2.0.0...@alwatr/logger@2.1.0) (2023-10-23)
70
-
71
- ### Features
72
-
73
- * **logger:** accident if old Alwatr.registeredList found ([d0ae735](https://github.com/Alwatr/eslib/commit/d0ae735b2b54cc75a380902d9fbe9dddaad650f4)) by @
74
-
75
- # [2.0.0](https://github.com/Alwatr/eslib/compare/@alwatr/logger@1.2.0...@alwatr/logger@2.0.0) (2023-10-23)
76
-
77
- ### Bug Fixes
78
-
79
- * **logger:** remove globalAlwatr ([e7a7236](https://github.com/Alwatr/eslib/commit/e7a72361715cbeb05c5dea4dbff7c2b583d2eab2)) by @AliMD
10
+ * __package_version__ global type ([de8a3f9](https://github.com/Alwatr/nanolib/commit/de8a3f93bdb5a786c42f56324072b4b9520ce3a1)) by @AliMD
11
+ * **logger:** definePackage ([e2e5c6c](https://github.com/Alwatr/nanolib/commit/e2e5c6c8175d6f7bfba1d103c1cac2f647aa6116)) by @AliMD
80
12
 
81
13
  ### Features
82
14
 
83
- * **logger:** define logger package ([5beaaf4](https://github.com/Alwatr/eslib/commit/5beaaf4f6f2f74d4976f9d0d58927526f283d5f9)) by @AliMD
84
- * **logger:** definePackage, the new api for global alwatr ([e3635e2](https://github.com/Alwatr/eslib/commit/e3635e2012e5ab5a79622693c5bf7c4639840258)) by @AliMD
85
- * **logger:** remove desc from incident & accident ([fa38b68](https://github.com/Alwatr/eslib/commit/fa38b68ce63524f1b53f3ad135450289eff66ae8)) by @AliMD
15
+ * **logger:** change devMode env name ([ad549dc](https://github.com/Alwatr/nanolib/commit/ad549dc39e52242261c78939bd62ca10f69cea60)) by @njfamirm
16
+ * **logger:** Update debugMode to enabled by default in development mode ([bc7c7ee](https://github.com/Alwatr/nanolib/commit/bc7c7ee1118a259ceaa1be1dade90f2f9ccf9e1d)) by @AliMD
17
+ * **logger:** use alwatr dedupe ([d89d076](https://github.com/Alwatr/nanolib/commit/d89d076c9fd0dd311804831b1ac0ea955efd4b6d)) by @njfamirm
86
18
 
87
19
  ### BREAKING CHANGES
88
20
 
89
- * **logger:** remove desc from incident & accident
90
- * **logger:** global Alwatr.registeredList not exist anymore
91
-
92
- # [1.2.0](https://github.com/Alwatr/eslib/compare/@alwatr/logger@1.1.5...@alwatr/logger@1.2.0) (2023-10-23)
93
-
94
- ### Features
95
-
96
- * **logger:** banner method ([3e3af6d](https://github.com/Alwatr/eslib/commit/3e3af6d71ccecaaf14ca9d63a8a14c7239afe697)) by @
97
-
98
- ## [1.1.5](https://github.com/Alwatr/eslib/compare/@alwatr/logger@1.1.4...@alwatr/logger@1.1.5) (2023-09-19)
99
-
100
- ### Bug Fixes
101
-
102
- - package repo urls ([466cbe9](https://github.com/Alwatr/eslib/commit/466cbe9188f24e1a1bc36d879a95b52538a58f16)) by @AliMD
103
-
104
- ## [1.1.4](https://github.com/Alwatr/eslib/compare/@alwatr/logger@1.1.3...@alwatr/logger@1.1.4) (2023-09-19)
105
-
106
- **Note:** Version bump only for package @alwatr/logger
107
-
108
- ## [1.1.3](https://github.com/Alwatr/eslib/compare/@alwatr/logger@1.1.2...@alwatr/logger@1.1.3) (2023-09-19)
109
-
110
- **Note:** Version bump only for package @alwatr/logger
111
-
112
- ## [1.1.2](https://github.com/Alwatr/eslib/compare/@alwatr/logger@1.1.1...@alwatr/logger@1.1.2) (2023-09-12)
113
-
114
- ### Bug Fixes
115
-
116
- - **logger:** change localStorage debug key to `alwatrDebug` ([66542ea](https://github.com/Alwatr/eslib/commit/66542ea22a9a515db4a15dc966624b3029f517ed)) by @AliMD
117
-
118
- ## [1.1.1](https://github.com/Alwatr/eslib/compare/@alwatr/logger@1.1.0...@alwatr/logger@1.1.1) (2023-09-12)
119
-
120
- **Note:** Version bump only for package @alwatr/logger
121
-
122
- # 1.1.0 (2023-09-12)
123
-
124
- ### Features
125
-
126
- - **logger:** add logModule ([2e37bef](https://github.com/Alwatr/eslib/commit/2e37befd5f66094c5a521424e2a9d60796384f88))
127
-
128
- # 1.0.0 (2023-06-14)
129
-
130
- # 0.32.0 (2023-05-27)
131
-
132
- # 0.31.0 (2023-05-08)
133
-
134
- ### Bug Fixes
135
-
136
- - **logger:** logMethod args type ([66338b7](https://github.com/Alwatr/eslib/commit/66338b7ba1d4b15af78f9f604f7be0a7e483413d))
137
- - **logger:** logMethod args type ([1983b3d](https://github.com/Alwatr/eslib/commit/1983b3d2fe260226ca2660e33b9bd924facdf776))
138
- - new logger api ([9d83a7d](https://github.com/Alwatr/eslib/commit/9d83a7dc5c103bc3bb4282dacfd85fa998915300))
139
-
140
- ### Features
141
-
142
- - **logger:** add `duration time` to logger time label ([ef188c4](https://github.com/Alwatr/eslib/commit/ef188c41a02789e1b35ab424bab24a393a03a3b0))
143
- - **logger:** add `time` & `timeEnd` ([0bd4ec5](https://github.com/Alwatr/eslib/commit/0bd4ec5dbd185b17cfb8656a84a782e848ade138))
144
- - **logger:** optional devMode per package ([cc1eb87](https://github.com/Alwatr/eslib/commit/cc1eb879832807d55ad4cf268a54b2d5e4346fff))
145
-
146
- # 0.30.0 (2023-03-06)
147
-
148
- ### Features
149
-
150
- - **logger:** export isBrowser ([5b5be8b](https://github.com/Alwatr/eslib/commit/5b5be8b2312ca67f186d1614506423f1fdb90877))
151
-
152
- # 0.29.0 (2023-02-10)
153
-
154
- # 0.28.0 (2023-01-20)
155
-
156
- ### Bug Fixes
157
-
158
- - **logger:** _ALWATR_VERSION_ ([9cf8f20](https://github.com/Alwatr/eslib/commit/9cf8f208e8adbfa2e2c622a8465453d5554cbd37))
159
-
160
- # 0.27.0 (2022-12-29)
161
-
162
- ### Bug Fixes
163
-
164
- - **logger:** version ([2295fee](https://github.com/Alwatr/eslib/commit/2295fee74e8eebd9db399129de31f2b0d6d6b168))
165
-
166
- ### Features
167
-
168
- - **type:** define alwatrRegistredList ([25406c2](https://github.com/Alwatr/eslib/commit/25406c268f39cf3e055ea05c9fc7b50bd3dd0a17))
169
-
170
- # 0.26.0 (2022-12-22)
171
-
172
- ### Bug Fixes
173
-
174
- - set correct path ([d01ce6f](https://github.com/Alwatr/eslib/commit/d01ce6ffa749a5e3e0e11e35b4ed61d75d61fec9))
175
- - tsconfig ([e96dcd3](https://github.com/Alwatr/eslib/commit/e96dcd30774a9f06f7d051e0504192cbbe019e35))
176
-
177
- ### Features
178
-
179
- - improve error debugging ([1fba504](https://github.com/Alwatr/eslib/commit/1fba50400a1e8ececc10bbe8ea11cc8dcea2289c))
180
- - **logger:** add root version ([2ac01c1](https://github.com/Alwatr/eslib/commit/2ac01c1d12323a6c8591b3dd4826d08a55647dc1))
181
- - **logger:** move incident to deployment mode ([4ee8dac](https://github.com/Alwatr/eslib/commit/4ee8dac5c54ce8a897382d3d4fb5bb852d24cf24))
182
-
183
- # [1.0.0](https://github.com/Alwatr/eslib/compare/v0.32.0...v1.0.0) (2023-06-14)
184
-
185
- **Note:** Version bump only for package @alwatr/logger
186
-
187
- # [0.32.0](https://github.com/Alwatr/eslib/compare/v0.31.0...v0.32.0) (2023-05-27)
188
-
189
- **Note:** Version bump only for package @alwatr/logger
190
-
191
- # [0.31.0](https://github.com/Alwatr/eslib/compare/v0.30.0...v0.31.0) (2023-05-08)
192
-
193
- ### Bug Fixes
194
-
195
- - **logger:** logMethod args type ([66338b7](https://github.com/Alwatr/eslib/commit/66338b7ba1d4b15af78f9f604f7be0a7e483413d))
196
- - **logger:** logMethod args type ([1983b3d](https://github.com/Alwatr/eslib/commit/1983b3d2fe260226ca2660e33b9bd924facdf776))
197
- - new logger api ([9d83a7d](https://github.com/Alwatr/eslib/commit/9d83a7dc5c103bc3bb4282dacfd85fa998915300))
198
-
199
- ### Features
200
-
201
- - **logger:** add `duration time` to logger time label ([ef188c4](https://github.com/Alwatr/eslib/commit/ef188c41a02789e1b35ab424bab24a393a03a3b0))
202
- - **logger:** add `time` & `timeEnd` ([0bd4ec5](https://github.com/Alwatr/eslib/commit/0bd4ec5dbd185b17cfb8656a84a782e848ade138))
203
- - **logger:** optional devMode per package ([cc1eb87](https://github.com/Alwatr/eslib/commit/cc1eb879832807d55ad4cf268a54b2d5e4346fff))
204
-
205
- # [0.30.0](https://github.com/Alwatr/eslib/compare/v0.29.0...v0.30.0) (2023-03-06)
206
-
207
- ### Features
208
-
209
- - **logger:** export isBrowser ([5b5be8b](https://github.com/Alwatr/eslib/commit/5b5be8b2312ca67f186d1614506423f1fdb90877))
210
-
211
- # [0.29.0](https://github.com/Alwatr/eslib/compare/v0.28.0...v0.29.0) (2023-02-10)
212
-
213
- **Note:** Version bump only for package @alwatr/logger
214
-
215
- # [0.28.0](https://github.com/Alwatr/eslib/compare/v0.27.0...v0.28.0) (2023-01-20)
216
-
217
- ### Bug Fixes
218
-
219
- - **logger:** _ALWATR_VERSION_ ([9cf8f20](https://github.com/Alwatr/eslib/commit/9cf8f208e8adbfa2e2c622a8465453d5554cbd37))
220
-
221
- ### Features
222
-
223
- - **type:** define alwatrRegistredList ([25406c2](https://github.com/Alwatr/eslib/commit/25406c268f39cf3e055ea05c9fc7b50bd3dd0a17))
224
-
225
- # [0.27.0](https://github.com/Alwatr/eslib/compare/v0.26.0...v0.27.0) (2022-12-29)
226
-
227
- ### Bug Fixes
228
-
229
- - **logger:** version ([2295fee](https://github.com/Alwatr/eslib/commit/2295fee74e8eebd9db399129de31f2b0d6d6b168))
230
-
231
- # [0.26.0](https://github.com/Alwatr/eslib/compare/v0.25.0...v0.26.0) (2022-12-22)
232
-
233
- ### Bug Fixes
234
-
235
- - set correct path ([d01ce6f](https://github.com/Alwatr/eslib/commit/d01ce6ffa749a5e3e0e11e35b4ed61d75d61fec9))
236
- - tsconfig ([e96dcd3](https://github.com/Alwatr/eslib/commit/e96dcd30774a9f06f7d051e0504192cbbe019e35))
237
-
238
- ### Features
239
-
240
- - improve error debugging ([1fba504](https://github.com/Alwatr/eslib/commit/1fba50400a1e8ececc10bbe8ea11cc8dcea2289c))
241
- - **logger:** add root version ([2ac01c1](https://github.com/Alwatr/eslib/commit/2ac01c1d12323a6c8591b3dd4826d08a55647dc1))
242
- - **logger:** move incident to deployment mode ([4ee8dac](https://github.com/Alwatr/eslib/commit/4ee8dac5c54ce8a897382d3d4fb5bb852d24cf24))
243
-
244
- # [0.25.0](https://github.com/Alwatr/eslib/compare/v0.24.1...v0.25.0) (2022-12-07)
245
-
246
- ### Features
247
-
248
- - **logger:** log incident in production mode ([c9b6c56](https://github.com/Alwatr/eslib/commit/c9b6c56182750444b1cced3343b02eea6a9f24c5))
249
-
250
- ## [0.24.1](https://github.com/Alwatr/eslib/compare/v0.24.0...v0.24.1) (2022-12-01)
251
-
252
- ### Bug Fixes
253
-
254
- - **logger:** optimize for browserify builds ([7afdc1c](https://github.com/Alwatr/eslib/commit/7afdc1cb5baf9b66dedcdc251595c02a79a163b2))
255
-
256
- # [0.24.0](https://github.com/Alwatr/eslib/compare/v0.23.0...v0.24.0) (2022-11-28)
257
-
258
- ### Bug Fixes
259
-
260
- - use ~ for package version ([4e027ff](https://github.com/Alwatr/eslib/commit/4e027ff63875e03b088ebcdc1bdf2495f4494eec))
261
-
262
- # [0.23.0](https://github.com/Alwatr/eslib/compare/v0.22.1...v0.23.0) (2022-11-23)
263
-
264
- **Note:** Version bump only for package @alwatr/logger
265
-
266
- # [0.22.0](https://github.com/Alwatr/eslib/compare/v0.21.0...v0.22.0) (2022-11-20)
267
-
268
- ### Bug Fixes
269
-
270
- - **logger:** message format in node ([0ab9153](https://github.com/Alwatr/eslib/commit/0ab9153e407cafd07af8b77b63e25c8d21b474c0))
271
-
272
- ### Features
273
-
274
- - **logger:** better log in browser and node ([1a35ac4](https://github.com/Alwatr/eslib/commit/1a35ac4bbb9aae4280ea99b8383459cf44de0baa))
275
-
276
- # [0.21.0](https://github.com/Alwatr/eslib/compare/v0.20.0...v0.21.0) (2022-11-13)
277
-
278
- **Note:** Version bump only for package @alwatr/logger
279
-
280
- # [0.20.0](https://github.com/Alwatr/eslib/compare/v0.19.0...v0.20.0) (2022-11-05)
281
-
282
- **Note:** Version bump only for package @alwatr/logger
283
-
284
- # [0.19.0](https://github.com/Alwatr/eslib/compare/v0.18.0...v0.19.0) (2022-11-01)
285
-
286
- ### Bug Fixes
287
-
288
- - Import error in webpack ([1a52f67](https://github.com/Alwatr/eslib/commit/1a52f67ff2788c51abd13126f34353c26aa669c3))
289
-
290
- # [0.18.0](https://github.com/Alwatr/eslib/compare/v0.17.0...v0.18.0) (2022-10-22)
291
-
292
- **Note:** Version bump only for package @alwatr/logger
293
-
294
- # [0.17.0](https://github.com/Alwatr/eslib/compare/v0.16.1...v0.17.0) (2022-10-21)
295
-
296
- ### Bug Fixes
297
-
298
- - **`logger`:** `accident` sould `console.warn` ([c210c9f](https://github.com/Alwatr/eslib/commit/c210c9f6a864692848ea0c89d6ffbdb19167732a))
299
-
300
- # [0.16.0](https://github.com/Alwatr/eslib/compare/v0.15.0...v0.16.0) (2022-09-08)
301
-
302
- **Note:** Version bump only for package @alwatr/logger
303
-
304
- # [0.15.0](https://github.com/Alwatr/eslib/compare/v0.14.0...v0.15.0) (2022-09-01)
305
-
306
- **Note:** Version bump only for package @alwatr/logger
307
-
308
- # [0.14.0](https://github.com/Alwatr/eslib/compare/v0.13.0...v0.14.0) (2022-08-19)
309
-
310
- **Note:** Version bump only for package @alwatr/logger
311
-
312
- # [0.13.0](https://github.com/Alwatr/eslib/compare/v0.12.0...v0.13.0) (2022-08-06)
313
-
314
- **Note:** Version bump only for package @alwatr/logger
315
-
316
- # [0.12.0](https://github.com/Alwatr/eslib/compare/v0.11.0...v0.12.0) (2022-07-22)
317
-
318
- ### Bug Fixes
319
-
320
- - **logger:** refactor behavior of force ([7d9307b](https://github.com/Alwatr/eslib/commit/7d9307bb78523f3dae17b3bd80fa2fb47c90975f))
321
-
322
- ### Features
323
-
324
- - **logger:** compatible with node.js ([7ee8b6d](https://github.com/Alwatr/eslib/commit/7ee8b6de3143e39c300345dec6864c9c56a4aae7))
325
- - **logger:** node coloring support ([2b4aab6](https://github.com/Alwatr/eslib/commit/2b4aab655bc0707761587a7439de98bbd4ad0e08))
326
-
327
- # [0.11.0](https://github.com/Alwatr/eslib/compare/v0.10.1...v0.11.0) (2022-04-16)
328
-
329
- **Note:** Version bump only for package @alwatr/logger
330
-
331
- # [0.10.0](https://github.com/Alwatr/eslib/compare/v0.9.0...v0.10.0) (2022-04-02)
332
-
333
- **Note:** Version bump only for package @alwatr/logger
334
-
335
- # [0.9.0](https://github.com/Alwatr/eslib/compare/v0.8.0...v0.9.0) (2022-03-22)
336
-
337
- **Note:** Version bump only for package @alwatr/logger
338
-
339
- # [0.8.0](https://github.com/Alwatr/eslib/compare/v0.7.2...v0.8.0) (2022-03-14)
340
-
341
- **Note:** Version bump only for package @alwatr/logger
342
-
343
- ## [0.7.2](https://github.com/Alwatr/eslib/compare/v0.7.1...v0.7.2) (2022-03-12)
344
-
345
- ### Features
346
-
347
- - **logger:** add debug and improve documents ([8f83d29](https://github.com/Alwatr/eslib/commit/8f83d2956e521f016fe530322f657c343f1a0b80))
348
-
349
- # [0.7.0](https://github.com/Alwatr/eslib/compare/v0.6.1...v0.7.0) (2022-03-12)
350
-
351
- **Note:** Version bump only for package @alwatr/logger
352
-
353
- # [0.6.0](https://github.com/Alwatr/eslib/compare/v0.5.0...v0.6.0) (2022-03-11)
354
-
355
- ### Bug Fixes
356
-
357
- - alalwatr ([898aa6e](https://github.com/Alwatr/eslib/commit/898aa6ed0888eab9265c83b96a50f1b8c216d143))
358
- - **packages:** duplicate alwatr keyword ([77d4aa2](https://github.com/Alwatr/eslib/commit/77d4aa2105ad47515c3eee251fd6b8c281d0d1fc))
359
-
360
- # [0.5.0](https://github.com/Alwatr/eslib/compare/v0.4.0...v0.5.0) (2022-03-11)
361
-
362
- ### Performance Improvements
363
-
364
- - **logger:** refactor making logger object ([bc38018](https://github.com/Alwatr/eslib/commit/bc38018758540130df2f46c44521aea0a867bbe8))
365
-
366
- # [0.4.0](https://github.com/Alwatr/eslib/compare/v0.3.0...v0.4.0) (2022-03-11)
367
-
368
- ### Bug Fixes
369
-
370
- - **logger:** types missing ([712363d](https://github.com/Alwatr/eslib/commit/712363d3cf77a712f8c801c4dc9d06d256dfc0e6))
371
-
372
- ### Features
373
-
374
- - **logger:** add logProperty, logMethodFull ([8b0317d](https://github.com/Alwatr/eslib/commit/8b0317db88ed73604a27935a3a30cd5c31cb0804))
375
- - **logger:** complete refactor the logger with new API and fix show correct line number ([7efe8cf](https://github.com/Alwatr/eslib/commit/7efe8cf0f566e148406f38fdd60fa3d747c9bc51))
376
-
377
- # [0.3.0](https://github.com/Alwatr/eslib/compare/v0.2.1...v0.3.0) (2022-03-06)
378
-
379
- **Note:** Version bump only for package @alwatr/logger
380
-
381
- ## [0.2.1](https://github.com/Alwatr/eslib/compare/v0.2.0...v0.2.1) (2022-03-05)
382
-
383
- ### Bug Fixes
384
-
385
- - **logger:** alwatrRegisteredList name ([ff59133](https://github.com/Alwatr/eslib/commit/ff5913321c4eafa1ce53fdacebf8fb4f23bfe430))
386
-
387
- # [0.2.0](https://github.com/Alwatr/eslib/compare/v0.1.2...v0.2.0) (2022-03-05)
388
-
389
- **Note:** Version bump only for package @alwatr/logger
390
-
391
- ## [0.1.2](https://github.com/Alwatr/eslib/compare/v0.1.1...v0.1.2) (2022-03-03)
392
-
393
- **Note:** Version bump only for package @alwatr/logger
394
-
395
- ## [0.1.1](https://github.com/Alwatr/eslib/compare/v0.1.0...v0.1.1) (2022-03-03)
396
-
397
- ### Bug Fixes
398
-
399
- - **packages:** add publish config to public ([9cb3710](https://github.com/Alwatr/eslib/commit/9cb37106b5a35d24d5195ff54232e5769ccc034e))
400
-
401
- # 0.1.0 (2022-03-02)
402
-
403
- ### Bug Fixes
404
-
405
- - **logger:** fix debug scope ([be62f14](https://github.com/Alwatr/eslib/commit/be62f142cbe3fe4d328e3fd9941ea7c2d640a23f))
406
- - **logger:** fix logger debug scope ([e734d21](https://github.com/Alwatr/eslib/commit/e734d218db888ecec33a03dc805b98dd75543efd))
407
- - tsconfig issues ([159adeb](https://github.com/Alwatr/eslib/commit/159adeb72de4626dc16f6657765605b0a2ddccb1))
408
-
409
- ### Features
410
-
411
- - **logger:** debug scope ([6e4190d](https://github.com/Alwatr/eslib/commit/6e4190dc9dafc28e3a7a481aa43622a23527993c))
412
- - **logger:** debug scope logger package ([1a4baeb](https://github.com/Alwatr/eslib/commit/1a4baeb7a253ba66563dbcf06079242dabb9f246))
413
- - **logger:** alwatr logger package ([711268e](https://github.com/Alwatr/eslib/commit/711268e17dea8ada9c901ef1e9d605b3212abd97))
414
- - **logger:** alwatr meta structure ([feade73](https://github.com/Alwatr/eslib/commit/feade735a6f141db77b81d7791d8872d45c8bf7e))
21
+ * **logger:** define packages removed and must use @alwatr/dedupe instead
22
+ * **logger:** use DEBUG in cli and debug in browser
package/README.md CHANGED
@@ -1,11 +1,11 @@
1
- # Alwatr Logger - `@alwatr/logger`
1
+ # Logger
2
2
 
3
3
  Fancy colorful console debugger with custom scope written in tiny TypeScript, ES module.
4
4
 
5
5
  ## Example usage
6
6
 
7
7
  ```ts
8
- import {createLogger} from 'https://esm.run/@alwatr/logger';
8
+ import {createLogger} from '@alwatr/logger';
9
9
 
10
10
  const logger = createLogger('demo');
11
11
 
@@ -14,13 +14,22 @@ function sayHello(name: string) {
14
14
  }
15
15
  ```
16
16
 
17
- ### Debug/Develope Mode (DEV_MODE)
17
+ ### Debug/Develope Mode (DEBUG_MODE)
18
18
 
19
- Many of the methods in the logger are no-ops when the debug mode is off in the browser.
20
- Please remember to **reload** the window after changing the debug mode.
19
+ Many of the methods in the logger are no-ops when the debug mode is off. This is to prevent unnecessary performance impact in production.
20
+
21
+ #### Browser
21
22
 
22
23
  ```ts
23
- window.localStorage?.setItem('alwatrDebug', '1');
24
+ window.localStorage?.setItem('debug', '1');
25
+
26
+ // Please remember to **reload** the window after changing the debug mode.
24
27
  ```
25
28
 
26
29
  > Make sure the [log level](https://developer.chrome.com/docs/devtools/console/log/#browser) in set correctly.
30
+
31
+ #### CLI
32
+
33
+ ```sh
34
+ DEBUG=1 node index.js
35
+ ```
package/dist/main.cjs ADDED
@@ -0,0 +1,7 @@
1
+ /* @alwatr/logger v3.0.0 */
2
+ "use strict";var d=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var a=Object.getOwnPropertyNames;var C=Object.prototype.hasOwnProperty;var _=(e,o)=>{for(var n in o)d(e,n,{get:o[n],enumerable:!0})},x=(e,o,n,s)=>{if(o&&typeof o=="object"||typeof o=="function")for(let t of a(o))!C.call(e,t)&&t!==n&&d(e,t,{get:()=>o[t],enumerable:!(s=p(o,t))||s.enumerable});return e};var $=e=>x(d({},"__esModule",{value:!0}),e);var A={};_(A,{createLogger:()=>y,debugMode:()=>u});module.exports=$(A);var f=require("@alwatr/dedupe"),c=require("@alwatr/platform-info");(0,f.definePackage)("@alwatr/logger","3.0.0");var u=c.platformInfo.development||c.platformInfo.isCli?process.env.DEBUG!==void 0&&process.env.DEBUG!=="":typeof localStorage<"u"&&localStorage.getItem("debug")==="1",b=c.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"],i=0,h=()=>{let e=b[i];return i++,i>=b.length&&(i=0),e},r={scope:c.platformInfo.isCli?"\x1B[{{color}}m":"color: {{color}};",reset:c.platformInfo.isCli?"\x1B[0m":"color: inherit;"},l=c.platformInfo.isCli?"%s%s%s":"%c%s%c",m=e=>{e=e.trim();let o=e.charAt(0);return o!=="["&&o!=="{"&&o!=="<"&&(e="["+e+"]"),e},y=(e,o=u)=>{let n=h(),s=r.scope.replace("{{color}}",n);e=m(e);let t={banner:c.platformInfo.isCli?console.log.bind(console,`\x1B[1;37;45m {{{ %s }}} ${r.reset}`):console.log.bind(console,"%c%s","font-size: 2rem; background-color: #5858e8; color: #fff; padding: 1rem 4rem; border-radius: 0.5rem;"),accident:c.platformInfo.isCli?console.warn.bind(console,`${s}⚠️
3
+ %s\x1B[33m.%s() Accident \`%s\`!${r.reset}`,e):console.warn.bind(console,"%c%s%c.%s() Accident `%s`!",s,e,r.reset),error:c.platformInfo.isCli?console.error.bind(console,`${s}❌
4
+ %s\x1B[31m.%s() Error \`%s\`${r.reset}
5
+ `,e):console.error.bind(console,"%c%s%c.%s() Error `%s`\n",s,e,r.reset)};return o?{...t,logProperty:console.debug.bind(console,l+".%s = %o;",s,e,r.reset),logMethod:console.debug.bind(console,l+".%s();",s,e,r.reset),logModule:console.debug.bind(console,l+"/%s.js;",s,e,r.reset),logMethodArgs:console.debug.bind(console,l+".%s(%o);",s,e,r.reset),logMethodFull:console.debug.bind(console,l+".%s(%o) => %o",s,e,r.reset),logOther:console.debug.bind(console,l,s,e,r.reset),incident:c.platformInfo.isCli?console.log.bind(console,`${s}🚸
6
+ %s${r.reset}.%s() Incident \`%s\`!${r.reset}`,e):console.log.bind(console,"%c%s%c.%s() Incident `%s`!",s,e,"color: orange;"),time:g=>console.time(e+"."+g+" duration time"),timeEnd:g=>console.timeEnd(e+"."+g+" duration time")}:t};0&&(module.exports={createLogger,debugMode});
7
+ //# sourceMappingURL=main.cjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/main.ts"],
4
+ "sourcesContent": ["import {definePackage} from '@alwatr/dedupe';\nimport {platformInfo} from '@alwatr/platform-info';\n\nimport type {AlwatrLogger} from './type.js';\n\ndefinePackage('@alwatr/logger', __package_version__);\n\nexport const debugMode = platformInfo.development || platformInfo.isCli\n ? process.env.DEBUG !== undefined && process.env.DEBUG !== ''\n : typeof localStorage !== 'undefined' && localStorage.getItem('debug') === '1';\n\n/**\n * Color list storage for logger.\n */\nconst colorList = platformInfo.isCli\n ? ['0;36', '0;35', '0;34', '0;33', '0;32'] // red and white omitted\n : [\n '#35b997',\n '#f05561',\n '#ee224a',\n '#91c13e',\n '#22af4b',\n '#f0e995',\n '#0fe995',\n '#0f89ca',\n '#08b9a5',\n '#fee851',\n '#ee573d',\n '#f9df30',\n '#1da2dc',\n '#f05123',\n '#ee2524',\n ];\n\nlet _colorIndex = 0;\nconst _getNextColor = (): string => {\n const color = colorList[_colorIndex];\n _colorIndex++;\n if (_colorIndex >= colorList.length) {\n _colorIndex = 0;\n }\n return color;\n};\n\nconst _style = {\n scope: platformInfo.isCli ? '\\x1b[{{color}}m' : 'color: {{color}};',\n reset: platformInfo.isCli ? '\\x1b[0m' : 'color: inherit;',\n};\n\nconst _keySection = platformInfo.isCli ? '%s%s%s' : '%c%s%c';\n\nconst _sanitizeDomain = (domain: string): string => {\n domain = domain.trim();\n const first = domain.charAt(0);\n if (first !== '[' && first !== '{' && first !== '<') {\n domain = '[' + domain + ']';\n }\n return domain;\n};\n\n/**\n * Create a logger function for fancy console debug with custom scope.\n *\n * - **color** is optional and automatically select from internal fancy color list.\n * - **debug** is optional and automatically detect from localStorage `ALWATR_DEBUG` item or `process.env.ALWATR_DEBUG`\n *\n * Example:\n *\n * ```ts\n * import {createLogger} from 'https://esm.run/@alwatr/logger';\n * const logger = createLogger('logger/demo');\n * ```\n */\nexport const createLogger = (domain: string, debugMode_ = debugMode): AlwatrLogger => {\n const color = _getNextColor();\n const styleScope = _style.scope.replace('{{color}}', color);\n domain = _sanitizeDomain(domain);\n\n /**\n * Required logger object, accident, error always reported even when the devMode is false.\n */\n const requiredItems: AlwatrLogger = {\n 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}`, domain)\n : console.warn.bind(console, '%c%s%c.%s() Accident `%s`!', styleScope, domain, _style.reset),\n\n error: platformInfo.isCli\n ? console.error.bind(console, `${styleScope}❌\\n%s\\x1b[31m.%s() Error \\`%s\\`${_style.reset}\\n`, domain)\n : console.error.bind(console, '%c%s%c.%s() Error `%s`\\n', styleScope, domain, _style.reset),\n };\n\n if (!debugMode_) {\n return requiredItems;\n }\n // else\n return {\n ...requiredItems,\n\n logProperty: console.debug.bind(console, _keySection + '.%s = %o;', styleScope, domain, _style.reset),\n\n logMethod: console.debug.bind(console, _keySection + '.%s();', styleScope, domain, _style.reset),\n\n logModule: console.debug.bind(console, _keySection + '/%s.js;', styleScope, domain, _style.reset),\n\n logMethodArgs: console.debug.bind(console, _keySection + '.%s(%o);', styleScope, domain, _style.reset),\n\n logMethodFull: console.debug.bind(console, _keySection + '.%s(%o) => %o', styleScope, domain, _style.reset),\n\n logOther: console.debug.bind(console, _keySection, styleScope, domain, _style.reset),\n\n incident: platformInfo.isCli\n ? console.log.bind(console, `${styleScope}🚸\\n%s${_style.reset}.%s() Incident \\`%s\\`!${_style.reset}`, domain)\n : console.log.bind(console, '%c%s%c.%s() Incident `%s`!', styleScope, domain, 'color: orange;'),\n\n time: (label: string) => console.time(domain + '.' + label + ' duration time'),\n timeEnd: (label: string) => console.timeEnd(domain + '.' + label + ' duration time'),\n } as const;\n};\n"],
5
+ "mappings": ";yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,kBAAAE,EAAA,cAAAC,IAAA,eAAAC,EAAAJ,GAAA,IAAAK,EAA4B,0BAC5BC,EAA2B,oCAI3B,iBAAc,iBAAkB,OAAmB,EAE5C,IAAMH,EAAY,eAAa,aAAe,eAAa,MAC9D,QAAQ,IAAI,QAAU,QAAa,QAAQ,IAAI,QAAU,GACzD,OAAO,aAAiB,KAAe,aAAa,QAAQ,OAAO,IAAM,IAKvEI,EAAY,eAAa,MAC3B,CAAC,OAAQ,OAAQ,OAAQ,OAAQ,MAAM,EACvC,CACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,SACF,EAEEC,EAAc,EACZC,EAAgB,IAAc,CAClC,IAAMC,EA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QAASC,EAAc,UAAWK,EAAYH,EAAQH,EAAO,KAAK,EAEhG,cAAe,QAAQ,MAAM,KAAK,QAASC,EAAc,WAAYK,EAAYH,EAAQH,EAAO,KAAK,EAErG,cAAe,QAAQ,MAAM,KAAK,QAASC,EAAc,gBAAiBK,EAAYH,EAAQH,EAAO,KAAK,EAE1G,SAAU,QAAQ,MAAM,KAAK,QAASC,EAAaK,EAAYH,EAAQH,EAAO,KAAK,EAEnF,SAAU,eAAa,MACnB,QAAQ,IAAI,KAAK,QAAS,GAAGM,CAAU;AAAA,IAASN,EAAO,KAAK,yBAAyBA,EAAO,KAAK,GAAIG,CAAM,EAC3G,QAAQ,IAAI,KAAK,QAAS,6BAA8BG,EAAYH,EAAQ,gBAAgB,EAEhG,KAAOK,GAAkB,QAAQ,KAAKL,EAAS,IAAMK,EAAQ,gBAAgB,EAC7E,QAAUA,GAAkB,QAAQ,QAAQL,EAAS,IAAMK,EAAQ,gBAAgB,CACrF,EAxBSD,CAyBX",
6
+ "names": ["main_exports", "__export", "createLogger", "debugMode", "__toCommonJS", "import_dedupe", "import_platform_info", "colorList", "_colorIndex", "_getNextColor", "color", "_style", "_keySection", "_sanitizeDomain", "domain", "first", "debugMode_", "styleScope", "requiredItems", "label"]
7
+ }
@@ -1,4 +1,5 @@
1
1
  import type { AlwatrLogger } from './type.js';
2
+ export declare const debugMode: boolean;
2
3
  /**
3
4
  * Create a logger function for fancy console debug with custom scope.
4
5
  *
@@ -12,5 +13,5 @@ import type { AlwatrLogger } from './type.js';
12
13
  * const logger = createLogger('logger/demo');
13
14
  * ```
14
15
  */
15
- export declare const createLogger: (domain: string, devMode?: boolean) => AlwatrLogger;
16
- //# sourceMappingURL=logger.d.ts.map
16
+ export declare const createLogger: (domain: string, debugMode_?: boolean) => AlwatrLogger;
17
+ //# sourceMappingURL=main.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,WAAW,CAAC;AAI5C,eAAO,MAAM,SAAS,SAE0D,CAAC;AAmDjF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,YAAY,WAAY,MAAM,2BAA2B,YAoDrE,CAAC"}
package/dist/main.mjs ADDED
@@ -0,0 +1,7 @@
1
+ /* @alwatr/logger v3.0.0 */
2
+ import{definePackage as b}from"@alwatr/dedupe";import{platformInfo as r}from"@alwatr/platform-info";b("@alwatr/logger","3.0.0");var f=r.development||r.isCli?process.env.DEBUG!==void 0&&process.env.DEBUG!=="":typeof localStorage<"u"&&localStorage.getItem("debug")==="1",g=r.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"],n=0,u=()=>{let e=g[n];return n++,n>=g.length&&(n=0),e},o={scope:r.isCli?"\x1B[{{color}}m":"color: {{color}};",reset:r.isCli?"\x1B[0m":"color: inherit;"},c=r.isCli?"%s%s%s":"%c%s%c",p=e=>{e=e.trim();let t=e.charAt(0);return t!=="["&&t!=="{"&&t!=="<"&&(e="["+e+"]"),e},_=(e,t=f)=>{let d=u(),s=o.scope.replace("{{color}}",d);e=p(e);let i={banner:r.isCli?console.log.bind(console,`\x1B[1;37;45m {{{ %s }}} ${o.reset}`):console.log.bind(console,"%c%s","font-size: 2rem; background-color: #5858e8; color: #fff; padding: 1rem 4rem; border-radius: 0.5rem;"),accident:r.isCli?console.warn.bind(console,`${s}⚠️
3
+ %s\x1B[33m.%s() Accident \`%s\`!${o.reset}`,e):console.warn.bind(console,"%c%s%c.%s() Accident `%s`!",s,e,o.reset),error:r.isCli?console.error.bind(console,`${s}❌
4
+ %s\x1B[31m.%s() Error \`%s\`${o.reset}
5
+ `,e):console.error.bind(console,"%c%s%c.%s() Error `%s`\n",s,e,o.reset)};return t?{...i,logProperty:console.debug.bind(console,c+".%s = %o;",s,e,o.reset),logMethod:console.debug.bind(console,c+".%s();",s,e,o.reset),logModule:console.debug.bind(console,c+"/%s.js;",s,e,o.reset),logMethodArgs:console.debug.bind(console,c+".%s(%o);",s,e,o.reset),logMethodFull:console.debug.bind(console,c+".%s(%o) => %o",s,e,o.reset),logOther:console.debug.bind(console,c,s,e,o.reset),incident:r.isCli?console.log.bind(console,`${s}🚸
6
+ %s${o.reset}.%s() Incident \`%s\`!${o.reset}`,e):console.log.bind(console,"%c%s%c.%s() Incident `%s`!",s,e,"color: orange;"),time:l=>console.time(e+"."+l+" duration time"),timeEnd:l=>console.timeEnd(e+"."+l+" duration time")}:i};export{_ as createLogger,f as debugMode};
7
+ //# sourceMappingURL=main.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/main.ts"],
4
+ "sourcesContent": ["import {definePackage} from '@alwatr/dedupe';\nimport {platformInfo} from '@alwatr/platform-info';\n\nimport type {AlwatrLogger} from './type.js';\n\ndefinePackage('@alwatr/logger', __package_version__);\n\nexport const debugMode = platformInfo.development || platformInfo.isCli\n ? process.env.DEBUG !== undefined && process.env.DEBUG !== ''\n : typeof localStorage !== 'undefined' && localStorage.getItem('debug') === '1';\n\n/**\n * Color list storage for logger.\n */\nconst colorList = platformInfo.isCli\n ? ['0;36', '0;35', '0;34', '0;33', '0;32'] // red and white omitted\n : [\n '#35b997',\n '#f05561',\n '#ee224a',\n '#91c13e',\n '#22af4b',\n '#f0e995',\n '#0fe995',\n '#0f89ca',\n '#08b9a5',\n '#fee851',\n '#ee573d',\n '#f9df30',\n '#1da2dc',\n '#f05123',\n '#ee2524',\n ];\n\nlet _colorIndex = 0;\nconst _getNextColor = (): string => {\n const color = colorList[_colorIndex];\n _colorIndex++;\n if (_colorIndex >= colorList.length) {\n _colorIndex = 0;\n }\n return color;\n};\n\nconst _style = {\n scope: platformInfo.isCli ? '\\x1b[{{color}}m' : 'color: {{color}};',\n reset: platformInfo.isCli ? '\\x1b[0m' : 'color: inherit;',\n};\n\nconst _keySection = platformInfo.isCli ? '%s%s%s' : '%c%s%c';\n\nconst _sanitizeDomain = (domain: string): string => {\n domain = domain.trim();\n const first = domain.charAt(0);\n if (first !== '[' && first !== '{' && first !== '<') {\n domain = '[' + domain + ']';\n }\n return domain;\n};\n\n/**\n * Create a logger function for fancy console debug with custom scope.\n *\n * - **color** is optional and automatically select from internal fancy color list.\n * - **debug** is optional and automatically detect from localStorage `ALWATR_DEBUG` item or `process.env.ALWATR_DEBUG`\n *\n * Example:\n *\n * ```ts\n * import {createLogger} from 'https://esm.run/@alwatr/logger';\n * const logger = createLogger('logger/demo');\n * ```\n */\nexport const createLogger = (domain: string, debugMode_ = debugMode): AlwatrLogger => {\n const color = _getNextColor();\n const styleScope = _style.scope.replace('{{color}}', color);\n domain = _sanitizeDomain(domain);\n\n /**\n * Required logger object, accident, error always reported even when the devMode is false.\n */\n const requiredItems: AlwatrLogger = {\n 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}`, domain)\n : console.warn.bind(console, '%c%s%c.%s() Accident `%s`!', styleScope, domain, _style.reset),\n\n error: platformInfo.isCli\n ? console.error.bind(console, `${styleScope}❌\\n%s\\x1b[31m.%s() Error \\`%s\\`${_style.reset}\\n`, domain)\n : console.error.bind(console, '%c%s%c.%s() Error `%s`\\n', styleScope, domain, _style.reset),\n };\n\n if (!debugMode_) {\n return requiredItems;\n }\n // else\n return {\n ...requiredItems,\n\n logProperty: console.debug.bind(console, _keySection + '.%s = %o;', styleScope, domain, _style.reset),\n\n logMethod: console.debug.bind(console, _keySection + '.%s();', styleScope, domain, _style.reset),\n\n logModule: console.debug.bind(console, _keySection + '/%s.js;', styleScope, domain, _style.reset),\n\n logMethodArgs: console.debug.bind(console, _keySection + '.%s(%o);', styleScope, domain, _style.reset),\n\n logMethodFull: console.debug.bind(console, _keySection + '.%s(%o) => %o', styleScope, domain, _style.reset),\n\n logOther: console.debug.bind(console, _keySection, styleScope, domain, _style.reset),\n\n incident: platformInfo.isCli\n ? console.log.bind(console, `${styleScope}🚸\\n%s${_style.reset}.%s() Incident \\`%s\\`!${_style.reset}`, domain)\n : console.log.bind(console, '%c%s%c.%s() Incident `%s`!', styleScope, domain, 'color: orange;'),\n\n time: (label: string) => console.time(domain + '.' + label + ' duration time'),\n timeEnd: (label: string) => console.timeEnd(domain + '.' + label + ' duration time'),\n } as const;\n};\n"],
5
+ "mappings": ";AAAA,OAAQ,iBAAAA,MAAoB,iBAC5B,OAAQ,gBAAAC,MAAmB,wBAI3BD,EAAc,iBAAkB,OAAmB,EAE5C,IAAME,EAAYD,EAAa,aAAeA,EAAa,MAC9D,QAAQ,IAAI,QAAU,QAAa,QAAQ,IAAI,QAAU,GACzD,OAAO,aAAiB,KAAe,aAAa,QAAQ,OAAO,IAAM,IAKvEE,EAAYF,EAAa,MAC3B,CAAC,OAAQ,OAAQ,OAAQ,OAAQ,MAAM,EACvC,CACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,SACF,EAEEG,EAAc,EACZC,EAAgB,IAAc,CAClC,IAAMC,EAAQH,EAAUC,CAAW,EACnC,OAAAA,IACIA,GAAeD,EAAU,SAC3BC,EAAc,GAETE,CACT,EAEMC,EAAS,CACb,MAAON,EAAa,MAAQ,kBAAoB,oBAChD,MAAOA,EAAa,MAAQ,UAAY,iBAC1C,EAEMO,EAAcP,EAAa,MAAQ,SAAW,SAE9CQ,EAAmBC,GAA2B,CAClDA,EAASA,EAAO,KAAK,EACrB,IAAMC,EAAQD,EAAO,OAAO,CAAC,EAC7B,OAAIC,IAAU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Aa,MACnB,QAAQ,IAAI,KAAK,QAAS,GAAGa,CAAU;AAAA,IAASP,EAAO,KAAK,yBAAyBA,EAAO,KAAK,GAAIG,CAAM,EAC3G,QAAQ,IAAI,KAAK,QAAS,6BAA8BI,EAAYJ,EAAQ,gBAAgB,EAEhG,KAAOM,GAAkB,QAAQ,KAAKN,EAAS,IAAMM,EAAQ,gBAAgB,EAC7E,QAAUA,GAAkB,QAAQ,QAAQN,EAAS,IAAMM,EAAQ,gBAAgB,CACrF,EAxBSD,CAyBX",
6
+ "names": ["definePackage", "platformInfo", "debugMode", "colorList", "_colorIndex", "_getNextColor", "color", "_style", "_keySection", "_sanitizeDomain", "domain", "first", "createLogger", "debugMode_", "styleScope", "requiredItems", "label"]
7
+ }
@@ -1,12 +1,4 @@
1
1
  export interface AlwatrLogger {
2
- /**
3
- * Debug state for current scope base on localStorage `ALWATR_LOG` pattern.
4
- */
5
- readonly devMode: boolean;
6
- /**
7
- * Domain scope defined for this logger.
8
- */
9
- readonly domain: string;
10
2
  /**
11
3
  * `console.debug` property change.
12
4
  *
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../src/type.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B;;;;;;;;OAQG;IACH,WAAW,CAAC,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;IAErD;;;;;;;;OAQG;IACH,SAAS,CAAC,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAE/B;;;;;;;;;;OAUG;IACH,SAAS,CAAC,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAEjC;;;;;;;;;;OAUG;IACH,aAAa,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,IAAI,CAAC;IAEpD;;;;;;;;;;;;OAYG;IACH,aAAa,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,GAAG,IAAI,CAAC;IAErE;;;;;;;;;OASG;IACH,QAAQ,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAElE;;;;;;;;OAQG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAEjE;;;;;;;;;;;;;OAaG;IACH,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAE9D;;;;;;;;OAQG;IACH,QAAQ,CAAC,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAEpC;;;;;;;;OAQG;IACH,IAAI,CAAC,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAE3B;;;;;;;;OAQG;IACH,OAAO,CAAC,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAE9B;;;;;;;;OAQG;IACH,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B"}
package/package.json CHANGED
@@ -1,38 +1,80 @@
1
1
  {
2
2
  "name": "@alwatr/logger",
3
- "version": "2.4.1",
3
+ "version": "3.0.0",
4
4
  "description": "Fancy colorful console debugger with custom scope written in tiny TypeScript, ES module.",
5
+ "author": "S. Ali Mihandoost <ali.mihandoost@gmail.com>",
5
6
  "keywords": [
6
- "log",
7
7
  "logger",
8
+ "log",
8
9
  "console",
9
10
  "debug",
11
+ "cross-platform",
12
+ "ECMAScript",
10
13
  "typescript",
14
+ "javascript",
15
+ "node",
16
+ "nodejs",
11
17
  "esm",
18
+ "module",
19
+ "utility",
20
+ "util",
21
+ "utils",
22
+ "nanolib",
12
23
  "alwatr"
13
24
  ],
14
- "main": "index.js",
15
25
  "type": "module",
16
- "types": "index.d.ts",
17
- "author": "S. Ali Mihandoost <ali.mihandoost@gmail.com> (https://ali.mihandoost.com)",
26
+ "main": "./dist/main.cjs",
27
+ "module": "./dist/main.mjs",
28
+ "types": "./dist/main.d.ts",
29
+ "exports": {
30
+ ".": {
31
+ "import": "./dist/main.mjs",
32
+ "require": "./dist/main.cjs",
33
+ "types": "./dist/main.d.ts"
34
+ }
35
+ },
18
36
  "license": "MIT",
19
37
  "files": [
20
- "**/*.{d.ts.map,d.ts,js.map,js,html,md}"
38
+ "**/*.{js,mjs,cjs,map,d.ts,html,md}",
39
+ "!demo/**/*"
21
40
  ],
22
41
  "publishConfig": {
23
42
  "access": "public"
24
43
  },
25
44
  "repository": {
26
45
  "type": "git",
27
- "url": "https://github.com/Alwatr/alwatr-es-sdk",
46
+ "url": "https://github.com/Alwatr/nanolib",
28
47
  "directory": "packages/logger"
29
48
  },
30
- "homepage": "https://github.com/Alwatr/alwatr-es-sdk/tree/next/packages/logger#readme",
49
+ "homepage": "https://github.com/Alwatr/nanolib/tree/next/packages/logger#readme",
31
50
  "bugs": {
32
- "url": "https://github.com/Alwatr/alwatr-es-sdk/issues"
51
+ "url": "https://github.com/Alwatr/nanolib/issues"
52
+ },
53
+ "prettier": "@alwatr/prettier-config",
54
+ "scripts": {
55
+ "b": "yarn run build",
56
+ "w": "yarn run watch",
57
+ "c": "yarn run clean",
58
+ "cb": "yarn run clean && yarn run build",
59
+ "d": "yarn run build:es && yarn node --enable-source-maps --trace-warnings",
60
+ "build": "yarn run build:ts & yarn run build:es",
61
+ "build:es": "nano-build --preset=module",
62
+ "build:ts": "tsc --build",
63
+ "watch": "yarn run watch:ts & yarn run watch:es",
64
+ "watch:es": "yarn run build:es --watch",
65
+ "watch:ts": "yarn run build:ts --watch --preserveWatchOutput",
66
+ "clean": "rm -rfv dist *.tsbuildinfo"
67
+ },
68
+ "dependencies": {
69
+ "@alwatr/dedupe": "^0.1.0",
70
+ "@alwatr/platform-info": "^1.1.0"
33
71
  },
34
72
  "devDependencies": {
35
- "@types/node": "^20.10.5"
73
+ "@alwatr/nano-build": "^1.3.0",
74
+ "@alwatr/prettier-config": "^1.0.4",
75
+ "@alwatr/tsconfig-base": "^1.1.0",
76
+ "@types/node": "^20.10.6",
77
+ "typescript": "^5.3.3"
36
78
  },
37
- "gitHead": "8df92c67b69527b5474e8741a8633e0e67b5d09a"
79
+ "gitHead": "f33492f47adda814385e51f38be86eeef9629e62"
38
80
  }
@@ -1,3 +0,0 @@
1
- import './global.js';
2
- export declare const definePackage: (packageName: string, version: string) => void;
3
- //# sourceMappingURL=define-package.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"define-package.d.ts","sourceRoot":"","sources":["src/define-package.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAC;AAcrB,eAAO,MAAM,aAAa,gBAAiB,MAAM,WAAW,MAAM,SAoBjE,CAAC"}
package/define-package.js DELETED
@@ -1,30 +0,0 @@
1
- import './global.js';
2
- import { createLogger } from './logger.js';
3
- Alwatr.packages ?? (Alwatr.packages = {});
4
- const logger = createLogger('logger');
5
- setTimeout(() => {
6
- if ('registeredList' in Alwatr) {
7
- logger.accident?.('define-package', 'duplicate_old_package_defined', Alwatr.registeredList);
8
- throw new Error('duplicate_old_package_defined');
9
- }
10
- }, 2000);
11
- export const definePackage = (packageName, version) => {
12
- logger.logMethodArgs?.('define-package', { packageName, version });
13
- if (packageName in Alwatr.packages) {
14
- logger.accident('define-package', 'duplicate_package_defined', {
15
- packageName,
16
- new: version,
17
- old: Alwatr.packages[packageName],
18
- });
19
- throw new Error('duplicate_package_defined');
20
- }
21
- if (packageName.indexOf('@alwatr') !== -1) {
22
- logger.accident('define-package', 'package_name_starts_with_alwatr_scope', {
23
- packageName,
24
- });
25
- throw new Error('package_name_starts_with_alwatr_scope');
26
- }
27
- Alwatr.packages[packageName] = version;
28
- };
29
- definePackage('logger', '2.x');
30
- //# sourceMappingURL=define-package.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,CAAC;IAED,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAC,GAAG,OAAO,CAAC;AACzC,CAAC,CAAC;AAEF,aAAa,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC","sourcesContent":["import './global.js';\nimport {createLogger} from './logger.js';\n\nAlwatr.packages ??= {};\n\nconst logger = createLogger('logger');\n\nsetTimeout(() => {\n if ('registeredList' in Alwatr) {\n logger.accident?.('define-package', 'duplicate_old_package_defined', Alwatr.registeredList);\n throw new Error('duplicate_old_package_defined');\n }\n}, 2000);\n\nexport const definePackage = (packageName: string, version: string) => {\n logger.logMethodArgs?.('define-package', {packageName, version});\n\n if (packageName in Alwatr.packages) {\n logger.accident('define-package', 'duplicate_package_defined', {\n packageName,\n new: version,\n old: Alwatr.packages[packageName],\n });\n throw new Error('duplicate_package_defined');\n }\n\n if (packageName.indexOf('@alwatr') !== -1) {\n logger.accident('define-package', 'package_name_starts_with_alwatr_scope', {\n packageName,\n });\n throw new Error('package_name_starts_with_alwatr_scope');\n }\n\n Alwatr.packages[packageName] = version;\n};\n\ndefinePackage('logger', '2.x');\n"]}
package/global.d.ts DELETED
@@ -1,10 +0,0 @@
1
- export interface GlobalAlwatr {
2
- packages: Record<string, string>;
3
- }
4
- declare global {
5
- var Alwatr: GlobalAlwatr;
6
- }
7
- export declare const globalScope: typeof globalThis;
8
- export declare const NODE_MODE: boolean;
9
- export declare const DEV_MODE: boolean;
10
- //# sourceMappingURL=global.d.ts.map
package/global.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"global.d.ts","sourceRoot":"","sources":["src/global.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC;AAED,OAAO,CAAC,MAAM,CAAC;IAEb,IAAI,MAAM,EAAE,YAAY,CAAC;CAC1B;AAED,eAAO,MAAM,WAAW,mBAIlB,CAAC;AAIP,eAAO,MAAM,SAAS,SAAiC,CAAC;AACxD,eAAO,MAAM,QAAQ,SAEuC,CAAC"}
package/global.js DELETED
@@ -1,10 +0,0 @@
1
- export const globalScope = (typeof globalThis === 'object' && globalThis) ||
2
- ('object' === typeof window && window) ||
3
- ('object' === typeof global && global) ||
4
- self;
5
- globalScope.Alwatr ?? (globalScope.Alwatr = { packages: {} });
6
- export const NODE_MODE = typeof process !== 'undefined';
7
- export const DEV_MODE = NODE_MODE
8
- ? process.env.ALWATR_DEBUG === '1'
9
- : globalScope.localStorage?.getItem('alwatrDebug') === '1';
10
- //# sourceMappingURL=global.js.map
package/global.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"global.js","sourceRoot":"","sources":["src/global.ts"],"names":[],"mappings":"AASA,MAAM,CAAC,MAAM,WAAW,GACtB,CAAC,OAAO,UAAU,KAAK,QAAQ,IAAI,UAAU,CAAC;IAC9C,CAAC,QAAQ,KAAK,OAAO,MAAM,IAAI,MAAM,CAAC;IACtC,CAAC,QAAQ,KAAK,OAAO,MAAM,IAAI,MAAM,CAAC;IACtC,IAAI,CAAC;AAEP,WAAW,CAAC,MAAM,KAAlB,WAAW,CAAC,MAAM,GAAK,EAAC,QAAQ,EAAE,EAAE,EAAC,EAAC;AAEtC,MAAM,CAAC,MAAM,SAAS,GAAG,OAAO,OAAO,KAAK,WAAW,CAAC;AACxD,MAAM,CAAC,MAAM,QAAQ,GAAG,SAAS;IAC/B,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,YAAY,KAAK,GAAG;IAClC,CAAC,CAAC,WAAW,CAAC,YAAY,EAAE,OAAO,CAAC,aAAa,CAAC,KAAK,GAAG,CAAC","sourcesContent":["export interface GlobalAlwatr {\n packages: Record<string, string>;\n}\n\ndeclare global {\n // eslint-disable-next-line no-var\n var Alwatr: GlobalAlwatr;\n}\n\nexport const globalScope =\n (typeof globalThis === 'object' && globalThis) ||\n ('object' === typeof window && window) ||\n ('object' === typeof global && global) ||\n self;\n\nglobalScope.Alwatr ??= {packages: {}};\n\nexport const NODE_MODE = typeof process !== 'undefined';\nexport const DEV_MODE = NODE_MODE\n ? process.env.ALWATR_DEBUG === '1'\n : globalScope.localStorage?.getItem('alwatrDebug') === '1';\n"]}
package/index.d.ts DELETED
@@ -1,5 +0,0 @@
1
- export * from './global.js';
2
- export * from './logger.js';
3
- export * from './define-package.js';
4
- export type * from './type.js';
5
- //# sourceMappingURL=index.d.ts.map
package/index.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,mBAAmB,WAAW,CAAC"}
package/index.js DELETED
@@ -1,4 +0,0 @@
1
- export * from './global.js';
2
- export * from './logger.js';
3
- export * from './define-package.js';
4
- //# sourceMappingURL=index.js.map
package/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC","sourcesContent":["export * from './global.js';\nexport * from './logger.js';\nexport * from './define-package.js';\nexport type * from './type.js';\n"]}
package/logger.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["src/logger.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,WAAW,CAAC;AAmD5C;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,YAAY,WAAY,MAAM,wBAAuB,YAuDjE,CAAC"}
package/logger.js DELETED
@@ -1,98 +0,0 @@
1
- import { DEV_MODE, NODE_MODE } from './global.js';
2
- /**
3
- * Color list storage for logger.
4
- */
5
- const colorList = NODE_MODE
6
- ? ['0;36', '0;35', '0;34', '0;33', '0;32'] // red and white omitted
7
- : [
8
- '#35b997',
9
- '#f05561',
10
- '#ee224a',
11
- '#91c13e',
12
- '#22af4b',
13
- '#f0e995',
14
- '#0fe995',
15
- '#0f89ca',
16
- '#08b9a5',
17
- '#fee851',
18
- '#ee573d',
19
- '#f9df30',
20
- '#1da2dc',
21
- '#f05123',
22
- '#ee2524',
23
- ];
24
- let _colorIndex = 0;
25
- const _getNextColor = () => {
26
- const color = colorList[_colorIndex];
27
- _colorIndex++;
28
- if (_colorIndex >= colorList.length) {
29
- _colorIndex = 0;
30
- }
31
- return color;
32
- };
33
- const _style = {
34
- scope: NODE_MODE ? '\x1b[{{color}}m' : 'color: {{color}};',
35
- reset: NODE_MODE ? '\x1b[0m' : 'color: inherit;',
36
- };
37
- const _keySection = NODE_MODE ? '%s%s%s' : '%c%s%c';
38
- const _sanitizeDomain = (domain) => {
39
- domain = domain.trim();
40
- const first = domain.charAt(0);
41
- if (first !== '[' && first !== '{' && first !== '<') {
42
- domain = '[' + domain + ']';
43
- }
44
- return domain;
45
- };
46
- /**
47
- * Create a logger function for fancy console debug with custom scope.
48
- *
49
- * - **color** is optional and automatically select from internal fancy color list.
50
- * - **debug** is optional and automatically detect from localStorage `ALWATR_DEBUG` item or `process.env.ALWATR_DEBUG`
51
- *
52
- * Example:
53
- *
54
- * ```ts
55
- * import {createLogger} from 'https://esm.run/@alwatr/logger';
56
- * const logger = createLogger('logger/demo');
57
- * ```
58
- */
59
- export const createLogger = (domain, devMode = DEV_MODE) => {
60
- const color = _getNextColor();
61
- const styleScope = _style.scope.replace('{{color}}', color);
62
- domain = _sanitizeDomain(domain);
63
- /**
64
- * Required logger object, accident, error always reported even when the devMode is false.
65
- */
66
- const requiredItems = {
67
- devMode,
68
- domain,
69
- banner: NODE_MODE
70
- ? console.log.bind(console, `\x1b[1;37;45m\n\n %s${_style.reset}`)
71
- : console.log.bind(console, '%c%s', 'font-size: 2rem; background-color: #5858e8; color: #fff; padding: 1rem 4rem; border-radius: 0.5rem;'),
72
- accident: NODE_MODE
73
- ? console.warn.bind(console, `${styleScope}⚠️\n%s\x1b[33m.%s() Accident \`%s\`!${_style.reset}`, domain)
74
- : console.warn.bind(console, '%c%s%c.%s() Accident `%s`!', styleScope, domain, _style.reset),
75
- error: NODE_MODE
76
- ? console.error.bind(console, `${styleScope}❌\n%s\x1b[31m.%s() Error \`%s\`${_style.reset}\n`, domain)
77
- : console.error.bind(console, '%c%s%c.%s() Error `%s`\n', styleScope, domain, _style.reset),
78
- };
79
- if (!devMode) {
80
- return requiredItems;
81
- }
82
- // else
83
- return {
84
- ...requiredItems,
85
- logProperty: console.debug.bind(console, _keySection + '.%s = %o;', styleScope, domain, _style.reset),
86
- logMethod: console.debug.bind(console, _keySection + '.%s();', styleScope, domain, _style.reset),
87
- logModule: console.debug.bind(console, _keySection + '/%s.js;', styleScope, domain, _style.reset),
88
- logMethodArgs: console.debug.bind(console, _keySection + '.%s(%o);', styleScope, domain, _style.reset),
89
- logMethodFull: console.debug.bind(console, _keySection + '.%s(%o) => %o', styleScope, domain, _style.reset),
90
- logOther: console.debug.bind(console, _keySection, styleScope, domain, _style.reset),
91
- incident: NODE_MODE
92
- ? console.log.bind(console, `${styleScope}🚸\n%s${_style.reset}.%s() Incident \`%s\`!${_style.reset}`, domain)
93
- : console.log.bind(console, '%c%s%c.%s() Incident `%s`!', styleScope, domain, 'color: orange;'),
94
- time: (label) => console.time(domain + '.' + label + ' duration time'),
95
- timeEnd: (label) => console.timeEnd(domain + '.' + label + ' duration time'),
96
- };
97
- };
98
- //# sourceMappingURL=logger.js.map
package/logger.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"logger.js","sourceRoot":"","sources":["src/logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAE,SAAS,EAAC,MAAM,aAAa,CAAC;AAIhD;;GAEG;AACH,MAAM,SAAS,GAAG,SAAS;IACzB,CAAC,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,wBA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O,CAAC,MAAM,GAAG,GAAG,GAAG,KAAK,GAAG,gBAAgB,CAAC;KAC5E,CAAC;AACb,CAAC,CAAC","sourcesContent":["import {DEV_MODE, NODE_MODE} from './global.js';\n\nimport type {AlwatrLogger} from './type.js';\n\n/**\n * Color list storage for logger.\n */\nconst colorList = NODE_MODE\n ? ['0;36', '0;35', '0;34', '0;33', '0;32'] // red and white omitted\n : [\n '#35b997',\n '#f05561',\n '#ee224a',\n '#91c13e',\n '#22af4b',\n '#f0e995',\n '#0fe995',\n '#0f89ca',\n '#08b9a5',\n '#fee851',\n '#ee573d',\n '#f9df30',\n '#1da2dc',\n '#f05123',\n '#ee2524',\n ];\n\nlet _colorIndex = 0;\nconst _getNextColor = (): string => {\n const color = colorList[_colorIndex];\n _colorIndex++;\n if (_colorIndex >= colorList.length) {\n _colorIndex = 0;\n }\n return color;\n};\n\nconst _style = {\n scope: NODE_MODE ? '\\x1b[{{color}}m' : 'color: {{color}};',\n reset: NODE_MODE ? '\\x1b[0m' : 'color: inherit;',\n};\n\nconst _keySection = NODE_MODE ? '%s%s%s' : '%c%s%c';\n\nconst _sanitizeDomain = (domain: string): string => {\n domain = domain.trim();\n const first = domain.charAt(0);\n if (first !== '[' && first !== '{' && first !== '<') {\n domain = '[' + domain + ']';\n }\n return domain;\n};\n\n/**\n * Create a logger function for fancy console debug with custom scope.\n *\n * - **color** is optional and automatically select from internal fancy color list.\n * - **debug** is optional and automatically detect from localStorage `ALWATR_DEBUG` item or `process.env.ALWATR_DEBUG`\n *\n * Example:\n *\n * ```ts\n * import {createLogger} from 'https://esm.run/@alwatr/logger';\n * const logger = createLogger('logger/demo');\n * ```\n */\nexport const createLogger = (domain: string, devMode = DEV_MODE): AlwatrLogger => {\n const color = _getNextColor();\n const styleScope = _style.scope.replace('{{color}}', color);\n domain = _sanitizeDomain(domain);\n\n /**\n * Required logger object, accident, error always reported even when the devMode is false.\n */\n const requiredItems: AlwatrLogger = {\n devMode,\n domain,\n\n banner: NODE_MODE\n ? console.log.bind(console, `\\x1b[1;37;45m\\n\\n %s${_style.reset}`)\n : console.log.bind(\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: NODE_MODE\n ? console.warn.bind(console, `${styleScope}⚠️\\n%s\\x1b[33m.%s() Accident \\`%s\\`!${_style.reset}`, domain)\n : console.warn.bind(console, '%c%s%c.%s() Accident `%s`!', styleScope, domain, _style.reset),\n\n error: NODE_MODE\n ? console.error.bind(console, `${styleScope}❌\\n%s\\x1b[31m.%s() Error \\`%s\\`${_style.reset}\\n`, domain)\n : console.error.bind(console, '%c%s%c.%s() Error `%s`\\n', styleScope, domain, _style.reset),\n };\n\n if (!devMode) {\n return requiredItems;\n }\n // else\n return {\n ...requiredItems,\n\n logProperty: console.debug.bind(console, _keySection + '.%s = %o;', styleScope, domain, _style.reset),\n\n logMethod: console.debug.bind(console, _keySection + '.%s();', styleScope, domain, _style.reset),\n\n logModule: console.debug.bind(console, _keySection + '/%s.js;', styleScope, domain, _style.reset),\n\n logMethodArgs: console.debug.bind(console, _keySection + '.%s(%o);', styleScope, domain, _style.reset),\n\n logMethodFull: console.debug.bind(console, _keySection + '.%s(%o) => %o', styleScope, domain, _style.reset),\n\n logOther: console.debug.bind(console, _keySection, styleScope, domain, _style.reset),\n\n incident: NODE_MODE\n ? console.log.bind(console, `${styleScope}🚸\\n%s${_style.reset}.%s() Incident \\`%s\\`!${_style.reset}`, domain)\n : console.log.bind(console, '%c%s%c.%s() Incident `%s`!', styleScope, domain, 'color: orange;'),\n\n time: (label: string) => console.time(domain + '.' + label + ' duration time'),\n timeEnd: (label: string) => console.timeEnd(domain + '.' + label + ' duration time'),\n } as const;\n};\n"]}
package/type.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["src/type.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,QA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C,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAE9B;;;;;;;;OAQG;IACH,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B"}
package/type.js DELETED
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=type.js.map
package/type.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"type.js","sourceRoot":"","sources":["src/type.ts"],"names":[],"mappings":"","sourcesContent":["export interface AlwatrLogger {\n /**\n * Debug state for current scope base on localStorage `ALWATR_LOG` pattern.\n */\n readonly devMode: boolean;\n\n /**\n * Domain scope defined for this logger.\n */\n readonly domain: string;\n\n /**\n * `console.debug` property change.\n *\n * Example:\n *\n * ```ts\n * logger.logProperty?.('name', 'ali');\n * ```\n */\n logProperty?(property: string, value: unknown): void;\n\n /**\n * `console.debug` module name.\n *\n * Example:\n *\n * ```ts\n * logger.logModule?.('app');\n * ```\n */\n logModule?(name: string): void;\n\n /**\n * `console.debug` function or method calls.\n *\n * Example:\n *\n * ```ts\n * function myMethod () {\n * logger.logMethod?.('myMethod');\n * }\n * ```\n */\n logMethod?(method: string): void;\n\n /**\n * `console.debug` function or method calls with arguments.\n *\n * Example:\n *\n * ```ts\n * function myMethod (a: number, b: number) {\n * logger.logMethodArgs?.('myMethod', {a, b});\n * }\n * ```\n */\n logMethodArgs?(method: string, args: unknown): void;\n\n /**\n * `console.debug` function or method calls with arguments.\n *\n * Example:\n *\n * ```ts\n * function add (a: number, b: number): number {\n * const result = a + b;\n * logger.logMethodFull?.('add', {a, b}, result);\n * return result;\n * }\n * ```\n */\n logMethodFull?(method: string, args: unknown, result: unknown): void;\n\n /**\n * `console.log` an event or expected accident.\n * not warn or error just important information.\n *\n * Example:\n *\n * ```ts\n * logger.incident?.('fetch', 'abort_signal', {url: '/test.json'});\n * ```\n */\n incident?(method: string, code: 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: '/test.json'});\n * ```\n */\n accident(method: string, code: string, ...args: unknown[]): void;\n\n /**\n * `console.error` an unexpected error.\n *\n * Example:\n *\n * ```ts\n * try {\n * ...\n * }\n * catch (err) {\n * logger.error('myMethod', 'error_code', err, {a: 1, b: 2});\n * }\n * ```\n */\n error(method: string, code: string, ...args: unknown[]): void;\n\n /**\n * Simple `console.debug` with styled scope.\n *\n * Example:\n *\n * ```ts\n * logger.logOther?.('foo:', 'bar', {a: 1});\n * ```\n */\n logOther?(...args: unknown[]): void;\n\n /**\n * Simple `console.time` with scope.\n *\n * Example:\n *\n * ```ts\n * logger.time?.('foo');\n * ```\n */\n time?(label: string): void;\n\n /**\n * Simple `console.timeEnd` with scope.\n *\n * Example:\n *\n * ```ts\n * logger.timeEnd?.('foo');\n * ```\n */\n timeEnd?(label: string): void;\n\n /**\n * log big banner\n *\n * Example:\n *\n * ```ts\n * logger.banner('Alwatr PWA v2');\n * ```\n */\n banner(message: string): void;\n}\n"]}