@xylabs/logger 4.13.20 → 4.13.22

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.
Files changed (2) hide show
  1. package/README.md +912 -3
  2. package/package.json +5 -5
package/README.md CHANGED
@@ -12,13 +12,922 @@
12
12
  [![snyk-badge][]][snyk-link]
13
13
  [![socket-badge][]][socket-link]
14
14
 
15
- Version: 4.13.19
16
15
 
17
16
  XYLabs Logger Library
18
17
 
19
- ## Documentation
18
+ ## Reference
19
+
20
+ **@xylabs/logger**
21
+
22
+ ***
23
+
24
+ ## Classes
25
+
26
+ - [ConsoleLogger](#classes/ConsoleLogger)
27
+ - [IdLogger](#classes/IdLogger)
28
+ - [LevelLogger](#classes/LevelLogger)
29
+ - [SilentLogger](#classes/SilentLogger)
30
+
31
+ ## Interfaces
32
+
33
+ - [Logger](#interfaces/Logger)
34
+
35
+ ## Type Aliases
36
+
37
+ - [LogFunction](#type-aliases/LogFunction)
38
+ - [~~LogLevel~~](#type-aliases/LogLevel)
39
+ - [LogLevelKey](#type-aliases/LogLevelKey)
40
+ - [LogVerbosity](#type-aliases/LogVerbosity)
41
+ - [LogLevelValue](#type-aliases/LogLevelValue)
42
+
43
+ ## Variables
44
+
45
+ - [LogLevel](#variables/LogLevel)
46
+
47
+ ## Functions
48
+
49
+ - [NoOpLogFunction](#functions/NoOpLogFunction)
50
+ - [getFunctionName](#functions/getFunctionName)
51
+
52
+ ### classes
53
+
54
+ ### <a id="ConsoleLogger"></a>ConsoleLogger
55
+
56
+ [**@xylabs/logger**](#../README)
57
+
58
+ ***
59
+
60
+ Interface to handle overlap between Winston &
61
+ `console` with as much congruency as possible.
62
+
63
+ ## Extends
64
+
65
+ - [`LevelLogger`](#LevelLogger)
66
+
67
+ ## Constructors
68
+
69
+ ### Constructor
70
+
71
+ ```ts
72
+ new ConsoleLogger(level): ConsoleLogger;
73
+ ```
74
+
75
+ ### Parameters
76
+
77
+ #### level
78
+
79
+ [`LogLevelValue`](#../type-aliases/LogLevelValue) = `LogLevel.warn`
80
+
81
+ ### Returns
82
+
83
+ `ConsoleLogger`
84
+
85
+ ### Overrides
86
+
87
+ [`LevelLogger`](#LevelLogger).[`constructor`](LevelLogger.md#constructor)
88
+
89
+ ## Properties
90
+
91
+ ### level
92
+
93
+ ```ts
94
+ readonly level: LogLevelValue;
95
+ ```
96
+
97
+ ### Inherited from
98
+
99
+ [`LevelLogger`](#LevelLogger).[`level`](LevelLogger.md#level)
100
+
101
+ ***
102
+
103
+ ### logger
104
+
105
+ ```ts
106
+ readonly logger: Logger;
107
+ ```
108
+
109
+ ### Inherited from
110
+
111
+ [`LevelLogger`](#LevelLogger).[`logger`](LevelLogger.md#logger)
112
+
113
+ ## Accessors
114
+
115
+ ### debug
116
+
117
+ ### Get Signature
118
+
119
+ ```ts
120
+ get debug(): LogFunction;
121
+ ```
122
+
123
+ #### Returns
124
+
125
+ [`LogFunction`](#../type-aliases/LogFunction)
126
+
127
+ ### Inherited from
128
+
129
+ [`LevelLogger`](#LevelLogger).[`debug`](LevelLogger.md#debug)
130
+
131
+ ***
132
+
133
+ ### error
134
+
135
+ ### Get Signature
136
+
137
+ ```ts
138
+ get error(): LogFunction;
139
+ ```
140
+
141
+ #### Returns
142
+
143
+ [`LogFunction`](#../type-aliases/LogFunction)
144
+
145
+ ### Inherited from
146
+
147
+ [`LevelLogger`](#LevelLogger).[`error`](LevelLogger.md#error)
148
+
149
+ ***
150
+
151
+ ### info
152
+
153
+ ### Get Signature
154
+
155
+ ```ts
156
+ get info(): LogFunction;
157
+ ```
158
+
159
+ #### Returns
160
+
161
+ [`LogFunction`](#../type-aliases/LogFunction)
162
+
163
+ ### Inherited from
164
+
165
+ [`LevelLogger`](#LevelLogger).[`info`](LevelLogger.md#info)
166
+
167
+ ***
168
+
169
+ ### log
170
+
171
+ ### Get Signature
172
+
173
+ ```ts
174
+ get log(): LogFunction;
175
+ ```
176
+
177
+ #### Returns
178
+
179
+ [`LogFunction`](#../type-aliases/LogFunction)
180
+
181
+ ### Inherited from
182
+
183
+ [`LevelLogger`](#LevelLogger).[`log`](LevelLogger.md#log)
184
+
185
+ ***
186
+
187
+ ### trace
188
+
189
+ ### Get Signature
190
+
191
+ ```ts
192
+ get trace(): LogFunction;
193
+ ```
194
+
195
+ #### Returns
196
+
197
+ [`LogFunction`](#../type-aliases/LogFunction)
198
+
199
+ ### Inherited from
200
+
201
+ [`LevelLogger`](#LevelLogger).[`trace`](LevelLogger.md#trace)
202
+
203
+ ***
204
+
205
+ ### warn
206
+
207
+ ### Get Signature
208
+
209
+ ```ts
210
+ get warn(): LogFunction;
211
+ ```
212
+
213
+ #### Returns
214
+
215
+ [`LogFunction`](#../type-aliases/LogFunction)
216
+
217
+ ### Inherited from
218
+
219
+ [`LevelLogger`](#LevelLogger).[`warn`](LevelLogger.md#warn)
220
+
221
+ ### <a id="IdLogger"></a>IdLogger
222
+
223
+ [**@xylabs/logger**](#../README)
224
+
225
+ ***
226
+
227
+ Interface to handle overlap between Winston &
228
+ `console` with as much congruency as possible.
229
+
230
+ ## Implements
231
+
232
+ - [`Logger`](#../interfaces/Logger)
233
+
234
+ ## Constructors
235
+
236
+ ### Constructor
237
+
238
+ ```ts
239
+ new IdLogger(logger, id?): IdLogger;
240
+ ```
241
+
242
+ ### Parameters
243
+
244
+ #### logger
245
+
246
+ [`Logger`](#../interfaces/Logger)
247
+
248
+ #### id?
249
+
250
+ () => `string`
251
+
252
+ ### Returns
253
+
254
+ `IdLogger`
255
+
256
+ ## Accessors
257
+
258
+ ### id
259
+
260
+ ### Set Signature
261
+
262
+ ```ts
263
+ set id(id): void;
264
+ ```
265
+
266
+ #### Parameters
267
+
268
+ ##### id
269
+
270
+ `string`
271
+
272
+ #### Returns
273
+
274
+ `void`
275
+
276
+ ## Methods
277
+
278
+ ### debug()
279
+
280
+ ```ts
281
+ debug(...data): void;
282
+ ```
283
+
284
+ ### Parameters
285
+
286
+ #### data
287
+
288
+ ...`unknown`[]
289
+
290
+ ### Returns
291
+
292
+ `void`
293
+
294
+ ### Implementation of
295
+
296
+ ```ts
297
+ Logger.debug
298
+ ```
299
+
300
+ ***
301
+
302
+ ### error()
303
+
304
+ ```ts
305
+ error(...data): void;
306
+ ```
307
+
308
+ ### Parameters
309
+
310
+ #### data
311
+
312
+ ...`unknown`[]
313
+
314
+ ### Returns
315
+
316
+ `void`
317
+
318
+ ### Implementation of
319
+
320
+ ```ts
321
+ Logger.error
322
+ ```
323
+
324
+ ***
325
+
326
+ ### info()
327
+
328
+ ```ts
329
+ info(...data): void;
330
+ ```
331
+
332
+ ### Parameters
333
+
334
+ #### data
335
+
336
+ ...`unknown`[]
337
+
338
+ ### Returns
339
+
340
+ `void`
341
+
342
+ ### Implementation of
343
+
344
+ ```ts
345
+ Logger.info
346
+ ```
347
+
348
+ ***
349
+
350
+ ### log()
351
+
352
+ ```ts
353
+ log(...data): void;
354
+ ```
355
+
356
+ ### Parameters
357
+
358
+ #### data
359
+
360
+ ...`unknown`[]
361
+
362
+ ### Returns
363
+
364
+ `void`
365
+
366
+ ### Implementation of
367
+
368
+ ```ts
369
+ Logger.log
370
+ ```
371
+
372
+ ***
373
+
374
+ ### trace()
375
+
376
+ ```ts
377
+ trace(...data): void;
378
+ ```
379
+
380
+ ### Parameters
381
+
382
+ #### data
383
+
384
+ ...`unknown`[]
385
+
386
+ ### Returns
387
+
388
+ `void`
389
+
390
+ ### Implementation of
391
+
392
+ ```ts
393
+ Logger.trace
394
+ ```
395
+
396
+ ***
397
+
398
+ ### warn()
399
+
400
+ ```ts
401
+ warn(...data): void;
402
+ ```
403
+
404
+ ### Parameters
405
+
406
+ #### data
407
+
408
+ ...`unknown`[]
409
+
410
+ ### Returns
411
+
412
+ `void`
413
+
414
+ ### Implementation of
415
+
416
+ ```ts
417
+ Logger.warn
418
+ ```
419
+
420
+ ### <a id="LevelLogger"></a>LevelLogger
421
+
422
+ [**@xylabs/logger**](#../README)
423
+
424
+ ***
425
+
426
+ Interface to handle overlap between Winston &
427
+ `console` with as much congruency as possible.
428
+
429
+ ## Extended by
430
+
431
+ - [`ConsoleLogger`](#ConsoleLogger)
432
+
433
+ ## Implements
434
+
435
+ - [`Logger`](#../interfaces/Logger)
436
+
437
+ ## Constructors
438
+
439
+ ### Constructor
440
+
441
+ ```ts
442
+ new LevelLogger(logger, level): LevelLogger;
443
+ ```
444
+
445
+ ### Parameters
446
+
447
+ #### logger
448
+
449
+ [`Logger`](#../interfaces/Logger)
450
+
451
+ #### level
452
+
453
+ [`LogLevelValue`](#../type-aliases/LogLevelValue) = `LogLevel.warn`
454
+
455
+ ### Returns
456
+
457
+ `LevelLogger`
458
+
459
+ ## Properties
460
+
461
+ ### level
462
+
463
+ ```ts
464
+ readonly level: LogLevelValue;
465
+ ```
466
+
467
+ ***
468
+
469
+ ### logger
470
+
471
+ ```ts
472
+ readonly logger: Logger;
473
+ ```
474
+
475
+ ## Accessors
476
+
477
+ ### debug
478
+
479
+ ### Get Signature
480
+
481
+ ```ts
482
+ get debug(): LogFunction;
483
+ ```
484
+
485
+ #### Returns
486
+
487
+ [`LogFunction`](#../type-aliases/LogFunction)
488
+
489
+ ### Implementation of
490
+
491
+ [`Logger`](#../interfaces/Logger).[`debug`](../interfaces/Logger.md#debug)
492
+
493
+ ***
494
+
495
+ ### error
496
+
497
+ ### Get Signature
498
+
499
+ ```ts
500
+ get error(): LogFunction;
501
+ ```
502
+
503
+ #### Returns
504
+
505
+ [`LogFunction`](#../type-aliases/LogFunction)
506
+
507
+ ### Implementation of
508
+
509
+ [`Logger`](#../interfaces/Logger).[`error`](../interfaces/Logger.md#error)
510
+
511
+ ***
512
+
513
+ ### info
514
+
515
+ ### Get Signature
516
+
517
+ ```ts
518
+ get info(): LogFunction;
519
+ ```
520
+
521
+ #### Returns
522
+
523
+ [`LogFunction`](#../type-aliases/LogFunction)
524
+
525
+ ### Implementation of
526
+
527
+ [`Logger`](#../interfaces/Logger).[`info`](../interfaces/Logger.md#info)
528
+
529
+ ***
530
+
531
+ ### log
532
+
533
+ ### Get Signature
534
+
535
+ ```ts
536
+ get log(): LogFunction;
537
+ ```
538
+
539
+ #### Returns
540
+
541
+ [`LogFunction`](#../type-aliases/LogFunction)
542
+
543
+ ### Implementation of
544
+
545
+ [`Logger`](#../interfaces/Logger).[`log`](../interfaces/Logger.md#log)
546
+
547
+ ***
548
+
549
+ ### trace
550
+
551
+ ### Get Signature
552
+
553
+ ```ts
554
+ get trace(): LogFunction;
555
+ ```
556
+
557
+ #### Returns
558
+
559
+ [`LogFunction`](#../type-aliases/LogFunction)
560
+
561
+ ### Implementation of
562
+
563
+ [`Logger`](#../interfaces/Logger).[`trace`](../interfaces/Logger.md#trace)
564
+
565
+ ***
566
+
567
+ ### warn
568
+
569
+ ### Get Signature
570
+
571
+ ```ts
572
+ get warn(): LogFunction;
573
+ ```
574
+
575
+ #### Returns
576
+
577
+ [`LogFunction`](#../type-aliases/LogFunction)
578
+
579
+ ### Implementation of
580
+
581
+ [`Logger`](#../interfaces/Logger).[`warn`](../interfaces/Logger.md#warn)
582
+
583
+ ### <a id="SilentLogger"></a>SilentLogger
584
+
585
+ [**@xylabs/logger**](#../README)
586
+
587
+ ***
588
+
589
+ A logger that does not log anything.
590
+ This is useful when you want to disable logging
591
+ like when running unit tests or in silent mode.
592
+ It implements the `Logger` interface but all methods
593
+ are no-op functions.
594
+
595
+ ## Implements
596
+
597
+ - [`Logger`](#../interfaces/Logger)
598
+
599
+ ## Constructors
600
+
601
+ ### Constructor
602
+
603
+ ```ts
604
+ new SilentLogger(): SilentLogger;
605
+ ```
606
+
607
+ ### Returns
608
+
609
+ `SilentLogger`
610
+
611
+ ## Properties
612
+
613
+ ### debug()
614
+
615
+ ```ts
616
+ readonly debug: (..._data) => undefined = NoOpLogFunction;
617
+ ```
618
+
619
+ ### Parameters
620
+
621
+ #### \_data
622
+
623
+ ...`unknown`[]
624
+
625
+ ### Returns
626
+
627
+ `undefined`
628
+
629
+ ### Implementation of
630
+
631
+ [`Logger`](#../interfaces/Logger).[`debug`](../interfaces/Logger.md#debug)
632
+
633
+ ***
634
+
635
+ ### error()
636
+
637
+ ```ts
638
+ readonly error: (..._data) => undefined = NoOpLogFunction;
639
+ ```
640
+
641
+ ### Parameters
642
+
643
+ #### \_data
644
+
645
+ ...`unknown`[]
646
+
647
+ ### Returns
648
+
649
+ `undefined`
650
+
651
+ ### Implementation of
652
+
653
+ [`Logger`](#../interfaces/Logger).[`error`](../interfaces/Logger.md#error)
654
+
655
+ ***
656
+
657
+ ### info()
658
+
659
+ ```ts
660
+ readonly info: (..._data) => undefined = NoOpLogFunction;
661
+ ```
662
+
663
+ ### Parameters
664
+
665
+ #### \_data
666
+
667
+ ...`unknown`[]
668
+
669
+ ### Returns
670
+
671
+ `undefined`
672
+
673
+ ### Implementation of
674
+
675
+ [`Logger`](#../interfaces/Logger).[`info`](../interfaces/Logger.md#info)
676
+
677
+ ***
678
+
679
+ ### log()
680
+
681
+ ```ts
682
+ readonly log: (..._data) => undefined = NoOpLogFunction;
683
+ ```
684
+
685
+ ### Parameters
686
+
687
+ #### \_data
688
+
689
+ ...`unknown`[]
690
+
691
+ ### Returns
692
+
693
+ `undefined`
694
+
695
+ ### Implementation of
696
+
697
+ [`Logger`](#../interfaces/Logger).[`log`](../interfaces/Logger.md#log)
698
+
699
+ ***
700
+
701
+ ### trace()
702
+
703
+ ```ts
704
+ readonly trace: (..._data) => undefined = NoOpLogFunction;
705
+ ```
706
+
707
+ ### Parameters
708
+
709
+ #### \_data
710
+
711
+ ...`unknown`[]
712
+
713
+ ### Returns
714
+
715
+ `undefined`
716
+
717
+ ### Implementation of
718
+
719
+ [`Logger`](#../interfaces/Logger).[`trace`](../interfaces/Logger.md#trace)
720
+
721
+ ***
722
+
723
+ ### warn()
724
+
725
+ ```ts
726
+ readonly warn: (..._data) => undefined = NoOpLogFunction;
727
+ ```
728
+
729
+ ### Parameters
730
+
731
+ #### \_data
732
+
733
+ ...`unknown`[]
734
+
735
+ ### Returns
736
+
737
+ `undefined`
738
+
739
+ ### Implementation of
740
+
741
+ [`Logger`](#../interfaces/Logger).[`warn`](../interfaces/Logger.md#warn)
742
+
743
+ ### functions
744
+
745
+ ### <a id="NoOpLogFunction"></a>NoOpLogFunction
746
+
747
+ [**@xylabs/logger**](#../README)
748
+
749
+ ***
750
+
751
+ ```ts
752
+ function NoOpLogFunction(..._data): undefined;
753
+ ```
754
+
755
+ ## Parameters
756
+
757
+ ### \_data
758
+
759
+ ...`unknown`[]
760
+
761
+ ## Returns
762
+
763
+ `undefined`
764
+
765
+ ### <a id="getFunctionName"></a>getFunctionName
766
+
767
+ [**@xylabs/logger**](#../README)
768
+
769
+ ***
770
+
771
+ ```ts
772
+ function getFunctionName(depth): string;
773
+ ```
774
+
775
+ ## Parameters
776
+
777
+ ### depth
778
+
779
+ `number` = `2`
780
+
781
+ ## Returns
782
+
783
+ `string`
784
+
785
+ ### interfaces
786
+
787
+ ### <a id="Logger"></a>Logger
788
+
789
+ [**@xylabs/logger**](#../README)
790
+
791
+ ***
792
+
793
+ Interface to handle overlap between Winston &
794
+ `console` with as much congruency as possible.
795
+
796
+ ## Properties
797
+
798
+ ### debug
799
+
800
+ ```ts
801
+ debug: LogFunction;
802
+ ```
803
+
804
+ ***
805
+
806
+ ### error
807
+
808
+ ```ts
809
+ error: LogFunction;
810
+ ```
811
+
812
+ ***
813
+
814
+ ### info
815
+
816
+ ```ts
817
+ info: LogFunction;
818
+ ```
819
+
820
+ ***
821
+
822
+ ### log
823
+
824
+ ```ts
825
+ log: LogFunction;
826
+ ```
827
+
828
+ ***
829
+
830
+ ### trace
831
+
832
+ ```ts
833
+ trace: LogFunction;
834
+ ```
835
+
836
+ ***
837
+
838
+ ### warn
839
+
840
+ ```ts
841
+ warn: LogFunction;
842
+ ```
843
+
844
+ ### type-aliases
845
+
846
+ ### <a id="LogFunction"></a>LogFunction
847
+
848
+ [**@xylabs/logger**](#../README)
849
+
850
+ ***
851
+
852
+ ```ts
853
+ type LogFunction = (...data) => void;
854
+ ```
855
+
856
+ ## Parameters
857
+
858
+ ### data
859
+
860
+ ...`unknown`[]
861
+
862
+ ## Returns
863
+
864
+ `void`
865
+
866
+ ### <a id="LogLevel"></a>LogLevel
867
+
868
+ [**@xylabs/logger**](#../README)
869
+
870
+ ***
871
+
872
+ ```ts
873
+ type LogLevel = LogLevelValue;
874
+ ```
875
+
876
+ ## Deprecated
877
+
878
+ Use `LogLevelValue` instead.
879
+ This name conflicts with the `LogLevel` enum and
880
+ makes it confusing to import
881
+
882
+ ### <a id="LogLevelKey"></a>LogLevelKey
883
+
884
+ [**@xylabs/logger**](#../README)
885
+
886
+ ***
887
+
888
+ ```ts
889
+ type LogLevelKey = EnumKey<typeof LogLevel>;
890
+ ```
891
+
892
+ ### <a id="LogLevelValue"></a>LogLevelValue
893
+
894
+ [**@xylabs/logger**](#../README)
895
+
896
+ ***
897
+
898
+ ```ts
899
+ type LogLevelValue = EnumValue<typeof LogLevel>;
900
+ ```
901
+
902
+ ### <a id="LogVerbosity"></a>LogVerbosity
903
+
904
+ [**@xylabs/logger**](#../README)
905
+
906
+ ***
907
+
908
+ ```ts
909
+ type LogVerbosity = LogLevelKey;
910
+ ```
911
+
912
+ ### variables
913
+
914
+ ### <a id="LogLevel"></a>LogLevel
915
+
916
+ [**@xylabs/logger**](#../README)
917
+
918
+ ***
919
+
920
+ ```ts
921
+ const LogLevel: Enum<{
922
+ error: 1;
923
+ warn: 2;
924
+ info: 3;
925
+ log: 4;
926
+ debug: 5;
927
+ trace: 6;
928
+ }>;
929
+ ```
20
930
 
21
- Coming Soon!
22
931
 
23
932
  Part of [sdk-js](https://www.npmjs.com/package/@xyo-network/sdk-js)
24
933
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xylabs/logger",
3
- "version": "4.13.20",
3
+ "version": "4.13.22",
4
4
  "description": "XYLabs Logger Library",
5
5
  "keywords": [
6
6
  "logger",
@@ -42,12 +42,12 @@
42
42
  "src"
43
43
  ],
44
44
  "dependencies": {
45
- "@xylabs/enum": "^4.13.20",
46
- "@xylabs/error": "^4.13.20",
47
- "@xylabs/typeof": "^4.13.20"
45
+ "@xylabs/enum": "^4.13.22",
46
+ "@xylabs/error": "^4.13.22",
47
+ "@xylabs/typeof": "^4.13.22"
48
48
  },
49
49
  "devDependencies": {
50
- "@types/node": "^24.0.14",
50
+ "@types/node": "^24.0.15",
51
51
  "@xylabs/ts-scripts-yarn3": "^7.0.0",
52
52
  "@xylabs/tsconfig": "^7.0.0",
53
53
  "typescript": "^5.8.3",