@xylabs/logger 5.0.83 → 5.0.86
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/README.md +123 -286
- package/dist/neutral/ConsoleLogger.d.ts +1 -0
- package/dist/neutral/ConsoleLogger.d.ts.map +1 -1
- package/dist/neutral/IdLogger.d.ts +4 -0
- package/dist/neutral/IdLogger.d.ts.map +1 -1
- package/dist/neutral/LevelLogger.d.ts +9 -0
- package/dist/neutral/LevelLogger.d.ts.map +1 -1
- package/dist/neutral/NoOpLogFunction.d.ts +1 -0
- package/dist/neutral/NoOpLogFunction.d.ts.map +1 -1
- package/dist/neutral/getFunctionName.d.ts +5 -0
- package/dist/neutral/getFunctionName.d.ts.map +1 -1
- package/dist/neutral/index.mjs.map +1 -1
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -15,6 +15,8 @@
|
|
|
15
15
|
|
|
16
16
|
XYLabs Logger Library
|
|
17
17
|
|
|
18
|
+
|
|
19
|
+
|
|
18
20
|
## Reference
|
|
19
21
|
|
|
20
22
|
**@xylabs/logger**
|
|
@@ -23,30 +25,40 @@ XYLabs Logger Library
|
|
|
23
25
|
|
|
24
26
|
## Classes
|
|
25
27
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
| Class | Description |
|
|
29
|
+
| ------ | ------ |
|
|
30
|
+
| [ConsoleLogger](#classes/ConsoleLogger) | A LevelLogger that delegates to the global `console` object. |
|
|
31
|
+
| [IdLogger](#classes/IdLogger) | A logger wrapper that prefixes every log message with a bracketed identifier. Useful for distinguishing log output from different components or instances. |
|
|
32
|
+
| [LevelLogger](#classes/LevelLogger) | A logger that filters messages based on a configured log level. Methods for levels above the configured threshold return a no-op function. |
|
|
33
|
+
| [SilentLogger](#classes/SilentLogger) | A logger that does not log anything. This is useful when you want to disable logging like when running unit tests or in silent mode. It implements the `Logger` interface but all methods are no-op functions. |
|
|
30
34
|
|
|
31
35
|
## Interfaces
|
|
32
36
|
|
|
33
|
-
|
|
37
|
+
| Interface | Description |
|
|
38
|
+
| ------ | ------ |
|
|
39
|
+
| [Logger](#interfaces/Logger) | Interface to handle overlap between Winston & `console` with as much congruency as possible. |
|
|
34
40
|
|
|
35
41
|
## Type Aliases
|
|
36
42
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
43
|
+
| Type Alias | Description |
|
|
44
|
+
| ------ | ------ |
|
|
45
|
+
| [LogFunction](#type-aliases/LogFunction) | A generic logging function that accepts any number of arguments. |
|
|
46
|
+
| [LogLevelKey](#type-aliases/LogLevelKey) | String key for a log level (e.g. 'error', 'warn', 'info'). |
|
|
47
|
+
| [LogVerbosity](#type-aliases/LogVerbosity) | Alias for LogLevelKey, representing the verbosity setting as a string. |
|
|
48
|
+
| [LogLevelValue](#type-aliases/LogLevelValue) | Numeric value of a log level (1 through 6). |
|
|
41
49
|
|
|
42
50
|
## Variables
|
|
43
51
|
|
|
44
|
-
|
|
52
|
+
| Variable | Description |
|
|
53
|
+
| ------ | ------ |
|
|
54
|
+
| [LogLevel](#variables/LogLevel) | Numeric log level values, from least verbose (error=1) to most verbose (trace=6). |
|
|
45
55
|
|
|
46
56
|
## Functions
|
|
47
57
|
|
|
48
|
-
|
|
49
|
-
|
|
58
|
+
| Function | Description |
|
|
59
|
+
| ------ | ------ |
|
|
60
|
+
| [NoOpLogFunction](#functions/NoOpLogFunction) | A log function that silently discards all arguments. |
|
|
61
|
+
| [getFunctionName](#functions/getFunctionName) | Retrieves the name of the calling function by inspecting the stack trace. |
|
|
50
62
|
|
|
51
63
|
### classes
|
|
52
64
|
|
|
@@ -56,8 +68,7 @@ XYLabs Logger Library
|
|
|
56
68
|
|
|
57
69
|
***
|
|
58
70
|
|
|
59
|
-
|
|
60
|
-
`console` with as much congruency as possible.
|
|
71
|
+
A LevelLogger that delegates to the global `console` object.
|
|
61
72
|
|
|
62
73
|
## Extends
|
|
63
74
|
|
|
@@ -68,14 +79,14 @@ Interface to handle overlap between Winston &
|
|
|
68
79
|
### Constructor
|
|
69
80
|
|
|
70
81
|
```ts
|
|
71
|
-
new ConsoleLogger(level
|
|
82
|
+
new ConsoleLogger(level?: LogLevelValue): ConsoleLogger;
|
|
72
83
|
```
|
|
73
84
|
|
|
74
85
|
### Parameters
|
|
75
86
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
[`LogLevelValue`](#../type-aliases/LogLevelValue)
|
|
87
|
+
| Parameter | Type | Default value |
|
|
88
|
+
| ------ | ------ | ------ |
|
|
89
|
+
| `level` | [`LogLevelValue`](#../type-aliases/LogLevelValue) | `LogLevel.warn` |
|
|
79
90
|
|
|
80
91
|
### Returns
|
|
81
92
|
|
|
@@ -87,27 +98,10 @@ new ConsoleLogger(level?): ConsoleLogger;
|
|
|
87
98
|
|
|
88
99
|
## Properties
|
|
89
100
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
readonly
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
### Inherited from
|
|
97
|
-
|
|
98
|
-
[`LevelLogger`](#LevelLogger).[`level`](LevelLogger.md#level)
|
|
99
|
-
|
|
100
|
-
***
|
|
101
|
-
|
|
102
|
-
### logger
|
|
103
|
-
|
|
104
|
-
```ts
|
|
105
|
-
readonly logger: Logger;
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
### Inherited from
|
|
109
|
-
|
|
110
|
-
[`LevelLogger`](#LevelLogger).[`logger`](LevelLogger.md#logger)
|
|
101
|
+
| Property | Modifier | Type | Inherited from |
|
|
102
|
+
| ------ | ------ | ------ | ------ |
|
|
103
|
+
| <a id="level"></a> `level` | `readonly` | [`LogLevelValue`](#../type-aliases/LogLevelValue) | [`LevelLogger`](#LevelLogger).[`level`](LevelLogger.md#level) |
|
|
104
|
+
| <a id="logger"></a> `logger` | `readonly` | [`Logger`](#../interfaces/Logger) | [`LevelLogger`](#LevelLogger).[`logger`](LevelLogger.md#logger) |
|
|
111
105
|
|
|
112
106
|
## Accessors
|
|
113
107
|
|
|
@@ -223,8 +217,8 @@ get warn(): LogFunction;
|
|
|
223
217
|
|
|
224
218
|
***
|
|
225
219
|
|
|
226
|
-
|
|
227
|
-
|
|
220
|
+
A logger wrapper that prefixes every log message with a bracketed identifier.
|
|
221
|
+
Useful for distinguishing log output from different components or instances.
|
|
228
222
|
|
|
229
223
|
## Implements
|
|
230
224
|
|
|
@@ -235,18 +229,15 @@ Interface to handle overlap between Winston &
|
|
|
235
229
|
### Constructor
|
|
236
230
|
|
|
237
231
|
```ts
|
|
238
|
-
new IdLogger(logger, id
|
|
232
|
+
new IdLogger(logger: Logger, id?: () => string): IdLogger;
|
|
239
233
|
```
|
|
240
234
|
|
|
241
235
|
### Parameters
|
|
242
236
|
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
[`Logger`](#../interfaces/Logger)
|
|
246
|
-
|
|
247
|
-
#### id?
|
|
248
|
-
|
|
249
|
-
() => `string`
|
|
237
|
+
| Parameter | Type |
|
|
238
|
+
| ------ | ------ |
|
|
239
|
+
| `logger` | [`Logger`](#../interfaces/Logger) |
|
|
240
|
+
| `id?` | () => `string` |
|
|
250
241
|
|
|
251
242
|
### Returns
|
|
252
243
|
|
|
@@ -259,14 +250,14 @@ new IdLogger(logger, id?): IdLogger;
|
|
|
259
250
|
### Set Signature
|
|
260
251
|
|
|
261
252
|
```ts
|
|
262
|
-
set id(id): void;
|
|
253
|
+
set id(id: string): void;
|
|
263
254
|
```
|
|
264
255
|
|
|
265
256
|
#### Parameters
|
|
266
257
|
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
`string`
|
|
258
|
+
| Parameter | Type |
|
|
259
|
+
| ------ | ------ |
|
|
260
|
+
| `id` | `string` |
|
|
270
261
|
|
|
271
262
|
#### Returns
|
|
272
263
|
|
|
@@ -277,14 +268,14 @@ set id(id): void;
|
|
|
277
268
|
### debug()
|
|
278
269
|
|
|
279
270
|
```ts
|
|
280
|
-
debug(...data): void;
|
|
271
|
+
debug(...data: unknown[]): void;
|
|
281
272
|
```
|
|
282
273
|
|
|
283
274
|
### Parameters
|
|
284
275
|
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
...`unknown`[]
|
|
276
|
+
| Parameter | Type |
|
|
277
|
+
| ------ | ------ |
|
|
278
|
+
| ...`data` | `unknown`[] |
|
|
288
279
|
|
|
289
280
|
### Returns
|
|
290
281
|
|
|
@@ -301,14 +292,14 @@ Logger.debug
|
|
|
301
292
|
### error()
|
|
302
293
|
|
|
303
294
|
```ts
|
|
304
|
-
error(...data): void;
|
|
295
|
+
error(...data: unknown[]): void;
|
|
305
296
|
```
|
|
306
297
|
|
|
307
298
|
### Parameters
|
|
308
299
|
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
...`unknown`[]
|
|
300
|
+
| Parameter | Type |
|
|
301
|
+
| ------ | ------ |
|
|
302
|
+
| ...`data` | `unknown`[] |
|
|
312
303
|
|
|
313
304
|
### Returns
|
|
314
305
|
|
|
@@ -325,14 +316,14 @@ Logger.error
|
|
|
325
316
|
### info()
|
|
326
317
|
|
|
327
318
|
```ts
|
|
328
|
-
info(...data): void;
|
|
319
|
+
info(...data: unknown[]): void;
|
|
329
320
|
```
|
|
330
321
|
|
|
331
322
|
### Parameters
|
|
332
323
|
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
...`unknown`[]
|
|
324
|
+
| Parameter | Type |
|
|
325
|
+
| ------ | ------ |
|
|
326
|
+
| ...`data` | `unknown`[] |
|
|
336
327
|
|
|
337
328
|
### Returns
|
|
338
329
|
|
|
@@ -349,14 +340,14 @@ Logger.info
|
|
|
349
340
|
### log()
|
|
350
341
|
|
|
351
342
|
```ts
|
|
352
|
-
log(...data): void;
|
|
343
|
+
log(...data: unknown[]): void;
|
|
353
344
|
```
|
|
354
345
|
|
|
355
346
|
### Parameters
|
|
356
347
|
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
...`unknown`[]
|
|
348
|
+
| Parameter | Type |
|
|
349
|
+
| ------ | ------ |
|
|
350
|
+
| ...`data` | `unknown`[] |
|
|
360
351
|
|
|
361
352
|
### Returns
|
|
362
353
|
|
|
@@ -373,14 +364,14 @@ Logger.log
|
|
|
373
364
|
### trace()
|
|
374
365
|
|
|
375
366
|
```ts
|
|
376
|
-
trace(...data): void;
|
|
367
|
+
trace(...data: unknown[]): void;
|
|
377
368
|
```
|
|
378
369
|
|
|
379
370
|
### Parameters
|
|
380
371
|
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
...`unknown`[]
|
|
372
|
+
| Parameter | Type |
|
|
373
|
+
| ------ | ------ |
|
|
374
|
+
| ...`data` | `unknown`[] |
|
|
384
375
|
|
|
385
376
|
### Returns
|
|
386
377
|
|
|
@@ -397,14 +388,14 @@ Logger.trace
|
|
|
397
388
|
### warn()
|
|
398
389
|
|
|
399
390
|
```ts
|
|
400
|
-
warn(...data): void;
|
|
391
|
+
warn(...data: unknown[]): void;
|
|
401
392
|
```
|
|
402
393
|
|
|
403
394
|
### Parameters
|
|
404
395
|
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
...`unknown`[]
|
|
396
|
+
| Parameter | Type |
|
|
397
|
+
| ------ | ------ |
|
|
398
|
+
| ...`data` | `unknown`[] |
|
|
408
399
|
|
|
409
400
|
### Returns
|
|
410
401
|
|
|
@@ -422,8 +413,8 @@ Logger.warn
|
|
|
422
413
|
|
|
423
414
|
***
|
|
424
415
|
|
|
425
|
-
|
|
426
|
-
|
|
416
|
+
A logger that filters messages based on a configured log level.
|
|
417
|
+
Methods for levels above the configured threshold return a no-op function.
|
|
427
418
|
|
|
428
419
|
## Extended by
|
|
429
420
|
|
|
@@ -438,18 +429,15 @@ Interface to handle overlap between Winston &
|
|
|
438
429
|
### Constructor
|
|
439
430
|
|
|
440
431
|
```ts
|
|
441
|
-
new LevelLogger(logger, level
|
|
432
|
+
new LevelLogger(logger: Logger, level?: LogLevelValue): LevelLogger;
|
|
442
433
|
```
|
|
443
434
|
|
|
444
435
|
### Parameters
|
|
445
436
|
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
[`Logger`](#../interfaces/Logger)
|
|
449
|
-
|
|
450
|
-
#### level?
|
|
451
|
-
|
|
452
|
-
[`LogLevelValue`](#../type-aliases/LogLevelValue) = `LogLevel.warn`
|
|
437
|
+
| Parameter | Type | Default value |
|
|
438
|
+
| ------ | ------ | ------ |
|
|
439
|
+
| `logger` | [`Logger`](#../interfaces/Logger) | `undefined` |
|
|
440
|
+
| `level` | [`LogLevelValue`](#../type-aliases/LogLevelValue) | `LogLevel.warn` |
|
|
453
441
|
|
|
454
442
|
### Returns
|
|
455
443
|
|
|
@@ -457,19 +445,10 @@ new LevelLogger(logger, level?): LevelLogger;
|
|
|
457
445
|
|
|
458
446
|
## Properties
|
|
459
447
|
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
readonly
|
|
464
|
-
```
|
|
465
|
-
|
|
466
|
-
***
|
|
467
|
-
|
|
468
|
-
### logger
|
|
469
|
-
|
|
470
|
-
```ts
|
|
471
|
-
readonly logger: Logger;
|
|
472
|
-
```
|
|
448
|
+
| Property | Modifier | Type |
|
|
449
|
+
| ------ | ------ | ------ |
|
|
450
|
+
| <a id="level"></a> `level` | `readonly` | [`LogLevelValue`](#../type-aliases/LogLevelValue) |
|
|
451
|
+
| <a id="logger"></a> `logger` | `readonly` | [`Logger`](#../interfaces/Logger) |
|
|
473
452
|
|
|
474
453
|
## Accessors
|
|
475
454
|
|
|
@@ -609,135 +588,14 @@ new SilentLogger(): SilentLogger;
|
|
|
609
588
|
|
|
610
589
|
## Properties
|
|
611
590
|
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
readonly
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
#### \_data
|
|
621
|
-
|
|
622
|
-
...`unknown`[]
|
|
623
|
-
|
|
624
|
-
### Returns
|
|
625
|
-
|
|
626
|
-
`undefined`
|
|
627
|
-
|
|
628
|
-
### Implementation of
|
|
629
|
-
|
|
630
|
-
[`Logger`](#../interfaces/Logger).[`debug`](../interfaces/Logger.md#debug)
|
|
631
|
-
|
|
632
|
-
***
|
|
633
|
-
|
|
634
|
-
### error()
|
|
635
|
-
|
|
636
|
-
```ts
|
|
637
|
-
readonly error: (..._data) => undefined = NoOpLogFunction;
|
|
638
|
-
```
|
|
639
|
-
|
|
640
|
-
### Parameters
|
|
641
|
-
|
|
642
|
-
#### \_data
|
|
643
|
-
|
|
644
|
-
...`unknown`[]
|
|
645
|
-
|
|
646
|
-
### Returns
|
|
647
|
-
|
|
648
|
-
`undefined`
|
|
649
|
-
|
|
650
|
-
### Implementation of
|
|
651
|
-
|
|
652
|
-
[`Logger`](#../interfaces/Logger).[`error`](../interfaces/Logger.md#error)
|
|
653
|
-
|
|
654
|
-
***
|
|
655
|
-
|
|
656
|
-
### info()
|
|
657
|
-
|
|
658
|
-
```ts
|
|
659
|
-
readonly info: (..._data) => undefined = NoOpLogFunction;
|
|
660
|
-
```
|
|
661
|
-
|
|
662
|
-
### Parameters
|
|
663
|
-
|
|
664
|
-
#### \_data
|
|
665
|
-
|
|
666
|
-
...`unknown`[]
|
|
667
|
-
|
|
668
|
-
### Returns
|
|
669
|
-
|
|
670
|
-
`undefined`
|
|
671
|
-
|
|
672
|
-
### Implementation of
|
|
673
|
-
|
|
674
|
-
[`Logger`](#../interfaces/Logger).[`info`](../interfaces/Logger.md#info)
|
|
675
|
-
|
|
676
|
-
***
|
|
677
|
-
|
|
678
|
-
### log()
|
|
679
|
-
|
|
680
|
-
```ts
|
|
681
|
-
readonly log: (..._data) => undefined = NoOpLogFunction;
|
|
682
|
-
```
|
|
683
|
-
|
|
684
|
-
### Parameters
|
|
685
|
-
|
|
686
|
-
#### \_data
|
|
687
|
-
|
|
688
|
-
...`unknown`[]
|
|
689
|
-
|
|
690
|
-
### Returns
|
|
691
|
-
|
|
692
|
-
`undefined`
|
|
693
|
-
|
|
694
|
-
### Implementation of
|
|
695
|
-
|
|
696
|
-
[`Logger`](#../interfaces/Logger).[`log`](../interfaces/Logger.md#log)
|
|
697
|
-
|
|
698
|
-
***
|
|
699
|
-
|
|
700
|
-
### trace()
|
|
701
|
-
|
|
702
|
-
```ts
|
|
703
|
-
readonly trace: (..._data) => undefined = NoOpLogFunction;
|
|
704
|
-
```
|
|
705
|
-
|
|
706
|
-
### Parameters
|
|
707
|
-
|
|
708
|
-
#### \_data
|
|
709
|
-
|
|
710
|
-
...`unknown`[]
|
|
711
|
-
|
|
712
|
-
### Returns
|
|
713
|
-
|
|
714
|
-
`undefined`
|
|
715
|
-
|
|
716
|
-
### Implementation of
|
|
717
|
-
|
|
718
|
-
[`Logger`](#../interfaces/Logger).[`trace`](../interfaces/Logger.md#trace)
|
|
719
|
-
|
|
720
|
-
***
|
|
721
|
-
|
|
722
|
-
### warn()
|
|
723
|
-
|
|
724
|
-
```ts
|
|
725
|
-
readonly warn: (..._data) => undefined = NoOpLogFunction;
|
|
726
|
-
```
|
|
727
|
-
|
|
728
|
-
### Parameters
|
|
729
|
-
|
|
730
|
-
#### \_data
|
|
731
|
-
|
|
732
|
-
...`unknown`[]
|
|
733
|
-
|
|
734
|
-
### Returns
|
|
735
|
-
|
|
736
|
-
`undefined`
|
|
737
|
-
|
|
738
|
-
### Implementation of
|
|
739
|
-
|
|
740
|
-
[`Logger`](#../interfaces/Logger).[`warn`](../interfaces/Logger.md#warn)
|
|
591
|
+
| Property | Modifier | Type | Default value |
|
|
592
|
+
| ------ | ------ | ------ | ------ |
|
|
593
|
+
| <a id="debug"></a> `debug` | `readonly` | (...`_data`: `unknown`[]) => `undefined` | `NoOpLogFunction` |
|
|
594
|
+
| <a id="error"></a> `error` | `readonly` | (...`_data`: `unknown`[]) => `undefined` | `NoOpLogFunction` |
|
|
595
|
+
| <a id="info"></a> `info` | `readonly` | (...`_data`: `unknown`[]) => `undefined` | `NoOpLogFunction` |
|
|
596
|
+
| <a id="log"></a> `log` | `readonly` | (...`_data`: `unknown`[]) => `undefined` | `NoOpLogFunction` |
|
|
597
|
+
| <a id="trace"></a> `trace` | `readonly` | (...`_data`: `unknown`[]) => `undefined` | `NoOpLogFunction` |
|
|
598
|
+
| <a id="warn"></a> `warn` | `readonly` | (...`_data`: `unknown`[]) => `undefined` | `NoOpLogFunction` |
|
|
741
599
|
|
|
742
600
|
### functions
|
|
743
601
|
|
|
@@ -748,14 +606,16 @@ readonly warn: (..._data) => undefined = NoOpLogFunction;
|
|
|
748
606
|
***
|
|
749
607
|
|
|
750
608
|
```ts
|
|
751
|
-
function NoOpLogFunction(..._data): undefined;
|
|
609
|
+
function NoOpLogFunction(..._data: unknown[]): undefined;
|
|
752
610
|
```
|
|
753
611
|
|
|
754
|
-
|
|
612
|
+
A log function that silently discards all arguments.
|
|
755
613
|
|
|
756
|
-
|
|
614
|
+
## Parameters
|
|
757
615
|
|
|
758
|
-
|
|
616
|
+
| Parameter | Type |
|
|
617
|
+
| ------ | ------ |
|
|
618
|
+
| ...`_data` | `unknown`[] |
|
|
759
619
|
|
|
760
620
|
## Returns
|
|
761
621
|
|
|
@@ -768,19 +628,23 @@ function NoOpLogFunction(..._data): undefined;
|
|
|
768
628
|
***
|
|
769
629
|
|
|
770
630
|
```ts
|
|
771
|
-
function getFunctionName(depth
|
|
631
|
+
function getFunctionName(depth?: number): string;
|
|
772
632
|
```
|
|
773
633
|
|
|
774
|
-
|
|
634
|
+
Retrieves the name of the calling function by inspecting the stack trace.
|
|
775
635
|
|
|
776
|
-
|
|
636
|
+
## Parameters
|
|
777
637
|
|
|
778
|
-
|
|
638
|
+
| Parameter | Type | Default value | Description |
|
|
639
|
+
| ------ | ------ | ------ | ------ |
|
|
640
|
+
| `depth` | `number` | `2` | The stack frame depth to inspect (default: 2, the caller's caller). |
|
|
779
641
|
|
|
780
642
|
## Returns
|
|
781
643
|
|
|
782
644
|
`string`
|
|
783
645
|
|
|
646
|
+
The function name, or '<unknown>' if it cannot be determined.
|
|
647
|
+
|
|
784
648
|
### interfaces
|
|
785
649
|
|
|
786
650
|
### <a id="Logger"></a>Logger
|
|
@@ -794,51 +658,14 @@ Interface to handle overlap between Winston &
|
|
|
794
658
|
|
|
795
659
|
## Properties
|
|
796
660
|
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
### error
|
|
806
|
-
|
|
807
|
-
```ts
|
|
808
|
-
error: LogFunction;
|
|
809
|
-
```
|
|
810
|
-
|
|
811
|
-
***
|
|
812
|
-
|
|
813
|
-
### info
|
|
814
|
-
|
|
815
|
-
```ts
|
|
816
|
-
info: LogFunction;
|
|
817
|
-
```
|
|
818
|
-
|
|
819
|
-
***
|
|
820
|
-
|
|
821
|
-
### log
|
|
822
|
-
|
|
823
|
-
```ts
|
|
824
|
-
log: LogFunction;
|
|
825
|
-
```
|
|
826
|
-
|
|
827
|
-
***
|
|
828
|
-
|
|
829
|
-
### trace
|
|
830
|
-
|
|
831
|
-
```ts
|
|
832
|
-
trace: LogFunction;
|
|
833
|
-
```
|
|
834
|
-
|
|
835
|
-
***
|
|
836
|
-
|
|
837
|
-
### warn
|
|
838
|
-
|
|
839
|
-
```ts
|
|
840
|
-
warn: LogFunction;
|
|
841
|
-
```
|
|
661
|
+
| Property | Type |
|
|
662
|
+
| ------ | ------ |
|
|
663
|
+
| <a id="debug"></a> `debug` | [`LogFunction`](#../type-aliases/LogFunction) |
|
|
664
|
+
| <a id="error"></a> `error` | [`LogFunction`](#../type-aliases/LogFunction) |
|
|
665
|
+
| <a id="info"></a> `info` | [`LogFunction`](#../type-aliases/LogFunction) |
|
|
666
|
+
| <a id="log"></a> `log` | [`LogFunction`](#../type-aliases/LogFunction) |
|
|
667
|
+
| <a id="trace"></a> `trace` | [`LogFunction`](#../type-aliases/LogFunction) |
|
|
668
|
+
| <a id="warn"></a> `warn` | [`LogFunction`](#../type-aliases/LogFunction) |
|
|
842
669
|
|
|
843
670
|
### type-aliases
|
|
844
671
|
|
|
@@ -849,14 +676,16 @@ warn: LogFunction;
|
|
|
849
676
|
***
|
|
850
677
|
|
|
851
678
|
```ts
|
|
852
|
-
type LogFunction = (...data) => void;
|
|
679
|
+
type LogFunction = (...data: unknown[]) => void;
|
|
853
680
|
```
|
|
854
681
|
|
|
855
|
-
|
|
682
|
+
A generic logging function that accepts any number of arguments.
|
|
856
683
|
|
|
857
|
-
|
|
684
|
+
## Parameters
|
|
858
685
|
|
|
859
|
-
|
|
686
|
+
| Parameter | Type |
|
|
687
|
+
| ------ | ------ |
|
|
688
|
+
| ...`data` | `unknown`[] |
|
|
860
689
|
|
|
861
690
|
## Returns
|
|
862
691
|
|
|
@@ -872,6 +701,8 @@ type LogFunction = (...data) => void;
|
|
|
872
701
|
type LogLevelKey = EnumKey<typeof LogLevel>;
|
|
873
702
|
```
|
|
874
703
|
|
|
704
|
+
String key for a log level (e.g. 'error', 'warn', 'info').
|
|
705
|
+
|
|
875
706
|
### <a id="LogLevelValue"></a>LogLevelValue
|
|
876
707
|
|
|
877
708
|
[**@xylabs/logger**](#../README)
|
|
@@ -882,6 +713,8 @@ type LogLevelKey = EnumKey<typeof LogLevel>;
|
|
|
882
713
|
type LogLevelValue = EnumValue<typeof LogLevel>;
|
|
883
714
|
```
|
|
884
715
|
|
|
716
|
+
Numeric value of a log level (1 through 6).
|
|
717
|
+
|
|
885
718
|
### <a id="LogVerbosity"></a>LogVerbosity
|
|
886
719
|
|
|
887
720
|
[**@xylabs/logger**](#../README)
|
|
@@ -892,6 +725,8 @@ type LogLevelValue = EnumValue<typeof LogLevel>;
|
|
|
892
725
|
type LogVerbosity = LogLevelKey;
|
|
893
726
|
```
|
|
894
727
|
|
|
728
|
+
Alias for LogLevelKey, representing the verbosity setting as a string.
|
|
729
|
+
|
|
895
730
|
### variables
|
|
896
731
|
|
|
897
732
|
### <a id="LogLevel"></a>LogLevel
|
|
@@ -911,6 +746,8 @@ const LogLevel: Enum<{
|
|
|
911
746
|
}>;
|
|
912
747
|
```
|
|
913
748
|
|
|
749
|
+
Numeric log level values, from least verbose (error=1) to most verbose (trace=6).
|
|
750
|
+
|
|
914
751
|
|
|
915
752
|
Part of [sdk-js](https://www.npmjs.com/package/@xyo-network/sdk-js)
|
|
916
753
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { LogLevelValue } from './LevelLogger.ts';
|
|
2
2
|
import { LevelLogger } from './LevelLogger.ts';
|
|
3
|
+
/** A LevelLogger that delegates to the global `console` object. */
|
|
3
4
|
export declare class ConsoleLogger extends LevelLogger {
|
|
4
5
|
constructor(level?: LogLevelValue);
|
|
5
6
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConsoleLogger.d.ts","sourceRoot":"","sources":["../../src/ConsoleLogger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AACrD,OAAO,EAAE,WAAW,EAAY,MAAM,kBAAkB,CAAA;AAExD,qBAAa,aAAc,SAAQ,WAAW;gBAChC,KAAK,GAAE,aAA6B;CAGjD"}
|
|
1
|
+
{"version":3,"file":"ConsoleLogger.d.ts","sourceRoot":"","sources":["../../src/ConsoleLogger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AACrD,OAAO,EAAE,WAAW,EAAY,MAAM,kBAAkB,CAAA;AAExD,mEAAmE;AACnE,qBAAa,aAAc,SAAQ,WAAW;gBAChC,KAAK,GAAE,aAA6B;CAGjD"}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import type { Logger } from './LevelLogger.ts';
|
|
2
|
+
/**
|
|
3
|
+
* A logger wrapper that prefixes every log message with a bracketed identifier.
|
|
4
|
+
* Useful for distinguishing log output from different components or instances.
|
|
5
|
+
*/
|
|
2
6
|
export declare class IdLogger implements Logger {
|
|
3
7
|
private _id?;
|
|
4
8
|
private _logger;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IdLogger.d.ts","sourceRoot":"","sources":["../../src/IdLogger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAE9C,qBAAa,QAAS,YAAW,MAAM;IACrC,OAAO,CAAC,GAAG,CAAC,CAAc;IAC1B,OAAO,CAAC,OAAO,CAAQ;gBAEX,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,MAAM,MAAM;IAK7C,IAAI,EAAE,CAAC,EAAE,EAAE,MAAM,EAEhB;IAED,KAAK,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE;IAIxB,KAAK,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE;IAIxB,IAAI,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE;IAIvB,GAAG,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE;IAItB,KAAK,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE;IAIxB,IAAI,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE;IAIvB,OAAO,CAAC,MAAM;CAGf"}
|
|
1
|
+
{"version":3,"file":"IdLogger.d.ts","sourceRoot":"","sources":["../../src/IdLogger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAE9C;;;GAGG;AACH,qBAAa,QAAS,YAAW,MAAM;IACrC,OAAO,CAAC,GAAG,CAAC,CAAc;IAC1B,OAAO,CAAC,OAAO,CAAQ;gBAEX,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,MAAM,MAAM;IAK7C,IAAI,EAAE,CAAC,EAAE,EAAE,MAAM,EAEhB;IAED,KAAK,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE;IAIxB,KAAK,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE;IAIxB,IAAI,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE;IAIvB,GAAG,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE;IAItB,KAAK,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE;IAIxB,IAAI,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE;IAIvB,OAAO,CAAC,MAAM;CAGf"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { EnumKey, EnumValue } from '@xylabs/enum';
|
|
2
2
|
import { Enum } from '@xylabs/enum';
|
|
3
|
+
/** A generic logging function that accepts any number of arguments. */
|
|
3
4
|
export type LogFunction = (...data: unknown[]) => void;
|
|
4
5
|
/**
|
|
5
6
|
* Interface to handle overlap between Winston &
|
|
@@ -13,6 +14,7 @@ export interface Logger {
|
|
|
13
14
|
trace: LogFunction;
|
|
14
15
|
warn: LogFunction;
|
|
15
16
|
}
|
|
17
|
+
/** Numeric log level values, from least verbose (error=1) to most verbose (trace=6). */
|
|
16
18
|
export declare const LogLevel: Enum<{
|
|
17
19
|
error: 1;
|
|
18
20
|
warn: 2;
|
|
@@ -21,9 +23,16 @@ export declare const LogLevel: Enum<{
|
|
|
21
23
|
debug: 5;
|
|
22
24
|
trace: 6;
|
|
23
25
|
}>;
|
|
26
|
+
/** String key for a log level (e.g. 'error', 'warn', 'info'). */
|
|
24
27
|
export type LogLevelKey = EnumKey<typeof LogLevel>;
|
|
28
|
+
/** Alias for LogLevelKey, representing the verbosity setting as a string. */
|
|
25
29
|
export type LogVerbosity = LogLevelKey;
|
|
30
|
+
/** Numeric value of a log level (1 through 6). */
|
|
26
31
|
export type LogLevelValue = EnumValue<typeof LogLevel>;
|
|
32
|
+
/**
|
|
33
|
+
* A logger that filters messages based on a configured log level.
|
|
34
|
+
* Methods for levels above the configured threshold return a no-op function.
|
|
35
|
+
*/
|
|
27
36
|
export declare class LevelLogger implements Logger {
|
|
28
37
|
readonly level: LogLevelValue;
|
|
29
38
|
readonly logger: Logger;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LevelLogger.d.ts","sourceRoot":"","sources":["../../src/LevelLogger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACtD,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAInC,MAAM,MAAM,WAAW,GAAG,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAA;AAEtD;;;GAGG;AACH,MAAM,WAAW,MAAM;IACrB,KAAK,EAAE,WAAW,CAAA;IAClB,KAAK,EAAE,WAAW,CAAA;IAClB,IAAI,EAAE,WAAW,CAAA;IACjB,GAAG,EAAE,WAAW,CAAA;IAChB,KAAK,EAAE,WAAW,CAAA;IAClB,IAAI,EAAE,WAAW,CAAA;CAClB;AAED,eAAO,MAAM,QAAQ;;;;;;;EAOnB,CAAA;AAEF,MAAM,MAAM,WAAW,GAAG,OAAO,CAAC,OAAO,QAAQ,CAAC,CAAA;
|
|
1
|
+
{"version":3,"file":"LevelLogger.d.ts","sourceRoot":"","sources":["../../src/LevelLogger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACtD,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAInC,uEAAuE;AACvE,MAAM,MAAM,WAAW,GAAG,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAA;AAEtD;;;GAGG;AACH,MAAM,WAAW,MAAM;IACrB,KAAK,EAAE,WAAW,CAAA;IAClB,KAAK,EAAE,WAAW,CAAA;IAClB,IAAI,EAAE,WAAW,CAAA;IACjB,GAAG,EAAE,WAAW,CAAA;IAChB,KAAK,EAAE,WAAW,CAAA;IAClB,IAAI,EAAE,WAAW,CAAA;CAClB;AAED,wFAAwF;AACxF,eAAO,MAAM,QAAQ;;;;;;;EAOnB,CAAA;AAEF,iEAAiE;AACjE,MAAM,MAAM,WAAW,GAAG,OAAO,CAAC,OAAO,QAAQ,CAAC,CAAA;AAElD,6EAA6E;AAC7E,MAAM,MAAM,YAAY,GAAG,WAAW,CAAA;AAEtC,kDAAkD;AAClD,MAAM,MAAM,aAAa,GAAG,SAAS,CAAC,OAAO,QAAQ,CAAC,CAAA;AAEtD;;;GAGG;AACH,qBAAa,WAAY,YAAW,MAAM;IACxC,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAA;IAC7B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;gBACX,MAAM,EAAE,MAAM,EAAE,KAAK,GAAE,aAA6B;IAKhE,IAAI,KAAK,gBAER;IAED,IAAI,KAAK,gBAER;IAED,IAAI,IAAI,gBAEP;IAED,IAAI,GAAG,gBAEN;IAED,IAAI,KAAK,gBAER;IAED,IAAI,IAAI,gBAEP;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NoOpLogFunction.d.ts","sourceRoot":"","sources":["../../src/NoOpLogFunction.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,GAAI,GAAG,OAAO,OAAO,EAAE,cAAY,CAAA"}
|
|
1
|
+
{"version":3,"file":"NoOpLogFunction.d.ts","sourceRoot":"","sources":["../../src/NoOpLogFunction.ts"],"names":[],"mappings":"AAAA,2DAA2D;AAC3D,eAAO,MAAM,eAAe,GAAI,GAAG,OAAO,OAAO,EAAE,cAAY,CAAA"}
|
|
@@ -1,2 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Retrieves the name of the calling function by inspecting the stack trace.
|
|
3
|
+
* @param depth - The stack frame depth to inspect (default: 2, the caller's caller).
|
|
4
|
+
* @returns The function name, or '<unknown>' if it cannot be determined.
|
|
5
|
+
*/
|
|
1
6
|
export declare const getFunctionName: (depth?: number) => string;
|
|
2
7
|
//# sourceMappingURL=getFunctionName.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getFunctionName.d.ts","sourceRoot":"","sources":["../../src/getFunctionName.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,eAAe,GAAI,cAAS,WAoBxC,CAAA"}
|
|
1
|
+
{"version":3,"file":"getFunctionName.d.ts","sourceRoot":"","sources":["../../src/getFunctionName.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,eAAO,MAAM,eAAe,GAAI,cAAS,WAoBxC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/LevelLogger.ts","../../src/NoOpLogFunction.ts","../../src/ConsoleLogger.ts","../../src/getFunctionName.ts","../../src/IdLogger.ts","../../src/SilentLogger.ts"],"sourcesContent":["import type { EnumKey, EnumValue } from '@xylabs/enum'\nimport { Enum } from '@xylabs/enum'\n\nimport { NoOpLogFunction } from './NoOpLogFunction.ts'\n\nexport type LogFunction = (...data: unknown[]) => void\n\n/**\n * Interface to handle overlap between Winston &\n * `console` with as much congruency as possible.\n */\nexport interface Logger {\n debug: LogFunction\n error: LogFunction\n info: LogFunction\n log: LogFunction\n trace: LogFunction\n warn: LogFunction\n}\n\nexport const LogLevel = Enum({\n error: 1,\n warn: 2,\n info: 3,\n log: 4,\n debug: 5,\n trace: 6,\n})\n\nexport type LogLevelKey = EnumKey<typeof LogLevel>\nexport type LogVerbosity = LogLevelKey\n\nexport type LogLevelValue = EnumValue<typeof LogLevel>\n\nexport class LevelLogger implements Logger {\n readonly level: LogLevelValue\n readonly logger: Logger\n constructor(logger: Logger, level: LogLevelValue = LogLevel.warn) {\n this.level = level\n this.logger = logger\n }\n\n get debug() {\n return this.level >= LogLevel.debug ? this.logger.debug : NoOpLogFunction\n }\n\n get error() {\n return this.level >= LogLevel.error ? this.logger.error : NoOpLogFunction\n }\n\n get info() {\n return this.level >= LogLevel.info ? this.logger.info : NoOpLogFunction\n }\n\n get log() {\n return this.level >= LogLevel.log ? this.logger.log : NoOpLogFunction\n }\n\n get trace() {\n return this.level >= LogLevel.trace ? this.logger.trace : NoOpLogFunction\n }\n\n get warn() {\n return this.level >= LogLevel.warn ? this.logger.warn : NoOpLogFunction\n }\n}\n","
|
|
1
|
+
{"version":3,"sources":["../../src/LevelLogger.ts","../../src/NoOpLogFunction.ts","../../src/ConsoleLogger.ts","../../src/getFunctionName.ts","../../src/IdLogger.ts","../../src/SilentLogger.ts"],"sourcesContent":["import type { EnumKey, EnumValue } from '@xylabs/enum'\nimport { Enum } from '@xylabs/enum'\n\nimport { NoOpLogFunction } from './NoOpLogFunction.ts'\n\n/** A generic logging function that accepts any number of arguments. */\nexport type LogFunction = (...data: unknown[]) => void\n\n/**\n * Interface to handle overlap between Winston &\n * `console` with as much congruency as possible.\n */\nexport interface Logger {\n debug: LogFunction\n error: LogFunction\n info: LogFunction\n log: LogFunction\n trace: LogFunction\n warn: LogFunction\n}\n\n/** Numeric log level values, from least verbose (error=1) to most verbose (trace=6). */\nexport const LogLevel = Enum({\n error: 1,\n warn: 2,\n info: 3,\n log: 4,\n debug: 5,\n trace: 6,\n})\n\n/** String key for a log level (e.g. 'error', 'warn', 'info'). */\nexport type LogLevelKey = EnumKey<typeof LogLevel>\n\n/** Alias for LogLevelKey, representing the verbosity setting as a string. */\nexport type LogVerbosity = LogLevelKey\n\n/** Numeric value of a log level (1 through 6). */\nexport type LogLevelValue = EnumValue<typeof LogLevel>\n\n/**\n * A logger that filters messages based on a configured log level.\n * Methods for levels above the configured threshold return a no-op function.\n */\nexport class LevelLogger implements Logger {\n readonly level: LogLevelValue\n readonly logger: Logger\n constructor(logger: Logger, level: LogLevelValue = LogLevel.warn) {\n this.level = level\n this.logger = logger\n }\n\n get debug() {\n return this.level >= LogLevel.debug ? this.logger.debug : NoOpLogFunction\n }\n\n get error() {\n return this.level >= LogLevel.error ? this.logger.error : NoOpLogFunction\n }\n\n get info() {\n return this.level >= LogLevel.info ? this.logger.info : NoOpLogFunction\n }\n\n get log() {\n return this.level >= LogLevel.log ? this.logger.log : NoOpLogFunction\n }\n\n get trace() {\n return this.level >= LogLevel.trace ? this.logger.trace : NoOpLogFunction\n }\n\n get warn() {\n return this.level >= LogLevel.warn ? this.logger.warn : NoOpLogFunction\n }\n}\n","/** A log function that silently discards all arguments. */\nexport const NoOpLogFunction = (..._data: unknown[]) => void {}\n","import type { LogLevelValue } from './LevelLogger.ts'\nimport { LevelLogger, LogLevel } from './LevelLogger.ts'\n\n/** A LevelLogger that delegates to the global `console` object. */\nexport class ConsoleLogger extends LevelLogger {\n constructor(level: LogLevelValue = LogLevel.warn) {\n super(console, level)\n }\n}\n","import { handleError } from '@xylabs/error'\nimport { isNumber } from '@xylabs/typeof'\n\n/**\n * Retrieves the name of the calling function by inspecting the stack trace.\n * @param depth - The stack frame depth to inspect (default: 2, the caller's caller).\n * @returns The function name, or '<unknown>' if it cannot be determined.\n */\nexport const getFunctionName = (depth = 2) => {\n try {\n throw new Error('Getting function name')\n } catch (ex) {\n return handleError(ex, (error) => {\n let newIndex: number | undefined\n const stackParts = error.stack?.split('\\n')[depth]?.split(' ')\n const funcName\n = stackParts?.find((item, index) => {\n if (item.length > 0 && item !== 'at') {\n // check if constructor\n if (item === 'new') {\n newIndex = index\n }\n return true\n }\n }) ?? '<unknown>'\n return isNumber(newIndex) ? `${funcName} ${stackParts?.[newIndex + 1]}` : funcName\n })\n }\n}\n","import type { Logger } from './LevelLogger.ts'\n\n/**\n * A logger wrapper that prefixes every log message with a bracketed identifier.\n * Useful for distinguishing log output from different components or instances.\n */\nexport class IdLogger implements Logger {\n private _id?: () => string\n private _logger: Logger\n\n constructor(logger: Logger, id?: () => string) {\n this._logger = logger\n this._id = id\n }\n\n set id(id: string) {\n this._id = () => id\n }\n\n debug(...data: unknown[]) {\n this._logger?.debug(this.prefix(), ...data)\n }\n\n error(...data: unknown[]) {\n this._logger?.error(this.prefix(), ...data)\n }\n\n info(...data: unknown[]) {\n this._logger?.info(this.prefix(), ...data)\n }\n\n log(...data: unknown[]) {\n this._logger?.log(this.prefix(), ...data)\n }\n\n trace(...data: unknown[]) {\n this._logger?.trace(this.prefix(), ...data)\n }\n\n warn(...data: unknown[]) {\n this._logger?.warn(this.prefix(), ...data)\n }\n\n private prefix() {\n return `[${this._id?.()}]`\n }\n}\n","import type { Logger } from './LevelLogger.ts'\nimport { NoOpLogFunction } from './NoOpLogFunction.ts'\n\n/**\n * A logger that does not log anything.\n * This is useful when you want to disable logging\n * like when running unit tests or in silent mode.\n * It implements the `Logger` interface but all methods\n * are no-op functions.\n */\nexport class SilentLogger implements Logger {\n readonly debug = NoOpLogFunction\n readonly error = NoOpLogFunction\n readonly info = NoOpLogFunction\n readonly log = NoOpLogFunction\n readonly trace = NoOpLogFunction\n readonly warn = NoOpLogFunction\n}\n"],"mappings":"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","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xylabs/logger",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.86",
|
|
4
4
|
"description": "XYLabs Logger Library",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"logger",
|
|
@@ -42,14 +42,14 @@
|
|
|
42
42
|
"!**/*.test.*"
|
|
43
43
|
],
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@xylabs/enum": "~5.0.
|
|
46
|
-
"@xylabs/error": "~5.0.
|
|
47
|
-
"@xylabs/typeof": "~5.0.
|
|
45
|
+
"@xylabs/enum": "~5.0.86",
|
|
46
|
+
"@xylabs/error": "~5.0.86",
|
|
47
|
+
"@xylabs/typeof": "~5.0.86"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@types/node": "~25.4.0",
|
|
51
|
-
"@xylabs/ts-scripts-yarn3": "~7.4.
|
|
52
|
-
"@xylabs/tsconfig": "~7.4.
|
|
51
|
+
"@xylabs/ts-scripts-yarn3": "~7.4.16",
|
|
52
|
+
"@xylabs/tsconfig": "~7.4.16",
|
|
53
53
|
"typescript": "~5.9.3",
|
|
54
54
|
"vitest": "~4.0.18"
|
|
55
55
|
},
|