standard-log 13.0.0 → 13.0.2

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 (132) hide show
  1. package/cjs/_virtual/_rolldown/runtime.js +23 -0
  2. package/cjs/console.d.ts +10 -7
  3. package/cjs/console.d.ts.map +1 -1
  4. package/cjs/console.js +54 -69
  5. package/cjs/console.js.map +1 -1
  6. package/cjs/errors.d.ts +9 -6
  7. package/cjs/errors.d.ts.map +1 -1
  8. package/cjs/errors.js +22 -45
  9. package/cjs/errors.js.map +1 -1
  10. package/cjs/formatter.d.ts +9 -6
  11. package/cjs/formatter.d.ts.map +1 -1
  12. package/cjs/formatter.js +42 -49
  13. package/cjs/formatter.js.map +1 -1
  14. package/cjs/index.d.ts +8 -9
  15. package/cjs/index.js +26 -28
  16. package/cjs/log_levels.d.ts +76 -73
  17. package/cjs/log_levels.d.ts.map +1 -1
  18. package/cjs/log_levels.js +104 -110
  19. package/cjs/log_levels.js.map +1 -1
  20. package/cjs/log_store.d.ts +20 -17
  21. package/cjs/log_store.d.ts.map +1 -1
  22. package/cjs/log_store.js +44 -39
  23. package/cjs/log_store.js.map +1 -1
  24. package/cjs/logger.d.ts +6 -3
  25. package/cjs/logger.d.ts.map +1 -1
  26. package/cjs/logger.js +66 -87
  27. package/cjs/logger.js.map +1 -1
  28. package/cjs/memory.d.ts +20 -17
  29. package/cjs/memory.d.ts.map +1 -1
  30. package/cjs/memory.js +55 -62
  31. package/cjs/memory.js.map +1 -1
  32. package/cjs/platform.browser.d.ts +7 -4
  33. package/cjs/platform.browser.d.ts.map +1 -1
  34. package/cjs/platform.browser.js +8 -6
  35. package/cjs/platform.browser.js.map +1 -1
  36. package/cjs/platform.d.ts +7 -4
  37. package/cjs/platform.d.ts.map +1 -1
  38. package/cjs/platform.js +9 -7
  39. package/cjs/platform.js.map +1 -1
  40. package/cjs/standard_log.ctx.d.ts +11 -8
  41. package/cjs/standard_log.ctx.d.ts.map +1 -1
  42. package/cjs/standard_log.ctx.js +6 -5
  43. package/cjs/standard_log.ctx.js.map +1 -1
  44. package/cjs/standard_log.d.ts +14 -12
  45. package/cjs/standard_log.d.ts.map +1 -1
  46. package/cjs/standard_log.js +84 -112
  47. package/cjs/standard_log.js.map +1 -1
  48. package/cjs/standard_log.testing.d.ts +16 -13
  49. package/cjs/standard_log.testing.d.ts.map +1 -1
  50. package/cjs/standard_log.testing.js +20 -35
  51. package/cjs/standard_log.testing.js.map +1 -1
  52. package/cjs/testing/index.d.ts +3 -3
  53. package/cjs/testing/index.js +3 -6
  54. package/cjs/types.d.ts +125 -124
  55. package/cjs/types.d.ts.map +1 -1
  56. package/cjs/types.js +0 -3
  57. package/dist/standard-log.esm.js +874 -1401
  58. package/dist/standard-log.esm.js.map +1 -1
  59. package/dist/standard-log.iife.js +952 -0
  60. package/dist/standard-log.iife.js.map +1 -0
  61. package/esm/console.d.ts +10 -7
  62. package/esm/console.d.ts.map +1 -1
  63. package/esm/console.js +54 -62
  64. package/esm/console.js.map +1 -1
  65. package/esm/errors.d.ts +9 -6
  66. package/esm/errors.d.ts.map +1 -1
  67. package/esm/errors.js +21 -21
  68. package/esm/errors.js.map +1 -1
  69. package/esm/formatter.d.ts +9 -6
  70. package/esm/formatter.d.ts.map +1 -1
  71. package/esm/formatter.js +38 -31
  72. package/esm/formatter.js.map +1 -1
  73. package/esm/index.d.ts +8 -9
  74. package/esm/index.js +7 -7
  75. package/esm/log_levels.d.ts +76 -73
  76. package/esm/log_levels.d.ts.map +1 -1
  77. package/esm/log_levels.js +102 -107
  78. package/esm/log_levels.js.map +1 -1
  79. package/esm/log_store.d.ts +20 -17
  80. package/esm/log_store.d.ts.map +1 -1
  81. package/esm/log_store.js +44 -37
  82. package/esm/log_store.js.map +1 -1
  83. package/esm/logger.d.ts +6 -3
  84. package/esm/logger.d.ts.map +1 -1
  85. package/esm/logger.js +66 -65
  86. package/esm/logger.js.map +1 -1
  87. package/esm/memory.d.ts +20 -17
  88. package/esm/memory.d.ts.map +1 -1
  89. package/esm/memory.js +55 -60
  90. package/esm/memory.js.map +1 -1
  91. package/esm/platform.browser.d.ts +7 -4
  92. package/esm/platform.browser.d.ts.map +1 -1
  93. package/esm/platform.browser.js +7 -3
  94. package/esm/platform.browser.js.map +1 -1
  95. package/esm/platform.d.ts +7 -4
  96. package/esm/platform.d.ts.map +1 -1
  97. package/esm/platform.js +8 -4
  98. package/esm/platform.js.map +1 -1
  99. package/esm/standard_log.ctx.d.ts +11 -8
  100. package/esm/standard_log.ctx.d.ts.map +1 -1
  101. package/esm/standard_log.ctx.js +6 -2
  102. package/esm/standard_log.ctx.js.map +1 -1
  103. package/esm/standard_log.d.ts +14 -12
  104. package/esm/standard_log.d.ts.map +1 -1
  105. package/esm/standard_log.js +83 -98
  106. package/esm/standard_log.js.map +1 -1
  107. package/esm/standard_log.testing.d.ts +16 -13
  108. package/esm/standard_log.testing.d.ts.map +1 -1
  109. package/esm/standard_log.testing.js +19 -20
  110. package/esm/standard_log.testing.js.map +1 -1
  111. package/esm/testing/index.d.ts +3 -3
  112. package/esm/testing/index.js +2 -2
  113. package/esm/types.d.ts +125 -124
  114. package/esm/types.d.ts.map +1 -1
  115. package/esm/types.js +0 -1
  116. package/package.json +8 -42
  117. package/cjs/index.d.ts.map +0 -1
  118. package/cjs/index.js.map +0 -1
  119. package/cjs/testing/index.d.ts.map +0 -1
  120. package/cjs/testing/index.js.map +0 -1
  121. package/cjs/types.js.map +0 -1
  122. package/dist/standard-log.es5.js +0 -10628
  123. package/dist/standard-log.es5.js.gz +0 -0
  124. package/dist/standard-log.es5.js.map +0 -1
  125. package/dist/standard-log.es5.js.map.gz +0 -0
  126. package/dist/standard-log.esm.js.gz +0 -0
  127. package/dist/standard-log.esm.js.map.gz +0 -0
  128. package/esm/index.d.ts.map +0 -1
  129. package/esm/index.js.map +0 -1
  130. package/esm/testing/index.d.ts.map +0 -1
  131. package/esm/testing/index.js.map +0 -1
  132. package/esm/types.js.map +0 -1
@@ -1,81 +1,84 @@
1
- export declare const logLevels: {
2
- /**
3
- * none: 0
4
- */
5
- none: 0;
6
- /**
7
- * emergency: 100
8
- *
9
- * emergency -> alert
10
- */
11
- emergency: 100;
12
- /**
13
- * alert: 200
14
- *
15
- * emergency -> alert -> critical
16
- */
17
- alert: 200;
18
- /**
19
- * critical: 300
20
- *
21
- * alert -> critical -> error
22
- */
23
- critical: 300;
24
- /**
25
- * error: 400
26
- *
27
- * critical -> error -> warn
28
- */
29
- error: 400;
30
- /**
31
- * warn: 500
32
- *
33
- * error -> warn -> notice
34
- */
35
- warn: 500;
36
- /**
37
- * notice: 600
38
- *
39
- * warn -> notice -> info
40
- */
41
- notice: 600;
42
- /**
43
- * info: 700
44
- *
45
- * notice -> info -> debug
46
- */
47
- info: 700;
48
- /**
49
- * debug: 800
50
- *
51
- * info -> debug -> trace
52
- */
53
- debug: 800;
54
- /**
55
- * trace: 900
56
- *
57
- * debug -> trace -> planck
58
- */
59
- trace: 900;
60
- /**
61
- * planck: Infinity
62
- * `planck unit` is a very small unit <https://en.wikipedia.org/wiki/Planck_units>.
63
- *
64
- * trace -> planck
65
- */
66
- planck: number;
67
- /**
68
- * all: Infinity
69
- */
70
- all: number;
1
+ //#region ts/log_levels.d.ts
2
+ declare const logLevels: {
3
+ /**
4
+ * none: 0
5
+ */
6
+ none: 0;
7
+ /**
8
+ * emergency: 100
9
+ *
10
+ * emergency -> alert
11
+ */
12
+ emergency: 100;
13
+ /**
14
+ * alert: 200
15
+ *
16
+ * emergency -> alert -> critical
17
+ */
18
+ alert: 200;
19
+ /**
20
+ * critical: 300
21
+ *
22
+ * alert -> critical -> error
23
+ */
24
+ critical: 300;
25
+ /**
26
+ * error: 400
27
+ *
28
+ * critical -> error -> warn
29
+ */
30
+ error: 400;
31
+ /**
32
+ * warn: 500
33
+ *
34
+ * error -> warn -> notice
35
+ */
36
+ warn: 500;
37
+ /**
38
+ * notice: 600
39
+ *
40
+ * warn -> notice -> info
41
+ */
42
+ notice: 600;
43
+ /**
44
+ * info: 700
45
+ *
46
+ * notice -> info -> debug
47
+ */
48
+ info: 700;
49
+ /**
50
+ * debug: 800
51
+ *
52
+ * info -> debug -> trace
53
+ */
54
+ debug: 800;
55
+ /**
56
+ * trace: 900
57
+ *
58
+ * debug -> trace -> planck
59
+ */
60
+ trace: 900;
61
+ /**
62
+ * planck: Infinity
63
+ * `planck unit` is a very small unit <https://en.wikipedia.org/wiki/Planck_units>.
64
+ *
65
+ * trace -> planck
66
+ */
67
+ planck: number;
68
+ /**
69
+ * all: Infinity
70
+ */
71
+ all: number;
71
72
  };
72
73
  /**
73
74
  * Convert default log level value to log level name.
74
75
  */
75
- export declare function toLogLevelName(level: number): "emergency" | "alert" | "critical" | "error" | "warn" | "notice" | "info" | "debug" | "trace" | "planck";
76
+ declare function toLogLevelName(level: number): "alert" | "critical" | "debug" | "emergency" | "error" | "info" | "notice" | "planck" | "trace" | "warn";
76
77
  /**
77
78
  * Convert default log level name to log level value.
78
79
  */
79
- export declare function toLogLevel(name: string): number | undefined;
80
- export declare const DEFAULT_LOG_METHOD_NAMES: string[];
80
+ declare function toLogLevel(name: string): number | undefined;
81
+ declare const DEFAULT_LOG_METHOD_NAMES: string[];
82
+ //#endregion
83
+ export { DEFAULT_LOG_METHOD_NAMES, logLevels, toLogLevel, toLogLevelName };
81
84
  //# sourceMappingURL=log_levels.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"log_levels.d.ts","sourceRoot":"","sources":["../ts/log_levels.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS;IACrB;;OAEG;;IAEH;;;;OAIG;;IAEH;;;;OAIG;;IAEH;;;;OAIG;;IAEH;;;;OAIG;;IAEH;;;;OAIG;;IAEH;;;;OAIG;;IAEH;;;;OAIG;;IAEH;;;;OAIG;;IAEH;;;;OAIG;;IAEH;;;;;OAKG;;IAEH;;OAEG;;CAEH,CAAA;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,4GAW3C;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAE3D;AAED,eAAO,MAAM,wBAAwB,EAAE,MAAM,EAW5C,CAAA"}
1
+ {"version":3,"file":"log_levels.d.ts","names":[],"sources":["../ts/log_levels.ts"],"mappings":";cAAa;;;;EAIZ;;;;;;EAMA;;;;;;EAMA;;;;;;EAMA;;;;;;EAMA;;;;;;EAMA;;;;;;EAMA;;;;;;EAMA;;;;;;EAMA;;;;;;EAMA;;;;;;;EAOA;;;;EAIA;;;;;iBAMe,eAAe;;;;iBAgBf,WAAW;cAId"}
package/cjs/log_levels.js CHANGED
@@ -1,119 +1,113 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DEFAULT_LOG_METHOD_NAMES = exports.logLevels = void 0;
4
- exports.toLogLevelName = toLogLevelName;
5
- exports.toLogLevel = toLogLevel;
6
- exports.logLevels = {
7
- /**
8
- * none: 0
9
- */
10
- none: 0,
11
- /**
12
- * emergency: 100
13
- *
14
- * emergency -> alert
15
- */
16
- emergency: 100,
17
- /**
18
- * alert: 200
19
- *
20
- * emergency -> alert -> critical
21
- */
22
- alert: 200,
23
- /**
24
- * critical: 300
25
- *
26
- * alert -> critical -> error
27
- */
28
- critical: 300,
29
- /**
30
- * error: 400
31
- *
32
- * critical -> error -> warn
33
- */
34
- error: 400,
35
- /**
36
- * warn: 500
37
- *
38
- * error -> warn -> notice
39
- */
40
- warn: 500,
41
- /**
42
- * notice: 600
43
- *
44
- * warn -> notice -> info
45
- */
46
- notice: 600,
47
- /**
48
- * info: 700
49
- *
50
- * notice -> info -> debug
51
- */
52
- info: 700,
53
- /**
54
- * debug: 800
55
- *
56
- * info -> debug -> trace
57
- */
58
- debug: 800,
59
- /**
60
- * trace: 900
61
- *
62
- * debug -> trace -> planck
63
- */
64
- trace: 900,
65
- /**
66
- * planck: Infinity
67
- * `planck unit` is a very small unit <https://en.wikipedia.org/wiki/Planck_units>.
68
- *
69
- * trace -> planck
70
- */
71
- planck: Number.POSITIVE_INFINITY,
72
- /**
73
- * all: Infinity
74
- */
75
- all: Number.POSITIVE_INFINITY
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ //#region ts/log_levels.ts
3
+ const logLevels = {
4
+ /**
5
+ * none: 0
6
+ */
7
+ none: 0,
8
+ /**
9
+ * emergency: 100
10
+ *
11
+ * emergency -> alert
12
+ */
13
+ emergency: 100,
14
+ /**
15
+ * alert: 200
16
+ *
17
+ * emergency -> alert -> critical
18
+ */
19
+ alert: 200,
20
+ /**
21
+ * critical: 300
22
+ *
23
+ * alert -> critical -> error
24
+ */
25
+ critical: 300,
26
+ /**
27
+ * error: 400
28
+ *
29
+ * critical -> error -> warn
30
+ */
31
+ error: 400,
32
+ /**
33
+ * warn: 500
34
+ *
35
+ * error -> warn -> notice
36
+ */
37
+ warn: 500,
38
+ /**
39
+ * notice: 600
40
+ *
41
+ * warn -> notice -> info
42
+ */
43
+ notice: 600,
44
+ /**
45
+ * info: 700
46
+ *
47
+ * notice -> info -> debug
48
+ */
49
+ info: 700,
50
+ /**
51
+ * debug: 800
52
+ *
53
+ * info -> debug -> trace
54
+ */
55
+ debug: 800,
56
+ /**
57
+ * trace: 900
58
+ *
59
+ * debug -> trace -> planck
60
+ */
61
+ trace: 900,
62
+ /**
63
+ * planck: Infinity
64
+ * `planck unit` is a very small unit <https://en.wikipedia.org/wiki/Planck_units>.
65
+ *
66
+ * trace -> planck
67
+ */
68
+ planck: Number.POSITIVE_INFINITY,
69
+ /**
70
+ * all: Infinity
71
+ */
72
+ all: Number.POSITIVE_INFINITY
76
73
  };
77
74
  /**
78
- * Convert default log level value to log level name.
79
- */
75
+ * Convert default log level value to log level name.
76
+ */
80
77
  function toLogLevelName(level) {
81
- if (level <= 100)
82
- return 'emergency';
83
- if (level <= 200)
84
- return 'alert';
85
- if (level <= 300)
86
- return 'critical';
87
- if (level <= 400)
88
- return 'error';
89
- if (level <= 500)
90
- return 'warn';
91
- if (level <= 600)
92
- return 'notice';
93
- if (level <= 700)
94
- return 'info';
95
- if (level <= 800)
96
- return 'debug';
97
- if (level <= 900)
98
- return 'trace';
99
- return 'planck';
78
+ if (level <= 100) return "emergency";
79
+ if (level <= 200) return "alert";
80
+ if (level <= 300) return "critical";
81
+ if (level <= 400) return "error";
82
+ if (level <= 500) return "warn";
83
+ if (level <= 600) return "notice";
84
+ if (level <= 700) return "info";
85
+ if (level <= 800) return "debug";
86
+ if (level <= 900) return "trace";
87
+ return "planck";
100
88
  }
101
89
  /**
102
- * Convert default log level name to log level value.
103
- */
90
+ * Convert default log level name to log level value.
91
+ */
104
92
  function toLogLevel(name) {
105
- return exports.logLevels[name.toLocaleLowerCase()];
93
+ return logLevels[name.toLocaleLowerCase()];
106
94
  }
107
- exports.DEFAULT_LOG_METHOD_NAMES = [
108
- 'emergency',
109
- 'alert',
110
- 'critical',
111
- 'error',
112
- 'warn',
113
- 'notice',
114
- 'info',
115
- 'debug',
116
- 'trace',
117
- 'planck'
95
+ const DEFAULT_LOG_METHOD_NAMES = [
96
+ "emergency",
97
+ "alert",
98
+ "critical",
99
+ "error",
100
+ "warn",
101
+ "notice",
102
+ "info",
103
+ "debug",
104
+ "trace",
105
+ "planck"
118
106
  ];
107
+ //#endregion
108
+ exports.DEFAULT_LOG_METHOD_NAMES = DEFAULT_LOG_METHOD_NAMES;
109
+ exports.logLevels = logLevels;
110
+ exports.toLogLevel = toLogLevel;
111
+ exports.toLogLevelName = toLogLevelName;
112
+
119
113
  //# sourceMappingURL=log_levels.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"log_levels.js","sourceRoot":"","sources":["../ts/log_levels.ts"],"names":[],"mappings":";;;AA2EA,wCAWC;AAKD,gCAEC;AA7FY,QAAA,SAAS,GAAG;IACxB;;OAEG;IACH,IAAI,EAAE,CAAU;IAChB;;;;OAIG;IACH,SAAS,EAAE,GAAY;IACvB;;;;OAIG;IACH,KAAK,EAAE,GAAY;IACnB;;;;OAIG;IACH,QAAQ,EAAE,GAAY;IACtB;;;;OAIG;IACH,KAAK,EAAE,GAAY;IACnB;;;;OAIG;IACH,IAAI,EAAE,GAAY;IAClB;;;;OAIG;IACH,MAAM,EAAE,GAAY;IACpB;;;;OAIG;IACH,IAAI,EAAE,GAAY;IAClB;;;;OAIG;IACH,KAAK,EAAE,GAAY;IACnB;;;;OAIG;IACH,KAAK,EAAE,GAAY;IACnB;;;;;OAKG;IACH,MAAM,EAAE,MAAM,CAAC,iBAAiB;IAChC;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC,iBAAiB;CAC7B,CAAA;AAED;;GAEG;AACH,SAAgB,cAAc,CAAC,KAAa;IAC3C,IAAI,KAAK,IAAI,GAAG;QAAE,OAAO,WAAW,CAAA;IACpC,IAAI,KAAK,IAAI,GAAG;QAAE,OAAO,OAAO,CAAA;IAChC,IAAI,KAAK,IAAI,GAAG;QAAE,OAAO,UAAU,CAAA;IACnC,IAAI,KAAK,IAAI,GAAG;QAAE,OAAO,OAAO,CAAA;IAChC,IAAI,KAAK,IAAI,GAAG;QAAE,OAAO,MAAM,CAAA;IAC/B,IAAI,KAAK,IAAI,GAAG;QAAE,OAAO,QAAQ,CAAA;IACjC,IAAI,KAAK,IAAI,GAAG;QAAE,OAAO,MAAM,CAAA;IAC/B,IAAI,KAAK,IAAI,GAAG;QAAE,OAAO,OAAO,CAAA;IAChC,IAAI,KAAK,IAAI,GAAG;QAAE,OAAO,OAAO,CAAA;IAChC,OAAO,QAAQ,CAAA;AAChB,CAAC;AAED;;GAEG;AACH,SAAgB,UAAU,CAAC,IAAY;IACtC,OAAQ,iBAAiB,CAAC,IAAI,CAAC,iBAAiB,EAAE,CAAC,CAAA;AACpD,CAAC;AAEY,QAAA,wBAAwB,GAAa;IACjD,WAAW;IACX,OAAO;IACP,UAAU;IACV,OAAO;IACP,MAAM;IACN,QAAQ;IACR,MAAM;IACN,OAAO;IACP,OAAO;IACP,QAAQ;CACR,CAAA","sourcesContent":["export const logLevels = {\n\t/**\n\t * none: 0\n\t */\n\tnone: 0 as const,\n\t/**\n\t * emergency: 100\n\t *\n\t * emergency -> alert\n\t */\n\temergency: 100 as const,\n\t/**\n\t * alert: 200\n\t *\n\t * emergency -> alert -> critical\n\t */\n\talert: 200 as const,\n\t/**\n\t * critical: 300\n\t *\n\t * alert -> critical -> error\n\t */\n\tcritical: 300 as const,\n\t/**\n\t * error: 400\n\t *\n\t * critical -> error -> warn\n\t */\n\terror: 400 as const,\n\t/**\n\t * warn: 500\n\t *\n\t * error -> warn -> notice\n\t */\n\twarn: 500 as const,\n\t/**\n\t * notice: 600\n\t *\n\t * warn -> notice -> info\n\t */\n\tnotice: 600 as const,\n\t/**\n\t * info: 700\n\t *\n\t * notice -> info -> debug\n\t */\n\tinfo: 700 as const,\n\t/**\n\t * debug: 800\n\t *\n\t * info -> debug -> trace\n\t */\n\tdebug: 800 as const,\n\t/**\n\t * trace: 900\n\t *\n\t * debug -> trace -> planck\n\t */\n\ttrace: 900 as const,\n\t/**\n\t * planck: Infinity\n\t * `planck unit` is a very small unit <https://en.wikipedia.org/wiki/Planck_units>.\n\t *\n\t * trace -> planck\n\t */\n\tplanck: Number.POSITIVE_INFINITY,\n\t/**\n\t * all: Infinity\n\t */\n\tall: Number.POSITIVE_INFINITY\n}\n\n/**\n * Convert default log level value to log level name.\n */\nexport function toLogLevelName(level: number) {\n\tif (level <= 100) return 'emergency'\n\tif (level <= 200) return 'alert'\n\tif (level <= 300) return 'critical'\n\tif (level <= 400) return 'error'\n\tif (level <= 500) return 'warn'\n\tif (level <= 600) return 'notice'\n\tif (level <= 700) return 'info'\n\tif (level <= 800) return 'debug'\n\tif (level <= 900) return 'trace'\n\treturn 'planck'\n}\n\n/**\n * Convert default log level name to log level value.\n */\nexport function toLogLevel(name: string): number | undefined {\n\treturn (logLevels as any)[name.toLocaleLowerCase()]\n}\n\nexport const DEFAULT_LOG_METHOD_NAMES: string[] = [\n\t'emergency',\n\t'alert',\n\t'critical',\n\t'error',\n\t'warn',\n\t'notice',\n\t'info',\n\t'debug',\n\t'trace',\n\t'planck'\n]\n"]}
1
+ {"version":3,"file":"log_levels.js","names":[],"sources":["../ts/log_levels.ts"],"sourcesContent":["export const logLevels = {\n\t/**\n\t * none: 0\n\t */\n\tnone: 0 as const,\n\t/**\n\t * emergency: 100\n\t *\n\t * emergency -> alert\n\t */\n\temergency: 100 as const,\n\t/**\n\t * alert: 200\n\t *\n\t * emergency -> alert -> critical\n\t */\n\talert: 200 as const,\n\t/**\n\t * critical: 300\n\t *\n\t * alert -> critical -> error\n\t */\n\tcritical: 300 as const,\n\t/**\n\t * error: 400\n\t *\n\t * critical -> error -> warn\n\t */\n\terror: 400 as const,\n\t/**\n\t * warn: 500\n\t *\n\t * error -> warn -> notice\n\t */\n\twarn: 500 as const,\n\t/**\n\t * notice: 600\n\t *\n\t * warn -> notice -> info\n\t */\n\tnotice: 600 as const,\n\t/**\n\t * info: 700\n\t *\n\t * notice -> info -> debug\n\t */\n\tinfo: 700 as const,\n\t/**\n\t * debug: 800\n\t *\n\t * info -> debug -> trace\n\t */\n\tdebug: 800 as const,\n\t/**\n\t * trace: 900\n\t *\n\t * debug -> trace -> planck\n\t */\n\ttrace: 900 as const,\n\t/**\n\t * planck: Infinity\n\t * `planck unit` is a very small unit <https://en.wikipedia.org/wiki/Planck_units>.\n\t *\n\t * trace -> planck\n\t */\n\tplanck: Number.POSITIVE_INFINITY,\n\t/**\n\t * all: Infinity\n\t */\n\tall: Number.POSITIVE_INFINITY\n}\n\n/**\n * Convert default log level value to log level name.\n */\nexport function toLogLevelName(level: number) {\n\tif (level <= 100) return 'emergency'\n\tif (level <= 200) return 'alert'\n\tif (level <= 300) return 'critical'\n\tif (level <= 400) return 'error'\n\tif (level <= 500) return 'warn'\n\tif (level <= 600) return 'notice'\n\tif (level <= 700) return 'info'\n\tif (level <= 800) return 'debug'\n\tif (level <= 900) return 'trace'\n\treturn 'planck'\n}\n\n/**\n * Convert default log level name to log level value.\n */\nexport function toLogLevel(name: string): number | undefined {\n\treturn (logLevels as any)[name.toLocaleLowerCase()]\n}\n\nexport const DEFAULT_LOG_METHOD_NAMES: string[] = [\n\t'emergency',\n\t'alert',\n\t'critical',\n\t'error',\n\t'warn',\n\t'notice',\n\t'info',\n\t'debug',\n\t'trace',\n\t'planck'\n]\n"],"mappings":";;AAAA,MAAa,YAAY;;;;CAIxB,MAAM;;;;;;CAMN,WAAW;;;;;;CAMX,OAAO;;;;;;CAMP,UAAU;;;;;;CAMV,OAAO;;;;;;CAMP,MAAM;;;;;;CAMN,QAAQ;;;;;;CAMR,MAAM;;;;;;CAMN,OAAO;;;;;;CAMP,OAAO;;;;;;;CAOP,QAAQ,OAAO;;;;CAIf,KAAK,OAAO;AACb;;;;AAKA,SAAgB,eAAe,OAAe;CAC7C,IAAI,SAAS,KAAK,OAAO;CACzB,IAAI,SAAS,KAAK,OAAO;CACzB,IAAI,SAAS,KAAK,OAAO;CACzB,IAAI,SAAS,KAAK,OAAO;CACzB,IAAI,SAAS,KAAK,OAAO;CACzB,IAAI,SAAS,KAAK,OAAO;CACzB,IAAI,SAAS,KAAK,OAAO;CACzB,IAAI,SAAS,KAAK,OAAO;CACzB,IAAI,SAAS,KAAK,OAAO;CACzB,OAAO;AACR;;;;AAKA,SAAgB,WAAW,MAAkC;CAC5D,OAAQ,UAAkB,KAAK,kBAAkB;AAClD;AAEA,MAAa,2BAAqC;CACjD;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACD"}
@@ -1,21 +1,24 @@
1
- import type { Logger, LogLevel, LogMethodNames, LogReporter, StandardLogOptions } from './types.js';
2
- export declare function createLogStore<N extends string = LogMethodNames>(options: Required<StandardLogOptions<N>>): LogStore;
3
- export interface LogStore {
4
- loggers: Record<string, Logger>;
5
- nonConsoleLoggers: Record<string, Logger>;
6
- reporters: LogReporter[];
7
- logLevel: LogLevel;
8
- logLevelStore: ReturnType<typeof logLevelStore>;
1
+ import { LogLevel, LogMethodNames, LogReporter, Logger, StandardLogOptions } from "./types.js";
2
+ //#region ts/log_store.d.ts
3
+ declare function createLogStore<N extends string = LogMethodNames>(options: Required<StandardLogOptions<N>>): LogStore;
4
+ interface LogStore {
5
+ loggers: Record<string, Logger>;
6
+ nonConsoleLoggers: Record<string, Logger>;
7
+ reporters: LogReporter[];
8
+ logLevel: LogLevel;
9
+ logLevelStore: ReturnType<typeof logLevelStore>;
9
10
  }
10
- export interface LogLevelStoreOptions {
11
- customLevels?: Record<string, number>;
11
+ interface LogLevelStoreOptions {
12
+ customLevels?: Record<string, number>;
12
13
  }
13
- export declare function logLevelStore(options: LogLevelStoreOptions): {
14
- getName(level: number): string;
15
- getLevel(name: string): number;
16
- getAllLevels(): {
17
- name: string;
18
- level: number;
19
- }[];
14
+ declare function logLevelStore(options: LogLevelStoreOptions): {
15
+ getName(level: number): string;
16
+ getLevel(name: string): number;
17
+ getAllLevels(): {
18
+ name: string;
19
+ level: number;
20
+ }[];
20
21
  };
22
+ //#endregion
23
+ export { LogLevelStoreOptions, LogStore, createLogStore, logLevelStore };
21
24
  //# sourceMappingURL=log_store.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"log_store.d.ts","sourceRoot":"","sources":["../ts/log_store.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,cAAc,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAEnG,wBAAgB,cAAc,CAAC,CAAC,SAAS,MAAM,GAAG,cAAc,EAC/D,OAAO,EAAE,QAAQ,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,GACtC,QAAQ,CAQV;AAED,MAAM,WAAW,QAAQ;IACxB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC/B,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACzC,SAAS,EAAE,WAAW,EAAE,CAAA;IACxB,QAAQ,EAAE,QAAQ,CAAA;IAClB,aAAa,EAAE,UAAU,CAAC,OAAO,aAAa,CAAC,CAAA;CAC/C;AAED,MAAM,WAAW,oBAAoB;IACpC,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CACrC;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,oBAAoB;mBAe1C,MAAM;mBAGN,MAAM;;;;;EAetB"}
1
+ {"version":3,"file":"log_store.d.ts","names":[],"sources":["../ts/log_store.ts"],"mappings":";;iBAKgB,eAAe,mBAAmB,gBACjD,SAAS,SAAS,mBAAmB,MACnC;UAUc;EAChB,SAAS,eAAe;EACxB,mBAAmB,eAAe;EAClC,WAAW;EACX,UAAU;EACV,eAAe,kBAAkB;;UAGjB;EAChB,eAAe;;iBAGA,cAAc,SAAS;EAerC,QAAO;EAGP,SAAQ;EAGR"}
package/cjs/log_store.js CHANGED
@@ -1,44 +1,49 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createLogStore = createLogStore;
4
- exports.logLevelStore = logLevelStore;
5
- var type_plus_1 = require("type-plus");
6
- var console_js_1 = require("./console.js");
7
- var log_levels_js_1 = require("./log_levels.js");
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_log_levels = require("./log_levels.js");
3
+ const require_console = require("./console.js");
4
+ let type_plus = require("type-plus");
5
+ //#region ts/log_store.ts
8
6
  function createLogStore(options) {
9
- return {
10
- loggers: (0, type_plus_1.record)(),
11
- nonConsoleLoggers: (0, type_plus_1.record)(),
12
- reporters: options.reporters || [(0, console_js_1.createConsoleLogReporter)()],
13
- logLevel: options.logLevel,
14
- logLevelStore: logLevelStore(options)
15
- };
7
+ return {
8
+ loggers: (0, type_plus.record)(),
9
+ nonConsoleLoggers: (0, type_plus.record)(),
10
+ reporters: options.reporters || [require_console.createConsoleLogReporter()],
11
+ logLevel: options.logLevel,
12
+ logLevelStore: logLevelStore(options)
13
+ };
16
14
  }
17
15
  function logLevelStore(options) {
18
- var customLevels = options.customLevels || (0, type_plus_1.record)();
19
- var store = {
20
- customLevels: customLevels,
21
- customLevelsReverse: (0, type_plus_1.reduceByKey)(customLevels, function (p, k) {
22
- p[customLevels[k]] = k;
23
- return p;
24
- }, {})
25
- };
26
- return {
27
- getName: function (level) {
28
- var _a;
29
- return (_a = store.customLevelsReverse[level]) !== null && _a !== void 0 ? _a : (0, log_levels_js_1.toLogLevelName)(level);
30
- },
31
- getLevel: function (name) {
32
- var _a;
33
- return (_a = store.customLevels[name]) !== null && _a !== void 0 ? _a : (0, log_levels_js_1.toLogLevel)(name);
34
- },
35
- getAllLevels: function () {
36
- return (0, type_plus_1.reduceKey)(log_levels_js_1.logLevels, function (result, name) {
37
- if (name !== 'none' && name !== 'all')
38
- result.push({ name: name, level: log_levels_js_1.logLevels[name] });
39
- return result;
40
- }, (0, type_plus_1.mapKey)(store.customLevels, function (name) { return ({ name: name, level: store.customLevels[name] }); }));
41
- }
42
- };
16
+ const customLevels = options.customLevels || (0, type_plus.record)();
17
+ const store = {
18
+ customLevels,
19
+ customLevelsReverse: (0, type_plus.reduceByKey)(customLevels, (p, k) => {
20
+ p[customLevels[k]] = k;
21
+ return p;
22
+ }, {})
23
+ };
24
+ return {
25
+ getName(level) {
26
+ return store.customLevelsReverse[level] ?? require_log_levels.toLogLevelName(level);
27
+ },
28
+ getLevel(name) {
29
+ return store.customLevels[name] ?? require_log_levels.toLogLevel(name);
30
+ },
31
+ getAllLevels() {
32
+ return (0, type_plus.reduceKey)(require_log_levels.logLevels, (result, name) => {
33
+ if (name !== "none" && name !== "all") result.push({
34
+ name,
35
+ level: require_log_levels.logLevels[name]
36
+ });
37
+ return result;
38
+ }, (0, type_plus.mapKey)(store.customLevels, (name) => ({
39
+ name,
40
+ level: store.customLevels[name]
41
+ })));
42
+ }
43
+ };
43
44
  }
45
+ //#endregion
46
+ exports.createLogStore = createLogStore;
47
+ exports.logLevelStore = logLevelStore;
48
+
44
49
  //# sourceMappingURL=log_store.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"log_store.js","sourceRoot":"","sources":["../ts/log_store.ts"],"names":[],"mappings":";;AAKA,wCAUC;AAcD,sCAiCC;AA9DD,uCAAkE;AAClE,2CAAuD;AACvD,iDAAuE;AAGvE,SAAgB,cAAc,CAC7B,OAAwC;IAExC,OAAO;QACN,OAAO,EAAE,IAAA,kBAAM,GAAE;QACjB,iBAAiB,EAAE,IAAA,kBAAM,GAAE;QAC3B,SAAS,EAAE,OAAO,CAAC,SAAS,IAAI,CAAC,IAAA,qCAAwB,GAAE,CAAC;QAC5D,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,aAAa,EAAE,aAAa,CAAC,OAAO,CAAC;KACrC,CAAA;AACF,CAAC;AAcD,SAAgB,aAAa,CAAC,OAA6B;IAC1D,IAAM,YAAY,GAAG,OAAO,CAAC,YAAY,IAAI,IAAA,kBAAM,GAAE,CAAA;IAErD,IAAM,KAAK,GAAG;QACb,YAAY,cAAA;QACZ,mBAAmB,EAAE,IAAA,uBAAW,EAC/B,YAAY,EACZ,UAAC,CAAC,EAAE,CAAC;YACJ,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;YACtB,OAAO,CAAC,CAAA;QACT,CAAC,EACD,EAA4B,CAC5B;KACD,CAAA;IACD,OAAO;QACN,OAAO,YAAC,KAAa;;YACpB,OAAO,MAAA,KAAK,CAAC,mBAAmB,CAAC,KAAK,CAAC,mCAAI,IAAA,8BAAc,EAAC,KAAK,CAAC,CAAA;QACjE,CAAC;QACD,QAAQ,YAAC,IAAY;;YACpB,OAAO,MAAA,KAAK,CAAC,YAAY,CAAC,IAAI,CAAC,mCAAI,IAAA,0BAAU,EAAC,IAAI,CAAC,CAAA;QACpD,CAAC;QACD,YAAY;YACX,OAAO,IAAA,qBAAS,EACf,yBAAS,EACT,UAAC,MAAM,EAAE,IAAI;gBACZ,IAAI,IAAI,KAAK,MAAM,IAAI,IAAI,KAAK,KAAK;oBAAE,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,MAAA,EAAE,KAAK,EAAE,yBAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;gBAEpF,OAAO,MAAM,CAAA;YACd,CAAC,EACD,IAAA,kBAAM,EAAC,KAAK,CAAC,YAAY,EAAE,UAAA,IAAI,IAAI,OAAA,CAAC,EAAE,IAAI,MAAA,EAAE,KAAK,EAAE,KAAK,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC,EAA3C,CAA2C,CAAC,CAC/E,CAAA;QACF,CAAC;KACD,CAAA;AACF,CAAC","sourcesContent":["import { mapKey, record, reduceByKey, reduceKey } from 'type-plus'\nimport { createConsoleLogReporter } from './console.js'\nimport { logLevels, toLogLevel, toLogLevelName } from './log_levels.js'\nimport type { Logger, LogLevel, LogMethodNames, LogReporter, StandardLogOptions } from './types.js'\n\nexport function createLogStore<N extends string = LogMethodNames>(\n\toptions: Required<StandardLogOptions<N>>\n): LogStore {\n\treturn {\n\t\tloggers: record(),\n\t\tnonConsoleLoggers: record(),\n\t\treporters: options.reporters || [createConsoleLogReporter()],\n\t\tlogLevel: options.logLevel,\n\t\tlogLevelStore: logLevelStore(options)\n\t}\n}\n\nexport interface LogStore {\n\tloggers: Record<string, Logger>\n\tnonConsoleLoggers: Record<string, Logger>\n\treporters: LogReporter[]\n\tlogLevel: LogLevel\n\tlogLevelStore: ReturnType<typeof logLevelStore>\n}\n\nexport interface LogLevelStoreOptions {\n\tcustomLevels?: Record<string, number>\n}\n\nexport function logLevelStore(options: LogLevelStoreOptions) {\n\tconst customLevels = options.customLevels || record()\n\n\tconst store = {\n\t\tcustomLevels,\n\t\tcustomLevelsReverse: reduceByKey(\n\t\t\tcustomLevels,\n\t\t\t(p, k) => {\n\t\t\t\tp[customLevels[k]] = k\n\t\t\t\treturn p\n\t\t\t},\n\t\t\t{} as Record<number, string>\n\t\t)\n\t}\n\treturn {\n\t\tgetName(level: number) {\n\t\t\treturn store.customLevelsReverse[level] ?? toLogLevelName(level)\n\t\t},\n\t\tgetLevel(name: string) {\n\t\t\treturn store.customLevels[name] ?? toLogLevel(name)\n\t\t},\n\t\tgetAllLevels() {\n\t\t\treturn reduceKey(\n\t\t\t\tlogLevels,\n\t\t\t\t(result, name) => {\n\t\t\t\t\tif (name !== 'none' && name !== 'all') result.push({ name, level: logLevels[name] })\n\n\t\t\t\t\treturn result\n\t\t\t\t},\n\t\t\t\tmapKey(store.customLevels, name => ({ name, level: store.customLevels[name] }))\n\t\t\t)\n\t\t}\n\t}\n}\n"]}
1
+ {"version":3,"file":"log_store.js","names":["record","createConsoleLogReporter","reduceByKey","toLogLevelName","toLogLevel","reduceKey","logLevels","mapKey"],"sources":["../ts/log_store.ts"],"sourcesContent":["import { mapKey, record, reduceByKey, reduceKey } from 'type-plus'\nimport { createConsoleLogReporter } from './console.js'\nimport { logLevels, toLogLevel, toLogLevelName } from './log_levels.js'\nimport type { Logger, LogLevel, LogMethodNames, LogReporter, StandardLogOptions } from './types.js'\n\nexport function createLogStore<N extends string = LogMethodNames>(\n\toptions: Required<StandardLogOptions<N>>\n): LogStore {\n\treturn {\n\t\tloggers: record(),\n\t\tnonConsoleLoggers: record(),\n\t\treporters: options.reporters || [createConsoleLogReporter()],\n\t\tlogLevel: options.logLevel,\n\t\tlogLevelStore: logLevelStore(options)\n\t}\n}\n\nexport interface LogStore {\n\tloggers: Record<string, Logger>\n\tnonConsoleLoggers: Record<string, Logger>\n\treporters: LogReporter[]\n\tlogLevel: LogLevel\n\tlogLevelStore: ReturnType<typeof logLevelStore>\n}\n\nexport interface LogLevelStoreOptions {\n\tcustomLevels?: Record<string, number>\n}\n\nexport function logLevelStore(options: LogLevelStoreOptions) {\n\tconst customLevels = options.customLevels || record()\n\n\tconst store = {\n\t\tcustomLevels,\n\t\tcustomLevelsReverse: reduceByKey(\n\t\t\tcustomLevels,\n\t\t\t(p, k) => {\n\t\t\t\tp[customLevels[k]] = k\n\t\t\t\treturn p\n\t\t\t},\n\t\t\t{} as Record<number, string>\n\t\t)\n\t}\n\treturn {\n\t\tgetName(level: number) {\n\t\t\treturn store.customLevelsReverse[level] ?? toLogLevelName(level)\n\t\t},\n\t\tgetLevel(name: string) {\n\t\t\treturn store.customLevels[name] ?? toLogLevel(name)\n\t\t},\n\t\tgetAllLevels() {\n\t\t\treturn reduceKey(\n\t\t\t\tlogLevels,\n\t\t\t\t(result, name) => {\n\t\t\t\t\tif (name !== 'none' && name !== 'all') result.push({ name, level: logLevels[name] })\n\n\t\t\t\t\treturn result\n\t\t\t\t},\n\t\t\t\tmapKey(store.customLevels, name => ({ name, level: store.customLevels[name] }))\n\t\t\t)\n\t\t}\n\t}\n}\n"],"mappings":";;;;;AAKA,SAAgB,eACf,SACW;CACX,OAAO;EACN,UAAA,GAASA,UAAAA,OAAAA,CAAO;EAChB,oBAAA,GAAmBA,UAAAA,OAAAA,CAAO;EAC1B,WAAW,QAAQ,aAAa,CAACC,gBAAAA,yBAAyB,CAAC;EAC3D,UAAU,QAAQ;EAClB,eAAe,cAAc,OAAO;CACrC;AACD;AAcA,SAAgB,cAAc,SAA+B;CAC5D,MAAM,eAAe,QAAQ,iBAAA,GAAgBD,UAAAA,OAAAA,CAAO;CAEpD,MAAM,QAAQ;EACb;EACA,sBAAA,GAAqBE,UAAAA,YAAAA,CACpB,eACC,GAAG,MAAM;GACT,EAAE,aAAa,MAAM;GACrB,OAAO;EACR,GACA,CAAC,CACF;CACD;CACA,OAAO;EACN,QAAQ,OAAe;GACtB,OAAO,MAAM,oBAAoB,UAAUC,mBAAAA,eAAe,KAAK;EAChE;EACA,SAAS,MAAc;GACtB,OAAO,MAAM,aAAa,SAASC,mBAAAA,WAAW,IAAI;EACnD;EACA,eAAe;GACd,QAAA,GAAOC,UAAAA,UAAAA,CACNC,mBAAAA,YACC,QAAQ,SAAS;IACjB,IAAI,SAAS,UAAU,SAAS,OAAO,OAAO,KAAK;KAAE;KAAM,OAAOA,mBAAAA,UAAU;IAAM,CAAC;IAEnF,OAAO;GACR,IAAA,GACAC,UAAAA,OAAAA,CAAO,MAAM,eAAc,UAAS;IAAE;IAAM,OAAO,MAAM,aAAa;GAAM,EAAE,CAC/E;EACD;CACD;AACD"}
package/cjs/logger.d.ts CHANGED
@@ -1,4 +1,7 @@
1
- import type { LogStore } from './log_store.js';
2
- import type { Logger, LoggerOptions, LogMethodNames } from './types.js';
3
- export declare function createLogger<N extends string = LogMethodNames>(store: LogStore, id: string, options?: LoggerOptions): Logger<N | LogMethodNames>;
1
+ import { LogMethodNames, Logger, LoggerOptions } from "./types.js";
2
+ import { LogStore } from "./log_store.js";
3
+ //#region ts/logger.d.ts
4
+ declare function createLogger<N extends string = LogMethodNames>(store: LogStore, id: string, options?: LoggerOptions): Logger<N | LogMethodNames>;
5
+ //#endregion
6
+ export { createLogger };
4
7
  //# sourceMappingURL=logger.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../ts/logger.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAC9C,OAAO,KAAK,EAGX,MAAM,EACN,aAAa,EAEb,cAAc,EAEd,MAAM,YAAY,CAAA;AAEnB,wBAAgB,YAAY,CAAC,CAAC,SAAS,MAAM,GAAG,cAAc,EAC7D,KAAK,EAAE,QAAQ,EACf,EAAE,EAAE,MAAM,EACV,OAAO,CAAC,EAAE,aAAa,GACrB,MAAM,CAAC,CAAC,GAAG,cAAc,CAAC,CA4D5B"}
1
+ {"version":3,"file":"logger.d.ts","names":[],"sources":["../ts/logger.ts"],"mappings":";;;iBAYgB,aAAa,mBAAmB,gBAC/C,OAAO,UACP,YACA,UAAU,gBACR,OAAO,IAAI"}