logixia 1.13.3 → 2.0.4

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 (229) hide show
  1. package/README.md +117 -44
  2. package/dist/async-context-B05ArHgM.mjs +134 -0
  3. package/dist/async-context-B05ArHgM.mjs.map +1 -0
  4. package/dist/async-context-DTQgi8f7.js +150 -0
  5. package/dist/async-context-DTQgi8f7.js.map +1 -0
  6. package/dist/{azure-monitor.transport-CHnjVRF-.mjs → azure-monitor.transport-BPbgjATu.mjs} +27 -15
  7. package/dist/azure-monitor.transport-BPbgjATu.mjs.map +1 -0
  8. package/dist/{azure-monitor.transport-BDFO4F-i.d.ts → azure-monitor.transport-C7kYyZUW.d.mts} +3 -6
  9. package/dist/azure-monitor.transport-C7kYyZUW.d.mts.map +1 -0
  10. package/dist/{azure-monitor.transport-CrvfHd9C.js → azure-monitor.transport-CwbOLZHB.js} +32 -20
  11. package/dist/azure-monitor.transport-CwbOLZHB.js.map +1 -0
  12. package/dist/{azure-monitor.transport-D5wQEH04.d.mts → azure-monitor.transport-DV03Z5P4.d.ts} +3 -6
  13. package/dist/azure-monitor.transport-DV03Z5P4.d.ts.map +1 -0
  14. package/dist/azure.d.mts +1 -2
  15. package/dist/azure.d.ts +1 -2
  16. package/dist/azure.js +3 -6
  17. package/dist/azure.mjs +1 -6
  18. package/dist/{batch-buffer-PGvSgbmd.mjs → batch-buffer-0fgLmIPn.mjs} +21 -7
  19. package/dist/batch-buffer-0fgLmIPn.mjs.map +1 -0
  20. package/dist/{batch-buffer-BY-mRWIK.js → batch-buffer-DT4gdXmf.js} +53 -40
  21. package/dist/batch-buffer-DT4gdXmf.js.map +1 -0
  22. package/dist/browser.d.mts +52 -23
  23. package/dist/browser.d.mts.map +1 -1
  24. package/dist/browser.d.ts +52 -23
  25. package/dist/browser.d.ts.map +1 -1
  26. package/dist/browser.js +460 -62
  27. package/dist/browser.js.map +1 -1
  28. package/dist/browser.mjs +461 -65
  29. package/dist/browser.mjs.map +1 -1
  30. package/dist/{nestjs-extras-ImbuDhs1.mjs → builder-D70z6kjj.mjs} +279 -965
  31. package/dist/builder-D70z6kjj.mjs.map +1 -0
  32. package/dist/{nestjs-extras-DnJ6vrIC.js → builder-M7NoaugM.js} +421 -1177
  33. package/dist/builder-M7NoaugM.js.map +1 -0
  34. package/dist/cli/index.js +86 -67
  35. package/dist/cloudwatch.d.mts +1 -2
  36. package/dist/cloudwatch.d.ts +1 -2
  37. package/dist/cloudwatch.js +3 -7
  38. package/dist/cloudwatch.mjs +1 -7
  39. package/dist/{cloudwatch.transport-BO1ahxw-.js → cloudwatch.transport-B2wKQFF7.js} +61 -36
  40. package/dist/cloudwatch.transport-B2wKQFF7.js.map +1 -0
  41. package/dist/{cloudwatch.transport-DZ6ies7g.mjs → cloudwatch.transport-BTvYfLs9.mjs} +54 -28
  42. package/dist/cloudwatch.transport-BTvYfLs9.mjs.map +1 -0
  43. package/dist/{cloudwatch.transport-B00st6Xv.d.ts → cloudwatch.transport-Bf7L4I59.d.ts} +2 -6
  44. package/dist/cloudwatch.transport-Bf7L4I59.d.ts.map +1 -0
  45. package/dist/{cloudwatch.transport-Blc7Gtxt.d.mts → cloudwatch.transport-Rj4yTpRn.d.mts} +2 -6
  46. package/dist/cloudwatch.transport-Rj4yTpRn.d.mts.map +1 -0
  47. package/dist/{coerce.utils-Cu6IUTgX.mjs → coerce.utils-B_rEudCn.mjs} +3 -4
  48. package/dist/{coerce.utils-Cu6IUTgX.mjs.map → coerce.utils-B_rEudCn.mjs.map} +1 -1
  49. package/dist/{coerce.utils-B-LilukN.js → coerce.utils-C1C5sIX0.js} +8 -10
  50. package/dist/{coerce.utils-B-LilukN.js.map → coerce.utils-C1C5sIX0.js.map} +1 -1
  51. package/dist/correlation.d.mts +13 -16
  52. package/dist/correlation.d.mts.map +1 -1
  53. package/dist/correlation.d.ts +13 -16
  54. package/dist/correlation.d.ts.map +1 -1
  55. package/dist/correlation.js +58 -9
  56. package/dist/correlation.js.map +1 -1
  57. package/dist/correlation.mjs +56 -6
  58. package/dist/correlation.mjs.map +1 -1
  59. package/dist/{entry-fields-BJkuPnIg.mjs → entry-fields-CGuvT2R0.mjs} +5 -6
  60. package/dist/entry-fields-CGuvT2R0.mjs.map +1 -0
  61. package/dist/{entry-fields-BvOLFlJ4.js → entry-fields-RLd1jCoR.js} +10 -12
  62. package/dist/entry-fields-RLd1jCoR.js.map +1 -0
  63. package/dist/gcp.d.mts +1 -2
  64. package/dist/gcp.d.ts +1 -2
  65. package/dist/gcp.js +3 -7
  66. package/dist/gcp.mjs +1 -7
  67. package/dist/{gcp.transport-m4fVw0b1.d.ts → gcp.transport-C5D72b1g.d.mts} +3 -6
  68. package/dist/gcp.transport-C5D72b1g.d.mts.map +1 -0
  69. package/dist/{gcp.transport-zzNyIoih.d.mts → gcp.transport-CFQfdAOK.d.ts} +3 -6
  70. package/dist/gcp.transport-CFQfdAOK.d.ts.map +1 -0
  71. package/dist/{gcp.transport-DBX5TPIy.mjs → gcp.transport-CGKopAhQ.mjs} +55 -16
  72. package/dist/gcp.transport-CGKopAhQ.mjs.map +1 -0
  73. package/dist/{gcp.transport-CHV8MGgz.js → gcp.transport-KZe9hCAR.js} +60 -22
  74. package/dist/gcp.transport-KZe9hCAR.js.map +1 -0
  75. package/dist/{index-nZEeCr3X.d.ts → index-DwozbmB4.d.ts} +3 -8
  76. package/dist/index-DwozbmB4.d.ts.map +1 -0
  77. package/dist/{index-BPwEisy4.d.mts → index-xqaJtAZn.d.mts} +3 -8
  78. package/dist/index-xqaJtAZn.d.mts.map +1 -0
  79. package/dist/index.d.mts +141 -203
  80. package/dist/index.d.mts.map +1 -1
  81. package/dist/index.d.ts +140 -202
  82. package/dist/index.d.ts.map +1 -1
  83. package/dist/index.js +196 -381
  84. package/dist/index.js.map +1 -1
  85. package/dist/index.mjs +145 -294
  86. package/dist/index.mjs.map +1 -1
  87. package/dist/internal-log-b0Vp4qrB.js +183 -0
  88. package/dist/internal-log-b0Vp4qrB.js.map +1 -0
  89. package/dist/internal-log-uCSd1PMc.mjs +142 -0
  90. package/dist/internal-log-uCSd1PMc.mjs.map +1 -0
  91. package/dist/logitron-logger-D2B75Oc7.d.ts +365 -0
  92. package/dist/logitron-logger-D2B75Oc7.d.ts.map +1 -0
  93. package/dist/logitron-logger-oEd6wNhf.d.mts +365 -0
  94. package/dist/logitron-logger-oEd6wNhf.d.mts.map +1 -0
  95. package/dist/middleware.d.mts +10 -12
  96. package/dist/middleware.d.mts.map +1 -1
  97. package/dist/middleware.d.ts +10 -12
  98. package/dist/middleware.d.ts.map +1 -1
  99. package/dist/middleware.js +16 -47
  100. package/dist/middleware.js.map +1 -1
  101. package/dist/middleware.mjs +13 -45
  102. package/dist/middleware.mjs.map +1 -1
  103. package/dist/nest.d.mts +467 -10
  104. package/dist/nest.d.mts.map +1 -1
  105. package/dist/nest.d.ts +467 -10
  106. package/dist/nest.d.ts.map +1 -1
  107. package/dist/nest.js +889 -43
  108. package/dist/nest.js.map +1 -0
  109. package/dist/nest.mjs +850 -9
  110. package/dist/nest.mjs.map +1 -0
  111. package/dist/{trace.utils-CvXgaiQT.mjs → request-trace-C_fvIDv4.mjs} +44 -9
  112. package/dist/request-trace-C_fvIDv4.mjs.map +1 -0
  113. package/dist/{trace.utils-DpBOLDtq.js → request-trace-wTJdKp6-.js} +121 -77
  114. package/dist/request-trace-wTJdKp6-.js.map +1 -0
  115. package/dist/rolldown-runtime-D3PmRqjj.mjs +4 -0
  116. package/dist/{safe-stringify-DJ66tW5I.mjs → safe-stringify-BMRl3EX3.mjs} +3 -4
  117. package/dist/safe-stringify-BMRl3EX3.mjs.map +1 -0
  118. package/dist/{safe-stringify-DWo3aZp_.js → safe-stringify-DLz1Kz3o.js} +23 -25
  119. package/dist/safe-stringify-DLz1Kz3o.js.map +1 -0
  120. package/dist/{search-CHUZPl0h.d.ts → search-BH33XhuU.d.mts} +2 -22
  121. package/dist/search-BH33XhuU.d.mts.map +1 -0
  122. package/dist/{search-DjXSn6v5.mjs → search-CWMVYC-R.mjs} +34 -41
  123. package/dist/search-CWMVYC-R.mjs.map +1 -0
  124. package/dist/{search-BfBzDIT9.d.mts → search-CazwyX5Z.d.ts} +2 -22
  125. package/dist/search-CazwyX5Z.d.ts.map +1 -0
  126. package/dist/{search-B0MH1SJJ.js → search-DUfWuzFP.js} +64 -71
  127. package/dist/search-DUfWuzFP.js.map +1 -0
  128. package/dist/search.d.mts +2 -4
  129. package/dist/search.d.ts +2 -4
  130. package/dist/search.js +3 -4
  131. package/dist/search.mjs +1 -4
  132. package/dist/secret-config-BegMLkYl.mjs +209 -0
  133. package/dist/secret-config-BegMLkYl.mjs.map +1 -0
  134. package/dist/secret-config-CBZBs0p1.js +271 -0
  135. package/dist/secret-config-CBZBs0p1.js.map +1 -0
  136. package/dist/slack.transport-Ce96JBDk.mjs +824 -0
  137. package/dist/slack.transport-Ce96JBDk.mjs.map +1 -0
  138. package/dist/slack.transport-Dlx3xvb7.js +847 -0
  139. package/dist/slack.transport-Dlx3xvb7.js.map +1 -0
  140. package/dist/slack.transport-DrirgDNy.d.ts +159 -0
  141. package/dist/slack.transport-DrirgDNy.d.ts.map +1 -0
  142. package/dist/slack.transport-DxHOXlLu.d.mts +159 -0
  143. package/dist/slack.transport-DxHOXlLu.d.mts.map +1 -0
  144. package/dist/testing.d.mts +3 -8
  145. package/dist/testing.d.mts.map +1 -1
  146. package/dist/testing.d.ts +3 -8
  147. package/dist/testing.d.ts.map +1 -1
  148. package/dist/testing.js +3 -4
  149. package/dist/testing.js.map +1 -1
  150. package/dist/testing.mjs +2 -3
  151. package/dist/testing.mjs.map +1 -1
  152. package/dist/{transport.manager-Crau3Rle.js → transport.manager-DkcEOlqV.js} +331 -234
  153. package/dist/transport.manager-DkcEOlqV.js.map +1 -0
  154. package/dist/{transport.manager-CpdVHEGP.mjs → transport.manager-eZ_EeC00.mjs} +274 -178
  155. package/dist/transport.manager-eZ_EeC00.mjs.map +1 -0
  156. package/dist/{transport.types-CtNr3D7S.d.mts → transport.types-BJVL1QQl.d.mts} +5 -4
  157. package/dist/transport.types-BJVL1QQl.d.mts.map +1 -0
  158. package/dist/{transport.types-DqVLZTyf.d.ts → transport.types-BJVL1QQl.d.ts} +5 -4
  159. package/dist/transport.types-BJVL1QQl.d.ts.map +1 -0
  160. package/dist/transports.d.mts +32 -41
  161. package/dist/transports.d.mts.map +1 -1
  162. package/dist/transports.d.ts +32 -41
  163. package/dist/transports.d.ts.map +1 -1
  164. package/dist/transports.js +12 -12
  165. package/dist/transports.mjs +7 -12
  166. package/dist/worker-entry.js +337 -87
  167. package/dist/worker.d.mts +1 -2
  168. package/dist/worker.d.ts +1 -2
  169. package/dist/worker.js +3 -4
  170. package/dist/worker.mjs +1 -4
  171. package/dist/{worker.transport-Bj-i0P9V.d.ts → worker.transport-BuPwBi3d.d.ts} +2 -6
  172. package/dist/worker.transport-BuPwBi3d.d.ts.map +1 -0
  173. package/dist/{worker.transport-JP8YHBuU.js → worker.transport-C6GNl_r2.js} +44 -14
  174. package/dist/worker.transport-C6GNl_r2.js.map +1 -0
  175. package/dist/{worker.transport-otwhJ_Et.mjs → worker.transport-DLVA4y2e.mjs} +39 -9
  176. package/dist/worker.transport-DLVA4y2e.mjs.map +1 -0
  177. package/dist/{worker.transport-Bgv9heDI.d.mts → worker.transport-hJay1wxA.d.mts} +2 -6
  178. package/dist/worker.transport-hJay1wxA.d.mts.map +1 -0
  179. package/package.json +36 -19
  180. package/dist/async-context-BzJrbfQs.mjs +0 -72
  181. package/dist/async-context-BzJrbfQs.mjs.map +0 -1
  182. package/dist/async-context-DyQQYq3I.js +0 -92
  183. package/dist/async-context-DyQQYq3I.js.map +0 -1
  184. package/dist/azure-monitor.transport-BDFO4F-i.d.ts.map +0 -1
  185. package/dist/azure-monitor.transport-CHnjVRF-.mjs.map +0 -1
  186. package/dist/azure-monitor.transport-CrvfHd9C.js.map +0 -1
  187. package/dist/azure-monitor.transport-D5wQEH04.d.mts.map +0 -1
  188. package/dist/batch-buffer-BY-mRWIK.js.map +0 -1
  189. package/dist/batch-buffer-PGvSgbmd.mjs.map +0 -1
  190. package/dist/chunk-DLSkYcPk.mjs +0 -7
  191. package/dist/chunk-nOFOJqeH.js +0 -30
  192. package/dist/cloudwatch.transport-B00st6Xv.d.ts.map +0 -1
  193. package/dist/cloudwatch.transport-BO1ahxw-.js.map +0 -1
  194. package/dist/cloudwatch.transport-Blc7Gtxt.d.mts.map +0 -1
  195. package/dist/cloudwatch.transport-DZ6ies7g.mjs.map +0 -1
  196. package/dist/entry-fields-BJkuPnIg.mjs.map +0 -1
  197. package/dist/entry-fields-BvOLFlJ4.js.map +0 -1
  198. package/dist/gcp.transport-CHV8MGgz.js.map +0 -1
  199. package/dist/gcp.transport-DBX5TPIy.mjs.map +0 -1
  200. package/dist/gcp.transport-m4fVw0b1.d.ts.map +0 -1
  201. package/dist/gcp.transport-zzNyIoih.d.mts.map +0 -1
  202. package/dist/index-BPwEisy4.d.mts.map +0 -1
  203. package/dist/index-nZEeCr3X.d.ts.map +0 -1
  204. package/dist/internal-log-BUJYMZbE.js +0 -70
  205. package/dist/internal-log-BUJYMZbE.js.map +0 -1
  206. package/dist/internal-log-Cm8SOWSV.mjs +0 -52
  207. package/dist/internal-log-Cm8SOWSV.mjs.map +0 -1
  208. package/dist/nestjs-extras-DnJ6vrIC.js.map +0 -1
  209. package/dist/nestjs-extras-ImbuDhs1.mjs.map +0 -1
  210. package/dist/nestjs-extras-OkC796py.d.mts +0 -725
  211. package/dist/nestjs-extras-OkC796py.d.mts.map +0 -1
  212. package/dist/nestjs-extras-mKrHE9S6.d.ts +0 -725
  213. package/dist/nestjs-extras-mKrHE9S6.d.ts.map +0 -1
  214. package/dist/safe-stringify-DJ66tW5I.mjs.map +0 -1
  215. package/dist/safe-stringify-DWo3aZp_.js.map +0 -1
  216. package/dist/search-B0MH1SJJ.js.map +0 -1
  217. package/dist/search-BfBzDIT9.d.mts.map +0 -1
  218. package/dist/search-CHUZPl0h.d.ts.map +0 -1
  219. package/dist/search-DjXSn6v5.mjs.map +0 -1
  220. package/dist/trace.utils-CvXgaiQT.mjs.map +0 -1
  221. package/dist/trace.utils-DpBOLDtq.js.map +0 -1
  222. package/dist/transport.manager-CpdVHEGP.mjs.map +0 -1
  223. package/dist/transport.manager-Crau3Rle.js.map +0 -1
  224. package/dist/transport.types-CtNr3D7S.d.mts.map +0 -1
  225. package/dist/transport.types-DqVLZTyf.d.ts.map +0 -1
  226. package/dist/worker.transport-Bgv9heDI.d.mts.map +0 -1
  227. package/dist/worker.transport-Bj-i0P9V.d.ts.map +0 -1
  228. package/dist/worker.transport-JP8YHBuU.js.map +0 -1
  229. package/dist/worker.transport-otwhJ_Et.mjs.map +0 -1
@@ -1,20 +1,83 @@
1
- const require_chunk = require('./chunk-nOFOJqeH.js');
2
- const require_internal_log = require('./internal-log-BUJYMZbE.js');
3
- const require_safe_stringify = require('./safe-stringify-DWo3aZp_.js');
4
- const require_trace_utils = require('./trace.utils-DpBOLDtq.js');
5
- const require_async_context = require('./async-context-DyQQYq3I.js');
6
- const require_coerce_utils = require('./coerce.utils-B-LilukN.js');
7
- const require_transport_manager = require('./transport.manager-Crau3Rle.js');
8
- let node_os = require("node:os");
9
- node_os = require_chunk.__toESM(node_os);
1
+ const require_secret_config = require("./secret-config-CBZBs0p1.js");
2
+ const require_request_trace = require("./request-trace-wTJdKp6-.js");
3
+ const require_async_context = require("./async-context-DTQgi8f7.js");
4
+ const require_internal_log = require("./internal-log-b0Vp4qrB.js");
5
+ const require_coerce_utils = require("./coerce.utils-C1C5sIX0.js");
6
+ const require_safe_stringify = require("./safe-stringify-DLz1Kz3o.js");
7
+ const require_transport_manager = require("./transport.manager-DkcEOlqV.js");
10
8
  let fast_json_stringify = require("fast-json-stringify");
11
- fast_json_stringify = require_chunk.__toESM(fast_json_stringify);
12
- let __nestjs_common = require("@nestjs/common");
13
- __nestjs_common = require_chunk.__toESM(__nestjs_common);
14
- let rxjs = require("rxjs");
15
- rxjs = require_chunk.__toESM(rxjs);
16
-
17
- //#region src/plugin.ts
9
+ fast_json_stringify = require_secret_config.__toESM(fast_json_stringify);
10
+ let node_os = require("node:os");
11
+ // src/types/index.ts
12
+ const LogLevel = {
13
+ ERROR: "error",
14
+ WARN: "warn",
15
+ INFO: "info",
16
+ DEBUG: "debug",
17
+ TRACE: "trace",
18
+ VERBOSE: "verbose"
19
+ };
20
+ const DEFAULT_LOG_LEVELS = {
21
+ error: 0,
22
+ warn: 1,
23
+ info: 2,
24
+ debug: 3,
25
+ trace: 4,
26
+ verbose: 5
27
+ };
28
+ const DEFAULT_LOG_COLORS = {
29
+ error: "red",
30
+ warn: "yellow",
31
+ info: "green",
32
+ debug: "blue",
33
+ trace: "magenta",
34
+ verbose: "cyan"
35
+ };
36
+ // src/core/default-config.ts
37
+ /**
38
+ * Default configuration for Logixia logger
39
+ */
40
+ const DEFAULT_CONFIG = {
41
+ appName: "App",
42
+ environment: "development",
43
+ traceId: true,
44
+ format: {
45
+ timestamp: true,
46
+ colorize: true,
47
+ json: false
48
+ },
49
+ silent: false,
50
+ levelOptions: {
51
+ level: LogLevel.INFO,
52
+ levels: {
53
+ [LogLevel.ERROR]: 0,
54
+ [LogLevel.WARN]: 1,
55
+ [LogLevel.INFO]: 2,
56
+ [LogLevel.DEBUG]: 3,
57
+ [LogLevel.TRACE]: 4,
58
+ [LogLevel.VERBOSE]: 5
59
+ },
60
+ colors: {
61
+ [LogLevel.ERROR]: "red",
62
+ [LogLevel.WARN]: "yellow",
63
+ [LogLevel.INFO]: "blue",
64
+ [LogLevel.DEBUG]: "green",
65
+ [LogLevel.TRACE]: "gray",
66
+ [LogLevel.VERBOSE]: "cyan"
67
+ }
68
+ },
69
+ fields: {
70
+ timestamp: true,
71
+ level: true,
72
+ appName: true,
73
+ traceId: true,
74
+ message: true,
75
+ payload: true,
76
+ timeTaken: true
77
+ },
78
+ outputs: ["console"]
79
+ };
80
+ // src/plugin.ts
18
81
  /**
19
82
  * Holds an ordered list of `LogixiaPlugin` instances and dispatches lifecycle
20
83
  * events to them. One registry is created per logger instance; a global
@@ -119,36 +182,7 @@ const globalPluginRegistry = new PluginRegistry();
119
182
  function usePlugin(plugin) {
120
183
  globalPluginRegistry.register(plugin);
121
184
  }
122
-
123
- //#endregion
124
- //#region src/types/index.ts
125
- const LogLevel = {
126
- ERROR: "error",
127
- WARN: "warn",
128
- INFO: "info",
129
- DEBUG: "debug",
130
- TRACE: "trace",
131
- VERBOSE: "verbose"
132
- };
133
- const DEFAULT_LOG_LEVELS = {
134
- error: 0,
135
- warn: 1,
136
- info: 2,
137
- debug: 3,
138
- trace: 4,
139
- verbose: 5
140
- };
141
- const DEFAULT_LOG_COLORS = {
142
- error: "red",
143
- warn: "yellow",
144
- info: "green",
145
- debug: "blue",
146
- trace: "magenta",
147
- verbose: "cyan"
148
- };
149
-
150
- //#endregion
151
- //#region src/utils/error.utils.ts
185
+ // src/utils/error.utils.ts
152
186
  const EXTRA_FIELDS = [
153
187
  "code",
154
188
  "statusCode",
@@ -190,13 +224,15 @@ function _serializeError(error, includeStack, maxDepth, excludeFields, depth, se
190
224
  };
191
225
  if (includeStack && error.stack) serialized.stack = error.stack;
192
226
  const errorWithCause = error;
193
- if (errorWithCause.cause !== void 0) if (errorWithCause.cause instanceof Error) serialized.cause = _serializeError(errorWithCause.cause, includeStack, maxDepth, excludeFields, depth + 1, seen);
194
- else serialized.cause = serializeValue(errorWithCause.cause, maxDepth - depth - 1, seen);
227
+ if (errorWithCause.cause !== void 0) {
228
+ if (errorWithCause.cause instanceof Error) serialized.cause = _serializeError(errorWithCause.cause, includeStack, maxDepth, excludeFields, depth + 1, seen);
229
+ else serialized.cause = serializeValue(errorWithCause.cause, maxDepth - depth - 1, seen);
230
+ }
195
231
  const aggregateError = error;
196
232
  if (Array.isArray(aggregateError.errors)) serialized.errors = aggregateError.errors.map((e) => e instanceof Error ? _serializeError(e, includeStack, maxDepth, excludeFields, depth + 1, seen) : serializeValue(e, maxDepth - depth - 1, seen));
197
233
  const errorRecord = error;
198
234
  for (const field of EXTRA_FIELDS) if (!excludeFields.includes(field) && field in error && errorRecord[field] !== void 0) serialized[field] = errorRecord[field];
199
- const skip = new Set([
235
+ const skip = /* @__PURE__ */ new Set([
200
236
  "name",
201
237
  "message",
202
238
  "stack",
@@ -278,9 +314,7 @@ function normalizeError(error) {
278
314
  }
279
315
  return new Error(String(error));
280
316
  }
281
-
282
- //#endregion
283
- //#region src/utils/otel.ts
317
+ // src/utils/otel.ts
284
318
  let _otelApi;
285
319
  function tryLoadOtelApi() {
286
320
  if (_otelApi !== void 0) return _otelApi;
@@ -385,9 +419,7 @@ function _getOtelPayloadIfEnabled() {
385
419
  function disableOtelBridge() {
386
420
  _bridgeOptions = null;
387
421
  }
388
-
389
- //#endregion
390
- //#region src/utils/redact.utils.ts
422
+ // src/utils/redact.utils.ts
391
423
  const DEFAULT_CENSOR = "[REDACTED]";
392
424
  /** Maximum nesting depth walked; deeper values are replaced with a marker. */
393
425
  const MAX_DEPTH = 32;
@@ -416,34 +448,7 @@ const PII_CONSERVATIVE_PATTERNS = [
416
448
  /**
417
449
  * Conservative field-name paths auto-redacted by name regardless of value.
418
450
  */
419
- const PII_CONSERVATIVE_PATHS = [
420
- "**.password",
421
- "**.passwd",
422
- "**.secret",
423
- "**.token",
424
- "**.apiKey",
425
- "**.api_key",
426
- "**.accessToken",
427
- "**.access_token",
428
- "**.refreshToken",
429
- "**.refresh_token",
430
- "**.authorization",
431
- "**.credentials",
432
- "**.privateKey",
433
- "**.private_key",
434
- "**.clientSecret",
435
- "**.client_secret",
436
- "**.cookie",
437
- "**.set-cookie",
438
- "**.x-api-key",
439
- "**.session",
440
- "**.proxy-authorization",
441
- "**.x-auth-token",
442
- "**.x-access-token",
443
- "**.aws_secret_access_key",
444
- "**.awsSecretAccessKey",
445
- "**.secretAccessKey"
446
- ];
451
+ const PII_CONSERVATIVE_PATHS = require_internal_log.SENSITIVE_KEY_NAMES.map((name) => `**.${name}`);
447
452
  /**
448
453
  * Aggressive patterns: also catch personal data that could identify a person.
449
454
  * Applied when `autoDetect: 'aggressive'`.
@@ -655,7 +660,7 @@ function walkToJSON(obj, state, fullPath, bare, depth) {
655
660
  function redactObject(obj, config, _currentPath = "") {
656
661
  const result = walkRecord(obj, {
657
662
  config,
658
- ancestors: new Set([obj]),
663
+ ancestors: /* @__PURE__ */ new Set([obj]),
659
664
  nodes: 0
660
665
  }, _currentPath, _currentPath, 0);
661
666
  return result === obj ? { ...obj } : result;
@@ -704,10 +709,8 @@ function isPlainObject(value) {
704
709
  if (ArrayBuffer.isView(value)) return false;
705
710
  return !OPAQUE_BUILTINS.some((ctor) => value instanceof ctor);
706
711
  }
707
-
708
- //#endregion
709
- //#region src/utils/sampling.utils.ts
710
- const ALWAYS_EMIT_LEVELS = new Set([
712
+ // src/utils/sampling.utils.ts
713
+ const ALWAYS_EMIT_LEVELS = /* @__PURE__ */ new Set([
711
714
  "error",
712
715
  "warn",
713
716
  "fatal"
@@ -725,8 +728,8 @@ var Sampler = class {
725
728
  constructor(config, onStats) {
726
729
  this.traceDecisions = /* @__PURE__ */ new Map();
727
730
  this.maxTrackedTraces = 1e5;
728
- this.traceTtlMs = 5 * 6e4;
729
- this.traceMaxLifetimeMs = 60 * 6e4;
731
+ this.traceTtlMs = 3e5;
732
+ this.traceMaxLifetimeMs = 36e5;
730
733
  this._tokenBucket = 0;
731
734
  this._lastRefillMs = Date.now();
732
735
  this._adaptiveWindow = [];
@@ -905,9 +908,14 @@ var Sampler = class {
905
908
  this._stats.dropped++;
906
909
  }
907
910
  };
908
-
909
- //#endregion
910
- //#region src/utils/shutdown.utils.ts
911
+ // src/utils/shutdown.utils.ts
912
+ /**
913
+ * Graceful shutdown utilities for Logixia
914
+ *
915
+ * Ensures all in-flight logs are flushed to every transport before the process
916
+ * exits on SIGTERM / SIGINT — solving the "last N seconds of logs are lost on
917
+ * deployment" problem reported in Pino issue #2002 and LogDNA issue #15.
918
+ */
911
919
  const MAX_BEFORE_EXIT_FLUSHES = 5;
912
920
  /** Module-level registry of all logger instances that have opted into graceful shutdown */
913
921
  const registry = /* @__PURE__ */ new Set();
@@ -1027,9 +1035,17 @@ function resetShutdownHandlers() {
1027
1035
  shutdownHandlerRegistered = false;
1028
1036
  shutdownInProgress = false;
1029
1037
  }
1030
-
1031
- //#endregion
1032
- //#region src/core/logitron-logger.ts
1038
+ // src/core/logitron-logger.ts
1039
+ /**
1040
+ * Core Logixia Logger implementation
1041
+ *
1042
+ * v1.1 additions:
1043
+ * - Feature 1: Graceful shutdown / flushOnExit (auto-registered via config)
1044
+ * - Feature 2: Built-in log redaction (path-based + regex)
1045
+ * - Feature 3: Per-namespace log levels + LOGIXIA_LEVEL* ENV overrides
1046
+ * - Feature 4: Cause-chain error serialization (handled in error.utils)
1047
+ * - Feature 5: Adaptive log level based on NODE_ENV / CI detection
1048
+ */
1033
1049
  const _fastStringifyEntry = (0, fast_json_stringify.default)({
1034
1050
  type: "object",
1035
1051
  properties: {
@@ -1059,7 +1075,7 @@ function nowIso() {
1059
1075
  }
1060
1076
  function namespacePatternToRegex(pattern) {
1061
1077
  const escaped = pattern.split(".").map((s) => s === "*" ? "[^.]+" : s.replace(/[$()*+.?[\\\]^{|}]/g, "\\$&")).join("\\.");
1062
- return /* @__PURE__ */ new RegExp(`^${escaped}$`);
1078
+ return new RegExp(`^${escaped}$`);
1063
1079
  }
1064
1080
  /** Max compiled patterns to keep in memory. Oldest entry is evicted when full. */
1065
1081
  const _NS_CACHE_MAX = 1e3;
@@ -1101,7 +1117,7 @@ function canonicalLevel(level, known) {
1101
1117
  function resolveInitialLevel(config) {
1102
1118
  var _config$levelOptions, _config$levelOptions2;
1103
1119
  const envLevel = process.env["LOGIXIA_LEVEL"];
1104
- const knownLevels = new Set([...Object.values(LogLevel), ...Object.keys(((_config$levelOptions = config.levelOptions) === null || _config$levelOptions === void 0 ? void 0 : _config$levelOptions.levels) ?? {})]);
1120
+ const knownLevels = /* @__PURE__ */ new Set([...Object.values(LogLevel), ...Object.keys(((_config$levelOptions = config.levelOptions) === null || _config$levelOptions === void 0 ? void 0 : _config$levelOptions.levels) ?? {})]);
1105
1121
  if (envLevel && canonicalLevel(envLevel, knownLevels)) return envLevel;
1106
1122
  if ((_config$levelOptions2 = config.levelOptions) === null || _config$levelOptions2 === void 0 ? void 0 : _config$levelOptions2.level) return config.levelOptions.level;
1107
1123
  const nodeEnv = process.env["NODE_ENV"];
@@ -1111,12 +1127,25 @@ function resolveInitialLevel(config) {
1111
1127
  if (process.env["CI"]) return LogLevel.INFO;
1112
1128
  return LogLevel.INFO;
1113
1129
  }
1130
+ /**
1131
+ * The logixia logger. Create instances with {@link createLogger} so that custom
1132
+ * levels from `levelOptions.levels` also become methods.
1133
+ *
1134
+ * @example
1135
+ * ```ts
1136
+ * const logger = createLogger({ appName: 'api', environment: 'production' });
1137
+ * await logger.info('Server started', { port: 3000 });
1138
+ * const req = logger.child('RequestHandler', { requestId: 'r-1' });
1139
+ * await req.error(new Error('boom'));
1140
+ * await logger.close(); // flush buffered transports before exit
1141
+ * ```
1142
+ */
1114
1143
  var LogixiaLogger = class LogixiaLogger {
1115
1144
  constructor(config, context, parent) {
1116
1145
  this.timers = /* @__PURE__ */ new Map();
1117
1146
  this.contextData = {};
1118
1147
  this.fieldState = /* @__PURE__ */ new Map();
1119
- this.fallbackTraceId = require_trace_utils.TraceContext.instance.generate();
1148
+ this.fallbackTraceId = require_request_trace.TraceContext.instance.generate();
1120
1149
  this._levelValues = /* @__PURE__ */ new Map();
1121
1150
  this._minLevelValue = 2;
1122
1151
  this._warnedInvalidLevels = /* @__PURE__ */ new Set();
@@ -1128,7 +1157,7 @@ var LogixiaLogger = class LogixiaLogger {
1128
1157
  this._hasRedact = false;
1129
1158
  this._parent = parent;
1130
1159
  this._pluginRegistry = parent ? parent._pluginRegistry : new PluginRegistry();
1131
- this.config = {
1160
+ const defaultConfig = {
1132
1161
  appName: "App",
1133
1162
  environment: "development",
1134
1163
  traceId: true,
@@ -1156,7 +1185,10 @@ var LogixiaLogger = class LogixiaLogger {
1156
1185
  [LogLevel.TRACE]: "gray",
1157
1186
  [LogLevel.VERBOSE]: "cyan"
1158
1187
  }
1159
- },
1188
+ }
1189
+ };
1190
+ this.config = {
1191
+ ...defaultConfig,
1160
1192
  ...config
1161
1193
  };
1162
1194
  const resolvedLevel = resolveInitialLevel(this.config);
@@ -1174,6 +1206,7 @@ var LogixiaLogger = class LogixiaLogger {
1174
1206
  timeTaken: "[time_taken_MS]"
1175
1207
  };
1176
1208
  this.context = context ?? "";
1209
+ require_secret_config.protectSecrets(this, ["config"]);
1177
1210
  if (parent) {
1178
1211
  this.transportManager = parent.transportManager;
1179
1212
  this._sampler = parent._sampler;
@@ -1239,7 +1272,7 @@ var LogixiaLogger = class LogixiaLogger {
1239
1272
  this.config.levelOptions.level = this._validLevel(this.config.levelOptions.level, "levelOptions.level") ?? LogLevel.INFO;
1240
1273
  const effectiveLevel = this.resolveEffectiveLevel();
1241
1274
  this._minLevelValue = this._levelValues.get(effectiveLevel) ?? 2;
1242
- this._colorMap = new Map([
1275
+ this._colorMap = /* @__PURE__ */ new Map([
1243
1276
  ["black", "\x1B[30m"],
1244
1277
  ["red", "\x1B[31m"],
1245
1278
  ["green", "\x1B[32m"],
@@ -1282,7 +1315,7 @@ var LogixiaLogger = class LogixiaLogger {
1282
1315
  "green",
1283
1316
  "blue"
1284
1317
  ];
1285
- const _BUILTIN_LEVELS = new Set([
1318
+ const _BUILTIN_LEVELS = /* @__PURE__ */ new Set([
1286
1319
  "error",
1287
1320
  "warn",
1288
1321
  "info",
@@ -1296,10 +1329,12 @@ var LogixiaLogger = class LogixiaLogger {
1296
1329
  if (colorize && this._fieldCache.get("level") !== false) {
1297
1330
  var _this$config$levelOpt4;
1298
1331
  let colorName = (_this$config$levelOpt4 = this.config.levelOptions) === null || _this$config$levelOpt4 === void 0 || (_this$config$levelOpt4 = _this$config$levelOpt4.colors) === null || _this$config$levelOpt4 === void 0 ? void 0 : _this$config$levelOpt4[lvl];
1299
- if (!colorName) if (_BUILTIN_LEVELS.has(lvl)) colorName = "white";
1300
- else {
1301
- colorName = _AUTO_PALETTE[_paletteIdx % _AUTO_PALETTE.length];
1302
- _paletteIdx++;
1332
+ if (!colorName) {
1333
+ if (_BUILTIN_LEVELS.has(lvl)) colorName = "white";
1334
+ else {
1335
+ colorName = _AUTO_PALETTE[_paletteIdx % _AUTO_PALETTE.length];
1336
+ _paletteIdx++;
1337
+ }
1303
1338
  }
1304
1339
  const code = this._colorMap.get(colorName.toLowerCase()) ?? this._colorMap.get("white");
1305
1340
  const reset = this._colorMap.get("reset");
@@ -1311,6 +1346,11 @@ var LogixiaLogger = class LogixiaLogger {
1311
1346
  else this._formattedAppName = colorize ? `${this._colorMap.get("gray")}${appNameRaw}${this._colorMap.get("reset")} ` : `${appNameRaw} `;
1312
1347
  this._hasRedact = !!(this.config.redact && ((((_this$config$redact$p = this.config.redact.paths) === null || _this$config$redact$p === void 0 ? void 0 : _this$config$redact$p.length) ?? 0) > 0 || (((_this$config$redact$p2 = this.config.redact.patterns) === null || _this$config$redact$p2 === void 0 ? void 0 : _this$config$redact$p2.length) ?? 0) > 0 || !!this.config.redact.autoDetect));
1313
1348
  }
1349
+ /**
1350
+ * Log at `error` level. An `Error` is logged with its message and serialized
1351
+ * (name, message, stack) under `data.error`; a string is logged as-is.
1352
+ * `data` is merged into the entry payload.
1353
+ */
1314
1354
  async error(messageOrError, data) {
1315
1355
  if (isError(messageOrError)) await this.log("error", messageOrError.message, {
1316
1356
  ...data,
@@ -1318,30 +1358,53 @@ var LogixiaLogger = class LogixiaLogger {
1318
1358
  });
1319
1359
  else await this.log("error", messageOrError, data);
1320
1360
  }
1361
+ /** Log `message` at `warn` level; `data` is merged into the entry payload. */
1321
1362
  async warn(message, data) {
1322
1363
  await this.log("warn", message, data);
1323
1364
  }
1365
+ /** Log `message` at `info` level; `data` is merged into the entry payload. */
1324
1366
  async info(message, data) {
1325
1367
  await this.log("info", message, data);
1326
1368
  }
1369
+ /** Log `message` at `debug` level; `data` is merged into the entry payload. */
1327
1370
  async debug(message, data) {
1328
1371
  await this.log("debug", message, data);
1329
1372
  }
1373
+ /** Log `message` at `trace` level; `data` is merged into the entry payload. */
1330
1374
  async trace(message, data) {
1331
1375
  await this.log("trace", message, data);
1332
1376
  }
1377
+ /** Log `message` at `verbose` level; `data` is merged into the entry payload. */
1333
1378
  async verbose(message, data) {
1334
1379
  await this.log("verbose", message, data);
1335
1380
  }
1381
+ /**
1382
+ * Log at an arbitrary level name, including custom levels. Levels below the
1383
+ * active threshold are dropped, as are level names that are not registered
1384
+ * in `levelOptions.levels` (and are not built-in).
1385
+ */
1336
1386
  async logLevel(level, message, data) {
1337
1387
  await this.log(level, message, data);
1338
1388
  }
1389
+ /** Start a named timer; finish it with {@link timeEnd}. Reusing a label restarts it. */
1339
1390
  time(label) {
1340
1391
  this.timers.set(label, {
1341
1392
  label,
1342
1393
  startTime: Date.now()
1343
1394
  });
1344
1395
  }
1396
+ /**
1397
+ * Stop the timer `label`, log its duration at `info` level, and return the
1398
+ * elapsed milliseconds. Logs a `warn` and returns `undefined` if the timer
1399
+ * does not exist.
1400
+ *
1401
+ * @example
1402
+ * ```ts
1403
+ * logger.time('db');
1404
+ * await query();
1405
+ * const ms = await logger.timeEnd('db');
1406
+ * ```
1407
+ */
1345
1408
  async timeEnd(label) {
1346
1409
  const timer = this.timers.get(label);
1347
1410
  if (!timer) {
@@ -1371,6 +1434,17 @@ var LogixiaLogger = class LogixiaLogger {
1371
1434
  throw error;
1372
1435
  }
1373
1436
  }
1437
+ /**
1438
+ * Change the minimum log level at runtime. The override outranks
1439
+ * `LOGIXIA_LEVEL`, `LOGIXIA_LEVEL_<NS>` and `namespaceLevels`, and survives
1440
+ * later changes to fields or namespace levels. Unknown level names are
1441
+ * ignored with a warning and the current level is kept.
1442
+ *
1443
+ * @example
1444
+ * ```ts
1445
+ * logger.setLevel('debug');
1446
+ * ```
1447
+ */
1374
1448
  setLevel(level) {
1375
1449
  const canonical = canonicalLevel(level, this._levelValues);
1376
1450
  if (canonical === void 0) {
@@ -1379,9 +1453,14 @@ var LogixiaLogger = class LogixiaLogger {
1379
1453
  }
1380
1454
  this.config.levelOptions = this.config.levelOptions ?? {};
1381
1455
  this.config.levelOptions.level = canonical;
1382
- this._minLevelValue = this._levelValues.get(canonical) ?? this._minLevelValue;
1456
+ this._runtimeLevel = canonical;
1383
1457
  this._buildPerfCaches();
1384
1458
  }
1459
+ /**
1460
+ * Return the configured minimum log level, not the per-namespace effective
1461
+ * one. Without `setLevel()` it is `LOGIXIA_LEVEL`, else `levelOptions.level`,
1462
+ * else a `NODE_ENV` default (`debug` in development, `warn` in test), else `info`.
1463
+ */
1385
1464
  getLevel() {
1386
1465
  var _this$config$levelOpt5;
1387
1466
  return ((_this$config$levelOpt5 = this.config.levelOptions) === null || _this$config$levelOpt5 === void 0 ? void 0 : _this$config$levelOpt5.level) ?? LogLevel.INFO;
@@ -1435,30 +1514,36 @@ var LogixiaLogger = class LogixiaLogger {
1435
1514
  getNamespaceLevels() {
1436
1515
  return { ...this.config.namespaceLevels };
1437
1516
  }
1517
+ /** Set the context label (e.g. a class or module name) attached to every subsequent entry. */
1438
1518
  setContext(context) {
1439
1519
  this.context = typeof context === "string" ? context : require_coerce_utils.safeToString(context);
1440
1520
  }
1521
+ /** Return the current context label, or `undefined` if none is set. */
1441
1522
  getContext() {
1442
1523
  return this.context;
1443
1524
  }
1525
+ /** Show `fieldName` in log output, overriding the config for this logger instance. */
1444
1526
  enableField(fieldName) {
1445
1527
  this.fieldState.set(fieldName, true);
1446
1528
  this._fieldCache.set(fieldName, true);
1447
1529
  if (fieldName === "level" || fieldName === "appName") this._buildPerfCaches();
1448
1530
  require_internal_log.internalLog(`Field '${fieldName}' enabled`);
1449
1531
  }
1532
+ /** Hide `fieldName` from log output, overriding the config for this logger instance. */
1450
1533
  disableField(fieldName) {
1451
1534
  this.fieldState.set(fieldName, false);
1452
1535
  this._fieldCache.set(fieldName, false);
1453
1536
  if (fieldName === "level" || fieldName === "appName") this._buildPerfCaches();
1454
1537
  require_internal_log.internalLog(`Field '${fieldName}' disabled`);
1455
1538
  }
1539
+ /** Whether `fieldName` is currently shown: runtime override first, then config, default `true`. */
1456
1540
  isFieldEnabled(fieldName) {
1457
1541
  var _this$config$fields2;
1458
1542
  if (this.fieldState.has(fieldName)) return this.fieldState.get(fieldName);
1459
1543
  if (((_this$config$fields2 = this.config.fields) === null || _this$config$fields2 === void 0 ? void 0 : _this$config$fields2[fieldName]) !== void 0) return this.config.fields[fieldName] !== false;
1460
1544
  return true;
1461
1545
  }
1546
+ /** Return the visibility (`true` = shown) of every standard log field. */
1462
1547
  getFieldState() {
1463
1548
  return Object.fromEntries([
1464
1549
  "timestamp",
@@ -1475,6 +1560,7 @@ var LogixiaLogger = class LogixiaLogger {
1475
1560
  "environment"
1476
1561
  ].map((f) => [f, this.isFieldEnabled(f)]));
1477
1562
  }
1563
+ /** Drop all runtime enable/disable overrides so field visibility follows the config again. */
1478
1564
  resetFieldState() {
1479
1565
  this.fieldState.clear();
1480
1566
  require_internal_log.internalLog("Field state reset to configuration defaults");
@@ -1489,10 +1575,12 @@ var LogixiaLogger = class LogixiaLogger {
1489
1575
  if (this.transportManager) this.transportManager.disableLevelPrompting();
1490
1576
  else require_internal_log.internalWarn("Transport manager not initialized");
1491
1577
  }
1578
+ /** Restrict `transportId` to only the given `levels`. Warns if no transports are configured. */
1492
1579
  setTransportLevels(transportId, levels) {
1493
1580
  if (this.transportManager) this.transportManager.setTransportLevels(transportId, levels);
1494
1581
  else require_internal_log.internalWarn("Transport manager not initialized");
1495
1582
  }
1583
+ /** Return the levels `transportId` is restricted to, or `undefined` if it has none. */
1496
1584
  getTransportLevels(transportId) {
1497
1585
  if (this.transportManager) return this.transportManager.getTransportLevels(transportId);
1498
1586
  require_internal_log.internalWarn("Transport manager not initialized");
@@ -1501,10 +1589,23 @@ var LogixiaLogger = class LogixiaLogger {
1501
1589
  if (this.transportManager) this.transportManager.clearTransportLevelPreferences();
1502
1590
  else require_internal_log.internalWarn("Transport manager not initialized");
1503
1591
  }
1592
+ /** Return the identifiers of the configured transports (empty if none). */
1504
1593
  getAvailableTransports() {
1505
1594
  var _this$transportManage;
1506
1595
  return ((_this$transportManage = this.transportManager) === null || _this$transportManage === void 0 ? void 0 : _this$transportManage.getTransports()) ?? [];
1507
1596
  }
1597
+ /**
1598
+ * Create a child logger with its own `context` that shares this logger's
1599
+ * configuration and transports. `data` is merged into the bound fields
1600
+ * inherited from this logger and added to every entry the child writes.
1601
+ * Closing a child does not close the shared transports.
1602
+ *
1603
+ * @example
1604
+ * ```ts
1605
+ * const req = logger.child('Checkout', { requestId: 'r-42' });
1606
+ * await req.info('started'); // entry includes requestId
1607
+ * ```
1608
+ */
1508
1609
  child(context, data) {
1509
1610
  const childLogger = new LogixiaLogger(this.config, context, this);
1510
1611
  const mergedContextData = {
@@ -1540,9 +1641,11 @@ var LogixiaLogger = class LogixiaLogger {
1540
1641
  this._pluginRegistry.unregister(pluginName);
1541
1642
  return this;
1542
1643
  }
1644
+ /** Flush buffered entries in all transports without closing them. */
1543
1645
  async flush() {
1544
1646
  if (this.transportManager) await this.transportManager.flush();
1545
1647
  }
1648
+ /** Report whether the transports are healthy; `healthy: false` if no transport manager exists. */
1546
1649
  async healthCheck() {
1547
1650
  if (!this.transportManager) return {
1548
1651
  healthy: false,
@@ -1550,6 +1653,20 @@ var LogixiaLogger = class LogixiaLogger {
1550
1653
  };
1551
1654
  return this.transportManager.healthCheck();
1552
1655
  }
1656
+ /**
1657
+ * Warn about timers that were never ended, then flush and close all transports,
1658
+ * stop the sampler and run plugin shutdown hooks. On a child logger only the
1659
+ * timer warnings run; the shared transports stay open.
1660
+ *
1661
+ * To flush on SIGTERM/SIGINT, set the `gracefulShutdown` config option rather
1662
+ * than writing your own signal handler; do not combine it with a manual
1663
+ * handler that calls `process.exit`, which can cut the flush short.
1664
+ *
1665
+ * @example
1666
+ * ```ts
1667
+ * await logger.close(); // e.g. at the end of a script or a test
1668
+ * ```
1669
+ */
1553
1670
  async close() {
1554
1671
  var _this$_sampler;
1555
1672
  for (const [label, timer] of this.timers) await this.warn(`Timer '${label}' was not ended properly`, {
@@ -1566,11 +1683,13 @@ var LogixiaLogger = class LogixiaLogger {
1566
1683
  async log(level, message, data) {
1567
1684
  if (this.config.silent) return;
1568
1685
  if (!this.shouldLog(level)) return;
1569
- if (this._sampler) {
1570
- const traceId$1 = this.config.traceId ? require_trace_utils.TraceContext.instance.getCurrentTraceId() : void 0;
1571
- if (!this._sampler.shouldEmit(level, traceId$1)) return;
1572
- }
1573
1686
  const alsContext = require_async_context.LogixiaContext.get();
1687
+ let activeTraceId;
1688
+ if (this.config.traceId) {
1689
+ const ctxTraceId = alsContext === null || alsContext === void 0 ? void 0 : alsContext.traceId;
1690
+ activeTraceId = require_request_trace.TraceContext.instance.getCurrentTraceId() ?? (typeof ctxTraceId === "string" ? ctxTraceId : void 0);
1691
+ }
1692
+ if (this._sampler && !this._sampler.shouldEmit(level, activeTraceId)) return;
1574
1693
  const hasAls = alsContext !== void 0 && Object.keys(alsContext).length > 0;
1575
1694
  const otelFields = _isOtelBridgeEnabled() ? _getOtelPayloadIfEnabled() : void 0;
1576
1695
  const hasOtel = otelFields !== void 0 && Object.keys(otelFields).length > 0;
@@ -1590,14 +1709,16 @@ var LogixiaLogger = class LogixiaLogger {
1590
1709
  ...mergedData
1591
1710
  } : mergedData;
1592
1711
  let payload;
1593
- if (rawPayload !== void 0 && rawPayload !== null) if (this._hasRedact) try {
1594
- payload = applyRedaction(rawPayload, this.config.redact) ?? rawPayload;
1595
- } catch (error) {
1596
- require_internal_log.internalError("Redaction failed", error);
1597
- payload = { redaction: REDACTION_FAILED };
1712
+ if (rawPayload !== void 0 && rawPayload !== null) {
1713
+ if (this._hasRedact) try {
1714
+ payload = applyRedaction(rawPayload, this.config.redact) ?? rawPayload;
1715
+ } catch (error) {
1716
+ require_internal_log.internalError("Redaction failed", error);
1717
+ payload = { redaction: REDACTION_FAILED };
1718
+ }
1719
+ else payload = rawPayload;
1598
1720
  }
1599
- else payload = rawPayload;
1600
- const traceId = this.config.traceId ? require_trace_utils.TraceContext.instance.getCurrentTraceId() ?? this.fallbackTraceId : void 0;
1721
+ const traceId = this.config.traceId ? activeTraceId ?? this.fallbackTraceId : void 0;
1601
1722
  let safeMessage = message;
1602
1723
  if (this._hasRedact) try {
1603
1724
  safeMessage = applyRedactionToString(message, this.config.redact);
@@ -1635,12 +1756,14 @@ var LogixiaLogger = class LogixiaLogger {
1635
1756
  * Feature 3: Resolve the effective log level for this logger instance.
1636
1757
  *
1637
1758
  * Priority:
1759
+ * 0. A level set at runtime with `setLevel()` (explicit programmatic call, wins over all below)
1638
1760
  * 1. ENV `LOGIXIA_LEVEL_<NS_UPPER>` (e.g. LOGIXIA_LEVEL_DB for ns "db" or "db.queries")
1639
1761
  * 2. Matching `namespaceLevels` config entry (longer pattern = more specific, wins)
1640
1762
  * 3. Global `LOGIXIA_LEVEL` ENV override
1641
1763
  * 4. `levelOptions.level` (resolved via Feature 5 in constructor)
1642
1764
  */
1643
1765
  resolveEffectiveLevel() {
1766
+ if (this._runtimeLevel) return this._runtimeLevel;
1644
1767
  const ns = this.context;
1645
1768
  if (ns) {
1646
1769
  const nsKey = ns.split(".")[0].toUpperCase();
@@ -1714,6 +1837,22 @@ var LogixiaLogger = class LogixiaLogger {
1714
1837
  (level === LogLevel.ERROR ? process.stderr : process.stdout).write(this.formatLog(entry) + "\n");
1715
1838
  }
1716
1839
  };
1840
+ /**
1841
+ * Create a logger from `config`, with an optional default `context` label.
1842
+ *
1843
+ * Every key of `levelOptions.levels` that is not already a method becomes an
1844
+ * async method on the returned logger, typed through the config, and routes to
1845
+ * {@link LogixiaLogger.logLevel}.
1846
+ *
1847
+ * @example
1848
+ * ```ts
1849
+ * const logger = createLogger({
1850
+ * appName: 'api',
1851
+ * levelOptions: { level: 'info', levels: { error: 0, warn: 1, info: 2, audit: 2 } },
1852
+ * });
1853
+ * await logger.audit('user exported data', { userId: 'u1' });
1854
+ * ```
1855
+ */
1717
1856
  function createLogger(config, context) {
1718
1857
  var _config$levelOptions3;
1719
1858
  const logger = new LogixiaLogger(config, context);
@@ -1725,686 +1864,7 @@ function createLogger(config, context) {
1725
1864
  }
1726
1865
  return logger;
1727
1866
  }
1728
-
1729
- //#endregion
1730
- //#region \0@oxc-project+runtime@0.95.0/helpers/decorateMetadata.js
1731
- function __decorateMetadata(k, v) {
1732
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
1733
- }
1734
-
1735
- //#endregion
1736
- //#region \0@oxc-project+runtime@0.95.0/helpers/decorate.js
1737
- function __decorate(decorators, target, key, desc) {
1738
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1739
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1740
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1741
- return c > 3 && r && Object.defineProperty(target, key, r), r;
1742
- }
1743
-
1744
- //#endregion
1745
- //#region src/core/logitron-nestjs.service.ts
1746
- var _LogixiaLoggerService;
1747
- let LogixiaLoggerService = _LogixiaLoggerService = class LogixiaLoggerService$1 {
1748
- constructor(config) {
1749
- this._mergedConfig = {
1750
- appName: "NestJS-App",
1751
- environment: "development",
1752
- traceId: true,
1753
- format: {
1754
- timestamp: true,
1755
- colorize: true,
1756
- json: false
1757
- },
1758
- silent: false,
1759
- levelOptions: {
1760
- level: LogLevel.INFO,
1761
- levels: {
1762
- error: 0,
1763
- warn: 1,
1764
- log: 2,
1765
- debug: 3,
1766
- verbose: 4
1767
- },
1768
- colors: {
1769
- error: "red",
1770
- warn: "yellow",
1771
- log: "green",
1772
- debug: "blue",
1773
- verbose: "cyan"
1774
- }
1775
- },
1776
- fields: {
1777
- timestamp: "[yyyy-mm-dd HH:MM:ss.MS]",
1778
- level: "[log_level]",
1779
- appName: "[app_name]",
1780
- traceId: "[trace_id]",
1781
- message: "[message]",
1782
- payload: "[payload]",
1783
- timeTaken: "[time_taken_MS]"
1784
- },
1785
- ...config
1786
- };
1787
- this.logger = new LogixiaLogger(this._mergedConfig);
1788
- this._createCustomLevelMethods();
1789
- }
1790
- _createCustomLevelMethods() {
1791
- var _this$_mergedConfig$l;
1792
- const levels = (_this$_mergedConfig$l = this._mergedConfig.levelOptions) === null || _this$_mergedConfig$l === void 0 ? void 0 : _this$_mergedConfig$l.levels;
1793
- if (!levels) return;
1794
- for (const levelName of Object.keys(levels)) {
1795
- const lower = levelName.toLowerCase();
1796
- if (typeof this[lower] !== "undefined") continue;
1797
- this[lower] = async (message, data) => {
1798
- return this.logger.logLevel(lower, message, data);
1799
- };
1800
- }
1801
- }
1802
- /**
1803
- * NestJS `LoggerService.log` — void, string context.
1804
- * Maps internally to `info`.
1805
- *
1806
- * @example `logger.log('User signed up', 'AuthService')`
1807
- */
1808
- log(message, context) {
1809
- this.setContextIfProvided(context);
1810
- this.logger.info(this.formatMessage(message)).catch((err) => require_internal_log.internalError("LogixiaLoggerService.log failed", err));
1811
- }
1812
- /**
1813
- * Native async `info` — structured data, returns `Promise<void>`.
1814
- *
1815
- * @example `await logger.info('User signed up', { userId: 'u_abc' })`
1816
- */
1817
- async info(message, data) {
1818
- return this.logger.info(message, data);
1819
- }
1820
- error(message, dataOrTrace, context) {
1821
- if (typeof dataOrTrace === "object" && dataOrTrace !== null) return message instanceof Error ? this.logger.error(message, dataOrTrace) : this.logger.error(this.formatMessage(message), dataOrTrace);
1822
- this.setContextIfProvided(context);
1823
- const errorData = {};
1824
- if (typeof dataOrTrace === "string" && dataOrTrace) errorData.stack = dataOrTrace;
1825
- (message instanceof Error ? this.logger.error(message, errorData) : this.logger.error(this.formatMessage(message), errorData)).catch((err) => require_internal_log.internalError("LogixiaLoggerService.error failed", err));
1826
- }
1827
- warn(message, dataOrContext) {
1828
- if (typeof dataOrContext === "object" && dataOrContext !== null) return this.logger.warn(this.formatMessage(message), dataOrContext);
1829
- this.setContextIfProvided(typeof dataOrContext === "string" ? dataOrContext : void 0);
1830
- this.logger.warn(this.formatMessage(message)).catch((err) => require_internal_log.internalError("LogixiaLoggerService.warn failed", err));
1831
- }
1832
- debug(message, dataOrContext) {
1833
- if (typeof dataOrContext === "object" && dataOrContext !== null) return this.logger.debug(this.formatMessage(message), dataOrContext);
1834
- this.setContextIfProvided(typeof dataOrContext === "string" ? dataOrContext : void 0);
1835
- this.logger.debug(this.formatMessage(message)).catch((err) => require_internal_log.internalError("LogixiaLoggerService.debug failed", err));
1836
- }
1837
- verbose(message, dataOrContext) {
1838
- if (typeof dataOrContext === "object" && dataOrContext !== null) return this.logger.trace(this.formatMessage(message), dataOrContext);
1839
- this.setContextIfProvided(typeof dataOrContext === "string" ? dataOrContext : void 0);
1840
- this.logger.trace(this.formatMessage(message)).catch((err) => require_internal_log.internalError("LogixiaLoggerService.verbose failed", err));
1841
- }
1842
- /**
1843
- * Native async `trace` — lowest verbosity level, structured data.
1844
- */
1845
- async trace(message, data) {
1846
- return this.logger.trace(message, data);
1847
- }
1848
- /**
1849
- * Log at any named level with structured data.
1850
- */
1851
- logLevel(level, message, data) {
1852
- return this.logger.logLevel(level, message, data);
1853
- }
1854
- time(label) {
1855
- this.logger.time(label);
1856
- }
1857
- async timeEnd(label) {
1858
- return this.logger.timeEnd(label);
1859
- }
1860
- async timeAsync(label, fn) {
1861
- return this.logger.timeAsync(label, fn);
1862
- }
1863
- setContext(context) {
1864
- const coerced = typeof context === "string" ? context : require_coerce_utils.safeToString(context);
1865
- this.context = coerced;
1866
- this.logger.setContext(coerced);
1867
- }
1868
- getContext() {
1869
- return this.context;
1870
- }
1871
- setLevel(level) {
1872
- this.logger.setLevel(level);
1873
- }
1874
- getLevel() {
1875
- return this.logger.getLevel();
1876
- }
1877
- child(context, data) {
1878
- const childService = new _LogixiaLoggerService(this._mergedConfig);
1879
- childService.logger = this.logger.child(context, data);
1880
- childService.context = context;
1881
- return childService;
1882
- }
1883
- getCurrentTraceId() {
1884
- return require_trace_utils.TraceContext.instance.getCurrentTraceId();
1885
- }
1886
- /** Returns the AsyncLocalStorage key currently used to store the trace ID. */
1887
- get traceContextKey() {
1888
- return require_trace_utils.getTraceContextKey();
1889
- }
1890
- async close() {
1891
- return this.logger.close();
1892
- }
1893
- static create(config) {
1894
- return new _LogixiaLoggerService(config);
1895
- }
1896
- getLogger() {
1897
- return this.logger;
1898
- }
1899
- setContextIfProvided(context) {
1900
- if (typeof context !== "string" || context.length === 0) return;
1901
- if (context !== this.context) this.setContext(context);
1902
- }
1903
- formatMessage(message) {
1904
- if (typeof message === "string") return message;
1905
- return require_coerce_utils.safeToString(message);
1906
- }
1907
- };
1908
- LogixiaLoggerService = _LogixiaLoggerService = __decorate([(0, __nestjs_common.Injectable)({ scope: __nestjs_common.Scope.TRANSIENT }), __decorateMetadata("design:paramtypes", [Object])], LogixiaLoggerService);
1909
-
1910
- //#endregion
1911
- //#region src/core/kafka-trace.interceptor.ts
1912
- var _KafkaTraceInterceptor;
1913
- let KafkaTraceInterceptor = class KafkaTraceInterceptor$1 {
1914
- static {
1915
- _KafkaTraceInterceptor = this;
1916
- }
1917
- static #_ = this.metrics = {
1918
- accepted: 0,
1919
- acceptedWithoutTrace: 0,
1920
- dropped: 0
1921
- };
1922
- /** Reset counters (tests). */
1923
- static resetMetrics() {
1924
- _KafkaTraceInterceptor.metrics.accepted = 0;
1925
- _KafkaTraceInterceptor.metrics.acceptedWithoutTrace = 0;
1926
- _KafkaTraceInterceptor.metrics.dropped = 0;
1927
- }
1928
- /**
1929
- * @param config - TraceIdConfig options (extractor keys, contextKey, etc.)
1930
- * @param requireTraceId - When true, messages with no traceId are silently skipped
1931
- * (EMPTY Observable — message is ack'd, consumer stays alive).
1932
- * A WARN is logged AND `KafkaTraceInterceptor.metrics.dropped`
1933
- * increments so the missing traceId is observable end-to-end.
1934
- * Default: false (handler runs without trace context).
1935
- */
1936
- constructor(config, requireTraceId = false) {
1937
- this.config = config;
1938
- this.requireTraceId = requireTraceId;
1939
- this.ctx = require_trace_utils.TraceContext.instance;
1940
- this.config = {
1941
- enabled: true,
1942
- contextKey: "traceId",
1943
- extractor: {
1944
- body: [
1945
- "traceId",
1946
- "trace_id",
1947
- "x-trace-id"
1948
- ],
1949
- header: ["x-trace-id", "trace-id"]
1950
- },
1951
- ...config
1952
- };
1953
- }
1954
- intercept(context, next) {
1955
- var _this$config;
1956
- if (!((_this$config = this.config) === null || _this$config === void 0 ? void 0 : _this$config.enabled)) return next.handle();
1957
- const rpcContext = context.switchToRpc();
1958
- const data = rpcContext.getData();
1959
- const rpcData = rpcContext.getContext();
1960
- let traceId;
1961
- if (this.config.extractor) traceId = require_trace_utils.extractTraceId({
1962
- body: data,
1963
- headers: (rpcData === null || rpcData === void 0 ? void 0 : rpcData.headers) ?? {},
1964
- query: {},
1965
- params: {}
1966
- }, this.config.extractor);
1967
- if (!traceId) traceId = this.ctx.getCurrentTraceId();
1968
- if (!traceId) {
1969
- if (this.requireTraceId) {
1970
- var _LogixiaLoggerModule$;
1971
- _KafkaTraceInterceptor.metrics.dropped++;
1972
- (_LogixiaLoggerModule$ = LogixiaLoggerModule.getGlobalLogger()) === null || _LogixiaLoggerModule$ === void 0 || _LogixiaLoggerModule$.warn(`[KafkaTraceInterceptor] Missing traceId on topic "${rpcData === null || rpcData === void 0 ? void 0 : rpcData.topic}" — message skipped.`);
1973
- return rxjs.EMPTY;
1974
- }
1975
- _KafkaTraceInterceptor.metrics.acceptedWithoutTrace++;
1976
- return next.handle();
1977
- }
1978
- _KafkaTraceInterceptor.metrics.accepted++;
1979
- const kafkaContext = {
1980
- messageType: "kafka",
1981
- topic: rpcData === null || rpcData === void 0 ? void 0 : rpcData.topic,
1982
- partition: rpcData === null || rpcData === void 0 ? void 0 : rpcData.partition,
1983
- offset: rpcData === null || rpcData === void 0 ? void 0 : rpcData.offset,
1984
- key: rpcData === null || rpcData === void 0 ? void 0 : rpcData.key,
1985
- timestamp: rpcData === null || rpcData === void 0 ? void 0 : rpcData.timestamp
1986
- };
1987
- return new rxjs.Observable((subscriber) => {
1988
- let inner;
1989
- this.ctx.run(traceId, () => {
1990
- inner = next.handle().subscribe({
1991
- next: (value) => subscriber.next(value),
1992
- error: (err) => subscriber.error(err),
1993
- complete: () => subscriber.complete()
1994
- });
1995
- }, kafkaContext);
1996
- return () => inner === null || inner === void 0 ? void 0 : inner.unsubscribe();
1997
- });
1998
- }
1999
- };
2000
- KafkaTraceInterceptor = _KafkaTraceInterceptor = __decorate([(0, __nestjs_common.Injectable)(), __decorateMetadata("design:paramtypes", [Object, Boolean])], KafkaTraceInterceptor);
2001
-
2002
- //#endregion
2003
- //#region \0@oxc-project+runtime@0.95.0/helpers/decorateParam.js
2004
- function __decorateParam(paramIndex, decorator) {
2005
- return function(target, key) {
2006
- decorator(target, key, paramIndex);
2007
- };
2008
- }
2009
-
2010
- //#endregion
2011
- //#region src/core/trace.middleware.ts
2012
- /** Default response header used to echo the resolved traceId back to the caller. */
2013
- const DEFAULT_TRACE_RESPONSE_HEADER = "X-Trace-Id";
2014
- /**
2015
- * Resolve the response header name from config.
2016
- * - `undefined` → default `'X-Trace-Id'`
2017
- * - `string` → user's custom header
2018
- * - `false` → `null` (suppress entirely)
2019
- */
2020
- function resolveResponseHeader(config) {
2021
- if ((config === null || config === void 0 ? void 0 : config.responseHeader) === false) return null;
2022
- return (config === null || config === void 0 ? void 0 : config.responseHeader) ?? DEFAULT_TRACE_RESPONSE_HEADER;
2023
- }
2024
- /**
2025
- * Echo the trace ID on the response, tolerating non-Express responses and
2026
- * already-sent headers. NestJS can run on Fastify (reply.header() instead of
2027
- * res.setHeader()), and on a closed/sent response setHeader throws — neither
2028
- * should crash the request. The trace ID is still propagated via async context.
2029
- */
2030
- function writeTraceHeader(res, header, traceId) {
2031
- const r = res;
2032
- if (r.headersSent) return;
2033
- try {
2034
- if (typeof r.setHeader === "function") r.setHeader(header, traceId);
2035
- else if (typeof r.header === "function") r.header(header, traceId);
2036
- } catch {}
2037
- }
2038
- let TraceMiddleware = class TraceMiddleware$1 {
2039
- constructor(config) {
2040
- this.config = config;
2041
- this.ctx = require_trace_utils.TraceContext.instance;
2042
- const defaultExtractor = {
2043
- header: require_trace_utils.DEFAULT_TRACE_HEADERS,
2044
- query: ["traceId", "trace_id"]
2045
- };
2046
- this.config = {
2047
- enabled: true,
2048
- generator: () => this.ctx.generate(),
2049
- contextKey: "traceId",
2050
- ...config,
2051
- extractor: (config === null || config === void 0 ? void 0 : config.extractor) ? {
2052
- ...defaultExtractor,
2053
- ...config.extractor
2054
- } : defaultExtractor
2055
- };
2056
- if (this.config.enabled) this.ctx.setContextKey(this.config.contextKey ?? "traceId");
2057
- }
2058
- use(req, res, next) {
2059
- var _this$config, _req$socket, _req$connection;
2060
- if (!((_this$config = this.config) === null || _this$config === void 0 ? void 0 : _this$config.enabled)) return next();
2061
- let traceId;
2062
- if (this.config.extractor) traceId = require_trace_utils.extractTraceId(req, this.config.extractor);
2063
- if (!traceId && this.config.generator) {
2064
- const candidate = this.config.generator();
2065
- if (typeof candidate === "string" && candidate.trim().length > 0) traceId = candidate;
2066
- else require_internal_log.internalWarn("TraceIdConfig.generator returned a non-string/empty value — using built-in generator.");
2067
- }
2068
- if (!traceId) traceId = this.ctx.generate();
2069
- req.traceId = traceId;
2070
- const header = resolveResponseHeader(this.config);
2071
- if (header) writeTraceHeader(res, header, traceId);
2072
- this.ctx.run(traceId, () => next(), {
2073
- method: req.method,
2074
- url: req.url,
2075
- userAgent: req.get("User-Agent"),
2076
- ip: req.ip || ((_req$socket = req.socket) === null || _req$socket === void 0 ? void 0 : _req$socket.remoteAddress) || ((_req$connection = req.connection) === null || _req$connection === void 0 ? void 0 : _req$connection.remoteAddress)
2077
- });
2078
- }
2079
- };
2080
- TraceMiddleware = __decorate([
2081
- (0, __nestjs_common.Injectable)(),
2082
- __decorateParam(0, (0, __nestjs_common.Optional)()),
2083
- __decorateMetadata("design:paramtypes", [Object])
2084
- ], TraceMiddleware);
2085
-
2086
- //#endregion
2087
- //#region src/core/websocket-trace.interceptor.ts
2088
- let WebSocketTraceInterceptor = class WebSocketTraceInterceptor$1 {
2089
- constructor(config) {
2090
- this.config = config;
2091
- this.ctx = require_trace_utils.TraceContext.instance;
2092
- this.config = {
2093
- enabled: true,
2094
- contextKey: "traceId",
2095
- extractor: {
2096
- body: [
2097
- "traceId",
2098
- "trace_id",
2099
- "x-trace-id"
2100
- ],
2101
- header: ["x-trace-id", "trace-id"],
2102
- query: ["traceId", "trace_id"]
2103
- },
2104
- ...config
2105
- };
2106
- }
2107
- intercept(context, next) {
2108
- var _this$config, _client$handshake3;
2109
- if (!((_this$config = this.config) === null || _this$config === void 0 ? void 0 : _this$config.enabled)) return next.handle();
2110
- const wsContext = context.switchToWs();
2111
- const data = wsContext.getData();
2112
- const client = wsContext.getClient();
2113
- let traceId;
2114
- if (this.config.extractor) {
2115
- var _client$handshake, _client$handshake2;
2116
- traceId = require_trace_utils.extractTraceId({
2117
- body: data,
2118
- headers: (client === null || client === void 0 || (_client$handshake = client.handshake) === null || _client$handshake === void 0 ? void 0 : _client$handshake.headers) || {},
2119
- query: (client === null || client === void 0 || (_client$handshake2 = client.handshake) === null || _client$handshake2 === void 0 ? void 0 : _client$handshake2.query) || {},
2120
- params: {}
2121
- }, this.config.extractor);
2122
- }
2123
- if (!traceId) traceId = this.ctx.getCurrentTraceId();
2124
- if (!traceId) return next.handle();
2125
- const wsContextData = {
2126
- messageType: "websocket",
2127
- event: data === null || data === void 0 ? void 0 : data.event,
2128
- socketId: client === null || client === void 0 ? void 0 : client.id,
2129
- rooms: (client === null || client === void 0 ? void 0 : client.rooms) ? Array.from(client.rooms) : [],
2130
- clientAddress: client === null || client === void 0 || (_client$handshake3 = client.handshake) === null || _client$handshake3 === void 0 ? void 0 : _client$handshake3.address
2131
- };
2132
- return new rxjs.Observable((observer) => {
2133
- let inner;
2134
- this.ctx.run(traceId, () => {
2135
- inner = next.handle().subscribe({
2136
- next: (value) => observer.next(value),
2137
- error: (err) => observer.error(err),
2138
- complete: () => observer.complete()
2139
- });
2140
- }, wsContextData);
2141
- return () => inner === null || inner === void 0 ? void 0 : inner.unsubscribe();
2142
- });
2143
- }
2144
- };
2145
- WebSocketTraceInterceptor = __decorate([(0, __nestjs_common.Injectable)(), __decorateMetadata("design:paramtypes", [Object])], WebSocketTraceInterceptor);
2146
-
2147
- //#endregion
2148
- //#region src/core/logitron-logger.module.ts
2149
- var _LogixiaLoggerModule;
2150
- const DEFAULT_ROUTES = [{
2151
- path: "*",
2152
- method: __nestjs_common.RequestMethod.ALL
2153
- }];
2154
- const LOGIXIA_LOGGER_CONFIG = "LOGIXIA_LOGGER_CONFIG";
2155
- const LOGIXIA_TRACE_CONFIG = "TRACE_CONFIG";
2156
- const LOGIXIA_LOGGER_PREFIX = "LOGIXIA_LOGGER_";
2157
- let LogixiaLoggerModule = class LogixiaLoggerModule$1 {
2158
- static {
2159
- _LogixiaLoggerModule = this;
2160
- }
2161
- constructor() {
2162
- this.config = {};
2163
- }
2164
- static #_ = this.loggerConfig = {};
2165
- static #_2 = this._globalLogger = null;
2166
- /**
2167
- * @internal Set the global logger exactly once.
2168
- *
2169
- * Called from the module's forRoot / forRootAsync factory. If the module is
2170
- * initialised more than once in the same process (nested DI context, test
2171
- * harness creating multiple apps, hot reload, etc.) a warning is written to
2172
- * stderr and the first logger wins — silently overwriting would allow the
2173
- * newer instance's transport config to replace the live one while the old
2174
- * one is still being used by registered shutdown hooks, decorators, etc.
2175
- *
2176
- * Use {@link _resetGlobalLogger} in tests to reset between runs.
2177
- */
2178
- static _setGlobalLogger(service) {
2179
- if (_LogixiaLoggerModule._globalLogger !== null) {
2180
- require_internal_log.internalWarn("LogixiaLoggerModule.forRoot() was called more than once — ignoring the second init. If this is intentional (e.g. in tests), call LogixiaLoggerModule._resetGlobalLogger() first.");
2181
- return;
2182
- }
2183
- _LogixiaLoggerModule._globalLogger = service;
2184
- }
2185
- /** @internal Clear the global logger. Tests only. */
2186
- static _resetGlobalLogger() {
2187
- _LogixiaLoggerModule._globalLogger = null;
2188
- }
2189
- /**
2190
- * Returns the global LogixiaLoggerService instance that was created when the
2191
- * module booted. Useful for logging outside of NestJS DI — utility functions,
2192
- * plain scripts, decorators — without injecting the service everywhere.
2193
- *
2194
- * Returns `null` if called before `LogixiaLoggerModule.forRoot[Async]()` has
2195
- * been initialised (i.e. before the NestJS app has started).
2196
- *
2197
- * @example
2198
- * ```ts
2199
- * // some-util.ts
2200
- * import { LogixiaLoggerModule } from 'logixia/nest';
2201
- *
2202
- * export function doSomething() {
2203
- * LogixiaLoggerModule.getGlobalLogger()?.info('doing something');
2204
- * }
2205
- * ```
2206
- */
2207
- static getGlobalLogger() {
2208
- return _LogixiaLoggerModule._globalLogger;
2209
- }
2210
- configure(consumer) {
2211
- const { forRoutes = DEFAULT_ROUTES, exclude } = this.config;
2212
- let resolvedTraceConfig;
2213
- if (typeof _LogixiaLoggerModule.loggerConfig.traceId === "object") resolvedTraceConfig = _LogixiaLoggerModule.loggerConfig.traceId;
2214
- else if (_LogixiaLoggerModule.loggerConfig.traceId === true) resolvedTraceConfig = {
2215
- enabled: true,
2216
- contextKey: "traceId",
2217
- generator: () => require_trace_utils.TraceContext.instance.generate()
2218
- };
2219
- const middleware = new TraceMiddleware(resolvedTraceConfig);
2220
- const middlewareConfig = (req, res, next) => middleware.use(req, res, next);
2221
- if (exclude) consumer.apply(middlewareConfig).exclude(...exclude).forRoutes(...forRoutes);
2222
- else consumer.apply(middlewareConfig).forRoutes(...forRoutes);
2223
- }
2224
- /**
2225
- * Configure the module with synchronous options
2226
- */
2227
- static forRoot(config) {
2228
- _LogixiaLoggerModule.loggerConfig = config || {};
2229
- const traceConfig = (config === null || config === void 0 ? void 0 : config.traceId) && typeof config.traceId === "object" ? config.traceId : { enabled: !!(config === null || config === void 0 ? void 0 : config.traceId) };
2230
- return {
2231
- module: _LogixiaLoggerModule,
2232
- providers: [
2233
- {
2234
- provide: LOGIXIA_LOGGER_CONFIG,
2235
- useValue: config || {}
2236
- },
2237
- {
2238
- provide: LOGIXIA_TRACE_CONFIG,
2239
- useValue: traceConfig
2240
- },
2241
- {
2242
- provide: LogixiaLoggerService,
2243
- useFactory: (loggerConfig) => {
2244
- const service = new LogixiaLoggerService({
2245
- level: "info",
2246
- service: "NestJSApp",
2247
- environment: "development",
2248
- fields: {},
2249
- formatters: ["text"],
2250
- outputs: ["console"],
2251
- levelOptions: {
2252
- level: "info",
2253
- levels: {
2254
- error: 0,
2255
- warn: 1,
2256
- info: 2,
2257
- debug: 3,
2258
- verbose: 4
2259
- },
2260
- colors: {
2261
- error: "red",
2262
- warn: "yellow",
2263
- info: "green",
2264
- debug: "blue",
2265
- verbose: "cyan"
2266
- }
2267
- },
2268
- ...loggerConfig
2269
- });
2270
- _LogixiaLoggerModule._setGlobalLogger(service);
2271
- return service;
2272
- },
2273
- inject: [LOGIXIA_LOGGER_CONFIG]
2274
- },
2275
- {
2276
- provide: KafkaTraceInterceptor,
2277
- useFactory: (traceConfig$1) => new KafkaTraceInterceptor(traceConfig$1),
2278
- inject: [LOGIXIA_TRACE_CONFIG]
2279
- },
2280
- {
2281
- provide: WebSocketTraceInterceptor,
2282
- useFactory: (traceConfig$1) => new WebSocketTraceInterceptor(traceConfig$1),
2283
- inject: [LOGIXIA_TRACE_CONFIG]
2284
- }
2285
- ],
2286
- exports: [
2287
- LogixiaLoggerService,
2288
- LOGIXIA_LOGGER_CONFIG,
2289
- KafkaTraceInterceptor,
2290
- WebSocketTraceInterceptor
2291
- ],
2292
- global: true
2293
- };
2294
- }
2295
- /**
2296
- * Configure the module with asynchronous options
2297
- */
2298
- static forRootAsync(options) {
2299
- return {
2300
- module: _LogixiaLoggerModule,
2301
- imports: options.imports || [],
2302
- providers: [
2303
- ...this.createAsyncProviders(options),
2304
- {
2305
- provide: LOGIXIA_TRACE_CONFIG,
2306
- useFactory: (loggerConfig) => {
2307
- return typeof (loggerConfig === null || loggerConfig === void 0 ? void 0 : loggerConfig.traceId) === "object" ? loggerConfig.traceId : { enabled: !!(loggerConfig === null || loggerConfig === void 0 ? void 0 : loggerConfig.traceId) };
2308
- },
2309
- inject: [LOGIXIA_LOGGER_CONFIG]
2310
- },
2311
- {
2312
- provide: LogixiaLoggerService,
2313
- useFactory: (loggerConfig) => {
2314
- const defaultConfig = {
2315
- level: "info",
2316
- service: "NestJSApp",
2317
- environment: "development",
2318
- fields: {},
2319
- formatters: ["text"],
2320
- outputs: ["console"],
2321
- levelOptions: {
2322
- level: "info",
2323
- levels: {
2324
- error: 0,
2325
- warn: 1,
2326
- info: 2,
2327
- debug: 3,
2328
- verbose: 4
2329
- },
2330
- colors: {
2331
- error: "red",
2332
- warn: "yellow",
2333
- info: "green",
2334
- debug: "blue",
2335
- verbose: "cyan"
2336
- }
2337
- },
2338
- ...loggerConfig
2339
- };
2340
- _LogixiaLoggerModule.loggerConfig = defaultConfig;
2341
- const service = new LogixiaLoggerService(defaultConfig);
2342
- _LogixiaLoggerModule._setGlobalLogger(service);
2343
- return service;
2344
- },
2345
- inject: [LOGIXIA_LOGGER_CONFIG]
2346
- },
2347
- {
2348
- provide: KafkaTraceInterceptor,
2349
- useFactory: (traceConfig) => new KafkaTraceInterceptor(traceConfig),
2350
- inject: [LOGIXIA_TRACE_CONFIG]
2351
- },
2352
- {
2353
- provide: WebSocketTraceInterceptor,
2354
- useFactory: (traceConfig) => new WebSocketTraceInterceptor(traceConfig),
2355
- inject: [LOGIXIA_TRACE_CONFIG]
2356
- }
2357
- ],
2358
- exports: [
2359
- LogixiaLoggerService,
2360
- LOGIXIA_LOGGER_CONFIG,
2361
- KafkaTraceInterceptor,
2362
- WebSocketTraceInterceptor
2363
- ],
2364
- global: true
2365
- };
2366
- }
2367
- /**
2368
- * Create feature-specific logger instances
2369
- */
2370
- static forFeature(context) {
2371
- const providerToken = `${LOGIXIA_LOGGER_PREFIX}${context.toUpperCase()}`;
2372
- return {
2373
- module: _LogixiaLoggerModule,
2374
- providers: [{
2375
- provide: providerToken,
2376
- useFactory: (baseLogger) => {
2377
- return baseLogger.child(context);
2378
- },
2379
- inject: [LogixiaLoggerService]
2380
- }],
2381
- exports: [providerToken]
2382
- };
2383
- }
2384
- static createAsyncProviders(options) {
2385
- if (options.useExisting || options.useFactory) return [this.createAsyncOptionsProvider(options)];
2386
- return [this.createAsyncOptionsProvider(options), {
2387
- provide: options.useClass,
2388
- useClass: options.useClass
2389
- }];
2390
- }
2391
- static createAsyncOptionsProvider(options) {
2392
- if (options.useFactory) return {
2393
- provide: LOGIXIA_LOGGER_CONFIG,
2394
- useFactory: options.useFactory,
2395
- inject: options.inject || []
2396
- };
2397
- return {
2398
- provide: LOGIXIA_LOGGER_CONFIG,
2399
- useFactory: async (optionsFactory) => await optionsFactory.createLogixiaOptions(),
2400
- inject: [options.useExisting || options.useClass]
2401
- };
2402
- }
2403
- };
2404
- LogixiaLoggerModule = _LogixiaLoggerModule = __decorate([(0, __nestjs_common.Module)({})], LogixiaLoggerModule);
2405
-
2406
- //#endregion
2407
- //#region src/exceptions/exception.ts
1867
+ // src/exceptions/exception.ts
2408
1868
  var LogixiaException = class extends Error {
2409
1869
  constructor(options) {
2410
1870
  super(options.message, { cause: options.cause });
@@ -2435,9 +1895,21 @@ var LogixiaException = class extends Error {
2435
1895
  function isLogixiaException(value) {
2436
1896
  return value instanceof LogixiaException;
2437
1897
  }
2438
-
2439
- //#endregion
2440
- //#region src/exceptions/builder.ts
1898
+ // src/exceptions/builder.ts
1899
+ /**
1900
+ * ErrorResponseBuilder — turns any exception into a `LogixiaErrorResponse`.
1901
+ *
1902
+ * Priority order:
1903
+ * 1. `LogixiaException` — typed fields used directly
1904
+ * 2. NestJS `HttpException` — duck-typed; status + message extracted
1905
+ * 3. Plain `Error` / unknown — falls back to 500 `server_error`
1906
+ *
1907
+ * The builder **always** populates `debug` when possible.
1908
+ * Your exception filter is responsible for stripping it in production:
1909
+ * ```ts
1910
+ * if (process.env.NODE_ENV === 'production') delete response.debug;
1911
+ * ```
1912
+ */
2441
1913
  /**
2442
1914
  * Generates a trace ID via the shared {@link TraceContext} generator.
2443
1915
  *
@@ -2448,7 +1920,7 @@ function isLogixiaException(value) {
2448
1920
  * @example `'550e8400-e29b-41d4-a716-446655440000'`
2449
1921
  */
2450
1922
  function generateTraceId() {
2451
- return require_trace_utils.TraceContext.instance.generate();
1923
+ return require_request_trace.TraceContext.instance.generate();
2452
1924
  }
2453
1925
  /** @deprecated Use `generateTraceId` instead. */
2454
1926
  const generateRequestId = generateTraceId;
@@ -2535,11 +2007,11 @@ var ErrorResponseBuilder = class {
2535
2007
  debug: exposeDebug,
2536
2008
  cause: exposeCause
2537
2009
  };
2538
- const traceId = require_trace_utils.TraceContext.instance.getCurrentTraceId() ?? rawTraceId;
2010
+ const traceId = require_request_trace.TraceContext.instance.getCurrentTraceId() ?? rawTraceId;
2539
2011
  const timestamp = (/* @__PURE__ */ new Date()).toISOString();
2540
2012
  const durationMs = startTime !== void 0 ? Date.now() - startTime : void 0;
2541
2013
  if (isLogixiaException(exception)) {
2542
- const debug$1 = buildDebug(exception, service, durationMs, expose);
2014
+ const debug = buildDebug(exception, service, durationMs, expose);
2543
2015
  const errorBlock = {
2544
2016
  type: exception.errorType,
2545
2017
  code: exception.errorCode,
@@ -2558,7 +2030,7 @@ var ErrorResponseBuilder = class {
2558
2030
  path,
2559
2031
  status: exception.httpStatus
2560
2032
  },
2561
- ...debug$1 !== void 0 ? { debug: debug$1 } : {}
2033
+ ...debug !== void 0 ? { debug } : {}
2562
2034
  },
2563
2035
  httpStatus: exception.httpStatus
2564
2036
  };
@@ -2574,7 +2046,7 @@ var ErrorResponseBuilder = class {
2574
2046
  } else message = exception.message;
2575
2047
  const type = httpStatusToType(status);
2576
2048
  const code = `HTTP_${status}`;
2577
- const debug$1 = buildDebug(exception, service, durationMs, expose);
2049
+ const debug = buildDebug(exception, service, durationMs, expose);
2578
2050
  return {
2579
2051
  response: {
2580
2052
  success: false,
@@ -2589,7 +2061,7 @@ var ErrorResponseBuilder = class {
2589
2061
  path,
2590
2062
  status
2591
2063
  },
2592
- ...debug$1 !== void 0 ? { debug: debug$1 } : {}
2064
+ ...debug !== void 0 ? { debug } : {}
2593
2065
  },
2594
2066
  httpStatus: status
2595
2067
  };
@@ -2615,401 +2087,173 @@ var ErrorResponseBuilder = class {
2615
2087
  };
2616
2088
  }
2617
2089
  };
2618
-
2619
- //#endregion
2620
- //#region src/core/nestjs-extras.ts
2621
- var _ref;
2622
- /**
2623
- * Inject the Logixia logger registered in the current NestJS DI container.
2624
- *
2625
- * Equivalent to `@Inject(LOGIXIA_LOGGER_TOKEN)` but without needing to import
2626
- * the internal token constant yourself.
2627
- *
2628
- * @example
2629
- * ```ts
2630
- * constructor(@InjectLogger() private readonly logger: LogixiaLoggerService) {}
2631
- * ```
2632
- */
2633
- const InjectLogger = () => (0, __nestjs_common.Inject)(`${LOGIXIA_LOGGER_PREFIX}SERVICE`);
2634
- /**
2635
- * Method decorator that auto-logs entry, exit, duration, and errors.
2636
- *
2637
- * Preserves the original method's sync/async contract: a synchronous method
2638
- * stays synchronous (returns its value directly, with logs emitted
2639
- * fire-and-forget), and an async method is awaited so exit/error logs reflect
2640
- * the resolved result. Attaches to the logger found on the class instance via a
2641
- * `logger` property (the conventional NestJS name).
2642
- *
2643
- * @example
2644
- * ```ts
2645
- * @LogMethod({ level: 'info', logArgs: true })
2646
- * async processPayment(orderId: string): Promise<void> { … }
2647
- * ```
2648
- */
2649
- function LogMethod(options = {}) {
2650
- const { level = "debug", logArgs = true, logResult = false, logErrors = true } = options;
2651
- return function(target, propertyKey, descriptor) {
2652
- var _constructor;
2653
- const originalMethod = descriptor.value;
2654
- if (typeof originalMethod !== "function") return descriptor;
2655
- const methodName = String(propertyKey);
2656
- const className = ((_constructor = target.constructor) === null || _constructor === void 0 ? void 0 : _constructor.name) ?? "Unknown";
2657
- const label = options.label ?? `${className}.${methodName}`;
2658
- let _warnedNoLogger = false;
2659
- const reportLogFailure = (phase, err) => {
2660
- require_internal_log.internalError(`@LogMethod(${label}) ${phase} log failed: ${String(err)}`);
2661
- };
2662
- const emit = (logger, phase, message, data) => {
2663
- const logFnRaw = logger[level];
2664
- const p = (typeof logFnRaw === "function" ? logFnRaw : logger.debug).bind(logger)(message, data);
2665
- if (p && typeof p.catch === "function") p.catch((e) => reportLogFailure(phase, e));
2666
- };
2667
- const emitError = (logger, error, start) => {
2668
- const err = error instanceof Error ? error : new Error(String(error));
2669
- const errLog = logger.error(err, {
2670
- method: label,
2671
- durationMs: Date.now() - start
2672
- });
2673
- if (errLog && typeof errLog.catch === "function") errLog.catch((e) => reportLogFailure("error", e));
2674
- };
2675
- descriptor.value = function(...args) {
2676
- const logger = this.logger ?? LogixiaLoggerModule._globalLogger ?? void 0;
2677
- if (!logger && !_warnedNoLogger) {
2678
- _warnedNoLogger = true;
2679
- require_internal_log.internalWarn(`@LogMethod on ${label}: no logger available. Either inject LogixiaLoggerService as this.logger or ensure LogixiaLoggerModule is initialised.`);
2680
- }
2681
- const start = Date.now();
2682
- const entry = { method: label };
2683
- if (logArgs && args.length > 0) entry["args"] = args;
2684
- if (logger) emit(logger, "entry", `→ ${label}`, entry);
2685
- const buildExit = (result$1) => {
2686
- const exit = {
2687
- method: label,
2688
- durationMs: Date.now() - start
2689
- };
2690
- if (logResult) exit["result"] = result$1;
2691
- return exit;
2692
- };
2693
- let result;
2694
- try {
2695
- result = originalMethod.apply(this, args);
2696
- } catch (error) {
2697
- if (logger && logErrors) emitError(logger, error, start);
2698
- throw error;
2699
- }
2700
- if (result && typeof result.then === "function") return result.then((resolved) => {
2701
- if (logger) emit(logger, "exit", `← ${label}`, buildExit(resolved));
2702
- return resolved;
2703
- }, (error) => {
2704
- if (logger && logErrors) emitError(logger, error, start);
2705
- throw error;
2706
- });
2707
- if (logger) emit(logger, "exit", `← ${label}`, buildExit(result));
2708
- return result;
2709
- };
2710
- return descriptor;
2711
- };
2712
- }
2713
- /** Injection token for {@link LogixiaExceptionFilterOptions}. */
2714
- const LOGIXIA_EXCEPTION_FILTER_OPTIONS = "LOGIXIA_EXCEPTION_FILTER_OPTIONS";
2715
- let LogixiaExceptionFilter = class LogixiaExceptionFilter$1 {
2716
- constructor(logger, loggerConfig, options) {
2717
- this._options = options ?? {};
2718
- this._logger = logger ?? LogixiaLoggerModule._globalLogger ?? void 0;
2719
- this._traceConfig = typeof (loggerConfig === null || loggerConfig === void 0 ? void 0 : loggerConfig.traceId) === "object" ? loggerConfig.traceId : void 0;
2720
- }
2721
- catch(exception, host) {
2722
- var _request$headers;
2723
- const ctx = host.switchToHttp();
2724
- const request = ctx.getRequest();
2725
- const response = ctx.getResponse();
2726
- const traceId = require_trace_utils.TraceContext.instance.getCurrentTraceId() ?? require_trace_utils.sanitizeIncomingId((_request$headers = request.headers) === null || _request$headers === void 0 ? void 0 : _request$headers["x-trace-id"]) ?? require_trace_utils.sanitizeIncomingId(request.id) ?? void 0;
2727
- const { response: errorResponse, httpStatus } = ErrorResponseBuilder.build({
2728
- exception,
2729
- traceId,
2730
- path: request.url ?? "/",
2731
- startTime: request.startTime,
2732
- exposeDebug: this._options.exposeDebug === true,
2733
- exposeCause: this._options.exposeCause === true
2734
- });
2735
- if (this._logger) {
2736
- const requestMeta = {
2737
- method: request.method ?? "",
2738
- url: request.url ?? "",
2739
- status: httpStatus,
2740
- ...errorResponse.meta.trace_id !== void 0 ? { trace_id: errorResponse.meta.trace_id } : {}
2741
- };
2742
- const onLogFailure = (err) => {
2743
- require_internal_log.internalError(`ExceptionFilter failed to write log entry: ${String(err)}`);
2744
- };
2745
- let logPromise;
2746
- if (httpStatus >= 500) {
2747
- const err = exception instanceof Error ? exception : new Error(String(exception));
2748
- logPromise = this._logger.error(err, requestMeta);
2749
- } else if (isLogixiaException(exception)) logPromise = this._logger.warn(`[${errorResponse.error.code}] ${errorResponse.error.message}`, requestMeta);
2750
- else logPromise = this._logger.warn(`[${httpStatus}] ${errorResponse.error.message}`, requestMeta);
2751
- if (logPromise && typeof logPromise.catch === "function") logPromise.catch(onLogFailure);
2752
- }
2753
- if (errorResponse.meta.trace_id) {
2754
- const traceHeader = resolveResponseHeader(this._traceConfig);
2755
- if (traceHeader) try {
2756
- response.setHeader(traceHeader, errorResponse.meta.trace_id);
2757
- } catch {}
2758
- }
2759
- if (httpStatus === 429) try {
2760
- response.setHeader("Retry-After", "60");
2761
- } catch {}
2762
- response.status(httpStatus).json(errorResponse);
2090
+ Object.defineProperty(exports, "DEFAULT_CONFIG", {
2091
+ enumerable: true,
2092
+ get: function() {
2093
+ return DEFAULT_CONFIG;
2763
2094
  }
2764
- };
2765
- LogixiaExceptionFilter = __decorate([
2766
- (0, __nestjs_common.Catch)(),
2767
- __decorateParam(0, (0, __nestjs_common.Optional)()),
2768
- __decorateParam(0, (0, __nestjs_common.Inject)(`${LOGIXIA_LOGGER_PREFIX}SERVICE`)),
2769
- __decorateParam(1, (0, __nestjs_common.Optional)()),
2770
- __decorateParam(1, (0, __nestjs_common.Inject)(LOGIXIA_LOGGER_CONFIG)),
2771
- __decorateParam(2, (0, __nestjs_common.Optional)()),
2772
- __decorateParam(2, (0, __nestjs_common.Inject)(LOGIXIA_EXCEPTION_FILTER_OPTIONS)),
2773
- __decorateMetadata("design:paramtypes", [
2774
- Object,
2775
- typeof (_ref = typeof Partial !== "undefined" && Partial) === "function" ? _ref : Object,
2776
- Object
2777
- ])
2778
- ], LogixiaExceptionFilter);
2779
-
2780
- //#endregion
2781
- Object.defineProperty(exports, 'DEFAULT_LOG_COLORS', {
2782
- enumerable: true,
2783
- get: function () {
2784
- return DEFAULT_LOG_COLORS;
2785
- }
2786
- });
2787
- Object.defineProperty(exports, 'DEFAULT_LOG_LEVELS', {
2788
- enumerable: true,
2789
- get: function () {
2790
- return DEFAULT_LOG_LEVELS;
2791
- }
2792
- });
2793
- Object.defineProperty(exports, 'ErrorResponseBuilder', {
2794
- enumerable: true,
2795
- get: function () {
2796
- return ErrorResponseBuilder;
2797
- }
2798
- });
2799
- Object.defineProperty(exports, 'InjectLogger', {
2800
- enumerable: true,
2801
- get: function () {
2802
- return InjectLogger;
2803
- }
2804
2095
  });
2805
- Object.defineProperty(exports, 'KafkaTraceInterceptor', {
2806
- enumerable: true,
2807
- get: function () {
2808
- return KafkaTraceInterceptor;
2809
- }
2810
- });
2811
- Object.defineProperty(exports, 'LOGIXIA_EXCEPTION_FILTER_OPTIONS', {
2812
- enumerable: true,
2813
- get: function () {
2814
- return LOGIXIA_EXCEPTION_FILTER_OPTIONS;
2815
- }
2816
- });
2817
- Object.defineProperty(exports, 'LOGIXIA_LOGGER_CONFIG', {
2818
- enumerable: true,
2819
- get: function () {
2820
- return LOGIXIA_LOGGER_CONFIG;
2821
- }
2822
- });
2823
- Object.defineProperty(exports, 'LOGIXIA_LOGGER_PREFIX', {
2824
- enumerable: true,
2825
- get: function () {
2826
- return LOGIXIA_LOGGER_PREFIX;
2827
- }
2828
- });
2829
- Object.defineProperty(exports, 'LOGIXIA_TRACE_CONFIG', {
2830
- enumerable: true,
2831
- get: function () {
2832
- return LOGIXIA_TRACE_CONFIG;
2833
- }
2834
- });
2835
- Object.defineProperty(exports, 'LogLevel', {
2836
- enumerable: true,
2837
- get: function () {
2838
- return LogLevel;
2839
- }
2840
- });
2841
- Object.defineProperty(exports, 'LogMethod', {
2842
- enumerable: true,
2843
- get: function () {
2844
- return LogMethod;
2845
- }
2846
- });
2847
- Object.defineProperty(exports, 'LogixiaException', {
2848
- enumerable: true,
2849
- get: function () {
2850
- return LogixiaException;
2851
- }
2852
- });
2853
- Object.defineProperty(exports, 'LogixiaExceptionFilter', {
2854
- enumerable: true,
2855
- get: function () {
2856
- return LogixiaExceptionFilter;
2857
- }
2096
+ Object.defineProperty(exports, "DEFAULT_LOG_COLORS", {
2097
+ enumerable: true,
2098
+ get: function() {
2099
+ return DEFAULT_LOG_COLORS;
2100
+ }
2858
2101
  });
2859
- Object.defineProperty(exports, 'LogixiaLogger', {
2860
- enumerable: true,
2861
- get: function () {
2862
- return LogixiaLogger;
2863
- }
2102
+ Object.defineProperty(exports, "DEFAULT_LOG_LEVELS", {
2103
+ enumerable: true,
2104
+ get: function() {
2105
+ return DEFAULT_LOG_LEVELS;
2106
+ }
2864
2107
  });
2865
- Object.defineProperty(exports, 'LogixiaLoggerModule', {
2866
- enumerable: true,
2867
- get: function () {
2868
- return LogixiaLoggerModule;
2869
- }
2108
+ Object.defineProperty(exports, "ErrorResponseBuilder", {
2109
+ enumerable: true,
2110
+ get: function() {
2111
+ return ErrorResponseBuilder;
2112
+ }
2870
2113
  });
2871
- Object.defineProperty(exports, 'LogixiaLoggerService', {
2872
- enumerable: true,
2873
- get: function () {
2874
- return LogixiaLoggerService;
2875
- }
2114
+ Object.defineProperty(exports, "LogLevel", {
2115
+ enumerable: true,
2116
+ get: function() {
2117
+ return LogLevel;
2118
+ }
2876
2119
  });
2877
- Object.defineProperty(exports, 'PluginRegistry', {
2878
- enumerable: true,
2879
- get: function () {
2880
- return PluginRegistry;
2881
- }
2120
+ Object.defineProperty(exports, "LogixiaException", {
2121
+ enumerable: true,
2122
+ get: function() {
2123
+ return LogixiaException;
2124
+ }
2882
2125
  });
2883
- Object.defineProperty(exports, 'TraceMiddleware', {
2884
- enumerable: true,
2885
- get: function () {
2886
- return TraceMiddleware;
2887
- }
2126
+ Object.defineProperty(exports, "LogixiaLogger", {
2127
+ enumerable: true,
2128
+ get: function() {
2129
+ return LogixiaLogger;
2130
+ }
2888
2131
  });
2889
- Object.defineProperty(exports, 'WebSocketTraceInterceptor', {
2890
- enumerable: true,
2891
- get: function () {
2892
- return WebSocketTraceInterceptor;
2893
- }
2132
+ Object.defineProperty(exports, "PluginRegistry", {
2133
+ enumerable: true,
2134
+ get: function() {
2135
+ return PluginRegistry;
2136
+ }
2894
2137
  });
2895
- Object.defineProperty(exports, '_shutdownRegistrySize', {
2896
- enumerable: true,
2897
- get: function () {
2898
- return _shutdownRegistrySize;
2899
- }
2138
+ Object.defineProperty(exports, "_shutdownRegistrySize", {
2139
+ enumerable: true,
2140
+ get: function() {
2141
+ return _shutdownRegistrySize;
2142
+ }
2900
2143
  });
2901
- Object.defineProperty(exports, 'applyRedaction', {
2902
- enumerable: true,
2903
- get: function () {
2904
- return applyRedaction;
2905
- }
2144
+ Object.defineProperty(exports, "applyRedaction", {
2145
+ enumerable: true,
2146
+ get: function() {
2147
+ return applyRedaction;
2148
+ }
2906
2149
  });
2907
- Object.defineProperty(exports, 'createLogger', {
2908
- enumerable: true,
2909
- get: function () {
2910
- return createLogger;
2911
- }
2150
+ Object.defineProperty(exports, "createLogger", {
2151
+ enumerable: true,
2152
+ get: function() {
2153
+ return createLogger;
2154
+ }
2912
2155
  });
2913
- Object.defineProperty(exports, 'deregisterFromShutdown', {
2914
- enumerable: true,
2915
- get: function () {
2916
- return deregisterFromShutdown;
2917
- }
2156
+ Object.defineProperty(exports, "deregisterFromShutdown", {
2157
+ enumerable: true,
2158
+ get: function() {
2159
+ return deregisterFromShutdown;
2160
+ }
2918
2161
  });
2919
- Object.defineProperty(exports, 'disableOtelBridge', {
2920
- enumerable: true,
2921
- get: function () {
2922
- return disableOtelBridge;
2923
- }
2162
+ Object.defineProperty(exports, "disableOtelBridge", {
2163
+ enumerable: true,
2164
+ get: function() {
2165
+ return disableOtelBridge;
2166
+ }
2924
2167
  });
2925
- Object.defineProperty(exports, 'flushOnExit', {
2926
- enumerable: true,
2927
- get: function () {
2928
- return flushOnExit;
2929
- }
2168
+ Object.defineProperty(exports, "flushOnExit", {
2169
+ enumerable: true,
2170
+ get: function() {
2171
+ return flushOnExit;
2172
+ }
2930
2173
  });
2931
- Object.defineProperty(exports, 'generateRequestId', {
2932
- enumerable: true,
2933
- get: function () {
2934
- return generateRequestId;
2935
- }
2174
+ Object.defineProperty(exports, "generateRequestId", {
2175
+ enumerable: true,
2176
+ get: function() {
2177
+ return generateRequestId;
2178
+ }
2936
2179
  });
2937
- Object.defineProperty(exports, 'generateTraceId', {
2938
- enumerable: true,
2939
- get: function () {
2940
- return generateTraceId;
2941
- }
2180
+ Object.defineProperty(exports, "generateTraceId", {
2181
+ enumerable: true,
2182
+ get: function() {
2183
+ return generateTraceId;
2184
+ }
2942
2185
  });
2943
- Object.defineProperty(exports, 'getActiveOtelContext', {
2944
- enumerable: true,
2945
- get: function () {
2946
- return getActiveOtelContext;
2947
- }
2186
+ Object.defineProperty(exports, "getActiveOtelContext", {
2187
+ enumerable: true,
2188
+ get: function() {
2189
+ return getActiveOtelContext;
2190
+ }
2948
2191
  });
2949
- Object.defineProperty(exports, 'getOtelMetaFields', {
2950
- enumerable: true,
2951
- get: function () {
2952
- return getOtelMetaFields;
2953
- }
2192
+ Object.defineProperty(exports, "getOtelMetaFields", {
2193
+ enumerable: true,
2194
+ get: function() {
2195
+ return getOtelMetaFields;
2196
+ }
2954
2197
  });
2955
- Object.defineProperty(exports, 'globalPluginRegistry', {
2956
- enumerable: true,
2957
- get: function () {
2958
- return globalPluginRegistry;
2959
- }
2198
+ Object.defineProperty(exports, "globalPluginRegistry", {
2199
+ enumerable: true,
2200
+ get: function() {
2201
+ return globalPluginRegistry;
2202
+ }
2960
2203
  });
2961
- Object.defineProperty(exports, 'initOtelBridge', {
2962
- enumerable: true,
2963
- get: function () {
2964
- return initOtelBridge;
2965
- }
2204
+ Object.defineProperty(exports, "initOtelBridge", {
2205
+ enumerable: true,
2206
+ get: function() {
2207
+ return initOtelBridge;
2208
+ }
2966
2209
  });
2967
- Object.defineProperty(exports, 'isError', {
2968
- enumerable: true,
2969
- get: function () {
2970
- return isError;
2971
- }
2210
+ Object.defineProperty(exports, "isError", {
2211
+ enumerable: true,
2212
+ get: function() {
2213
+ return isError;
2214
+ }
2972
2215
  });
2973
- Object.defineProperty(exports, 'isLogixiaException', {
2974
- enumerable: true,
2975
- get: function () {
2976
- return isLogixiaException;
2977
- }
2216
+ Object.defineProperty(exports, "isLogixiaException", {
2217
+ enumerable: true,
2218
+ get: function() {
2219
+ return isLogixiaException;
2220
+ }
2978
2221
  });
2979
- Object.defineProperty(exports, 'normalizeError', {
2980
- enumerable: true,
2981
- get: function () {
2982
- return normalizeError;
2983
- }
2222
+ Object.defineProperty(exports, "normalizeError", {
2223
+ enumerable: true,
2224
+ get: function() {
2225
+ return normalizeError;
2226
+ }
2984
2227
  });
2985
- Object.defineProperty(exports, 'redactObject', {
2986
- enumerable: true,
2987
- get: function () {
2988
- return redactObject;
2989
- }
2228
+ Object.defineProperty(exports, "redactObject", {
2229
+ enumerable: true,
2230
+ get: function() {
2231
+ return redactObject;
2232
+ }
2990
2233
  });
2991
- Object.defineProperty(exports, 'registerForShutdown', {
2992
- enumerable: true,
2993
- get: function () {
2994
- return registerForShutdown;
2995
- }
2234
+ Object.defineProperty(exports, "registerForShutdown", {
2235
+ enumerable: true,
2236
+ get: function() {
2237
+ return registerForShutdown;
2238
+ }
2996
2239
  });
2997
- Object.defineProperty(exports, 'resetShutdownHandlers', {
2998
- enumerable: true,
2999
- get: function () {
3000
- return resetShutdownHandlers;
3001
- }
2240
+ Object.defineProperty(exports, "resetShutdownHandlers", {
2241
+ enumerable: true,
2242
+ get: function() {
2243
+ return resetShutdownHandlers;
2244
+ }
3002
2245
  });
3003
- Object.defineProperty(exports, 'serializeError', {
3004
- enumerable: true,
3005
- get: function () {
3006
- return serializeError;
3007
- }
2246
+ Object.defineProperty(exports, "serializeError", {
2247
+ enumerable: true,
2248
+ get: function() {
2249
+ return serializeError;
2250
+ }
3008
2251
  });
3009
- Object.defineProperty(exports, 'usePlugin', {
3010
- enumerable: true,
3011
- get: function () {
3012
- return usePlugin;
3013
- }
2252
+ Object.defineProperty(exports, "usePlugin", {
2253
+ enumerable: true,
2254
+ get: function() {
2255
+ return usePlugin;
2256
+ }
3014
2257
  });
3015
- //# sourceMappingURL=nestjs-extras-DnJ6vrIC.js.map
2258
+
2259
+ //# sourceMappingURL=builder-M7NoaugM.js.map