logixia 2.0.0 → 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 (231) hide show
  1. package/README.md +46 -29
  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-Cn_3Usvu.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-D7Da4RAb.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 +45 -25
  23. package/dist/browser.d.mts.map +1 -1
  24. package/dist/browser.d.ts +45 -25
  25. package/dist/browser.d.ts.map +1 -1
  26. package/dist/browser.js +420 -53
  27. package/dist/browser.js.map +1 -1
  28. package/dist/browser.mjs +421 -56
  29. package/dist/browser.mjs.map +1 -1
  30. package/dist/{builder-0gEzRopq.mjs → builder-D70z6kjj.mjs} +212 -104
  31. package/dist/builder-D70z6kjj.mjs.map +1 -0
  32. package/dist/{builder-D44QktIo.js → builder-M7NoaugM.js} +355 -249
  33. package/dist/builder-M7NoaugM.js.map +1 -0
  34. package/dist/cli/index.js +59 -59
  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-DsEq633o.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-UlyZFWMn.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-B7oc97sG.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-GrJurKo8.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-DhIoploR.d.ts → index-DwozbmB4.d.ts} +3 -8
  76. package/dist/index-DwozbmB4.d.ts.map +1 -0
  77. package/dist/{index-3mw5gaCw.d.mts → index-xqaJtAZn.d.mts} +3 -8
  78. package/dist/index-xqaJtAZn.d.mts.map +1 -0
  79. package/dist/index.d.mts +106 -165
  80. package/dist/index.d.mts.map +1 -1
  81. package/dist/index.d.ts +105 -164
  82. package/dist/index.d.ts.map +1 -1
  83. package/dist/index.js +164 -261
  84. package/dist/index.js.map +1 -1
  85. package/dist/index.mjs +147 -243
  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-UVeN-mQm.d.ts → logitron-logger-D2B75Oc7.d.ts} +116 -8
  92. package/dist/logitron-logger-D2B75Oc7.d.ts.map +1 -0
  93. package/dist/{logitron-logger-BFDSO8Io.d.mts → logitron-logger-oEd6wNhf.d.mts} +116 -8
  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 +26 -44
  104. package/dist/nest.d.mts.map +1 -1
  105. package/dist/nest.d.ts +26 -44
  106. package/dist/nest.d.ts.map +1 -1
  107. package/dist/nest.js +116 -132
  108. package/dist/nest.js.map +1 -1
  109. package/dist/nest.mjs +59 -73
  110. package/dist/nest.mjs.map +1 -1
  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-CNh9uVwR.d.ts → search-BH33XhuU.d.mts} +2 -22
  121. package/dist/search-BH33XhuU.d.mts.map +1 -0
  122. package/dist/{search-BFbu_oVn.mjs → search-CWMVYC-R.mjs} +22 -39
  123. package/dist/search-CWMVYC-R.mjs.map +1 -0
  124. package/dist/{search-DXANsQ2n.d.mts → search-CazwyX5Z.d.ts} +2 -22
  125. package/dist/search-CazwyX5Z.d.ts.map +1 -0
  126. package/dist/{search-C4V0OMEn.js → search-DUfWuzFP.js} +52 -69
  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-Bzw7sucI.mjs → slack.transport-Ce96JBDk.mjs} +212 -31
  137. package/dist/slack.transport-Ce96JBDk.mjs.map +1 -0
  138. package/dist/{slack.transport-BfJRouB2.js → slack.transport-Dlx3xvb7.js} +234 -41
  139. package/dist/slack.transport-Dlx3xvb7.js.map +1 -0
  140. package/dist/{slack.transport-BZzoXDPn.d.mts → slack.transport-DrirgDNy.d.ts} +56 -9
  141. package/dist/slack.transport-DrirgDNy.d.ts.map +1 -0
  142. package/dist/{slack.transport-CXjQYOes.d.ts → slack.transport-DxHOXlLu.d.mts} +56 -9
  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-CXbKKdVE.js → transport.manager-DkcEOlqV.js} +164 -160
  153. package/dist/transport.manager-DkcEOlqV.js.map +1 -0
  154. package/dist/{transport.manager-BiuCAJd2.mjs → transport.manager-eZ_EeC00.mjs} +108 -99
  155. package/dist/transport.manager-eZ_EeC00.mjs.map +1 -0
  156. package/dist/{transport.types-CGoHpWQR.d.ts → transport.types-BJVL1QQl.d.mts} +1 -3
  157. package/dist/transport.types-BJVL1QQl.d.mts.map +1 -0
  158. package/dist/{transport.types-BMnurPcc.d.mts → transport.types-BJVL1QQl.d.ts} +1 -3
  159. package/dist/transport.types-BJVL1QQl.d.ts.map +1 -0
  160. package/dist/transports.d.mts +22 -36
  161. package/dist/transports.d.mts.map +1 -1
  162. package/dist/transports.d.ts +22 -36
  163. package/dist/transports.d.ts.map +1 -1
  164. package/dist/transports.js +10 -13
  165. package/dist/transports.mjs +7 -13
  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-CdzSZJmw.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-BdPxu3PN.js → worker.transport-C6GNl_r2.js} +44 -14
  174. package/dist/worker.transport-C6GNl_r2.js.map +1 -0
  175. package/dist/{worker.transport-lPxO2MVL.mjs → worker.transport-DLVA4y2e.mjs} +39 -9
  176. package/dist/worker.transport-DLVA4y2e.mjs.map +1 -0
  177. package/dist/{worker.transport-JvGPog3C.d.mts → worker.transport-hJay1wxA.d.mts} +2 -6
  178. package/dist/worker.transport-hJay1wxA.d.mts.map +1 -0
  179. package/package.json +19 -11
  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-CHnjVRF-.mjs.map +0 -1
  185. package/dist/azure-monitor.transport-Cn_3Usvu.d.ts.map +0 -1
  186. package/dist/azure-monitor.transport-CrvfHd9C.js.map +0 -1
  187. package/dist/azure-monitor.transport-D7Da4RAb.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/builder-0gEzRopq.mjs.map +0 -1
  191. package/dist/builder-D44QktIo.js.map +0 -1
  192. package/dist/chunk-DLSkYcPk.mjs +0 -7
  193. package/dist/chunk-nOFOJqeH.js +0 -30
  194. package/dist/cloudwatch.transport-BO1ahxw-.js.map +0 -1
  195. package/dist/cloudwatch.transport-DZ6ies7g.mjs.map +0 -1
  196. package/dist/cloudwatch.transport-DsEq633o.d.ts.map +0 -1
  197. package/dist/cloudwatch.transport-UlyZFWMn.d.mts.map +0 -1
  198. package/dist/entry-fields-BJkuPnIg.mjs.map +0 -1
  199. package/dist/entry-fields-BvOLFlJ4.js.map +0 -1
  200. package/dist/gcp.transport-B7oc97sG.d.ts.map +0 -1
  201. package/dist/gcp.transport-CHV8MGgz.js.map +0 -1
  202. package/dist/gcp.transport-DBX5TPIy.mjs.map +0 -1
  203. package/dist/gcp.transport-GrJurKo8.d.mts.map +0 -1
  204. package/dist/index-3mw5gaCw.d.mts.map +0 -1
  205. package/dist/index-DhIoploR.d.ts.map +0 -1
  206. package/dist/internal-log-BUJYMZbE.js +0 -70
  207. package/dist/internal-log-BUJYMZbE.js.map +0 -1
  208. package/dist/internal-log-Cm8SOWSV.mjs +0 -52
  209. package/dist/internal-log-Cm8SOWSV.mjs.map +0 -1
  210. package/dist/logitron-logger-BFDSO8Io.d.mts.map +0 -1
  211. package/dist/logitron-logger-UVeN-mQm.d.ts.map +0 -1
  212. package/dist/safe-stringify-DJ66tW5I.mjs.map +0 -1
  213. package/dist/safe-stringify-DWo3aZp_.js.map +0 -1
  214. package/dist/search-BFbu_oVn.mjs.map +0 -1
  215. package/dist/search-C4V0OMEn.js.map +0 -1
  216. package/dist/search-CNh9uVwR.d.ts.map +0 -1
  217. package/dist/search-DXANsQ2n.d.mts.map +0 -1
  218. package/dist/slack.transport-BZzoXDPn.d.mts.map +0 -1
  219. package/dist/slack.transport-BfJRouB2.js.map +0 -1
  220. package/dist/slack.transport-Bzw7sucI.mjs.map +0 -1
  221. package/dist/slack.transport-CXjQYOes.d.ts.map +0 -1
  222. package/dist/trace.utils-CvXgaiQT.mjs.map +0 -1
  223. package/dist/trace.utils-DpBOLDtq.js.map +0 -1
  224. package/dist/transport.manager-BiuCAJd2.mjs.map +0 -1
  225. package/dist/transport.manager-CXbKKdVE.js.map +0 -1
  226. package/dist/transport.types-BMnurPcc.d.mts.map +0 -1
  227. package/dist/transport.types-CGoHpWQR.d.ts.map +0 -1
  228. package/dist/worker.transport-BdPxu3PN.js.map +0 -1
  229. package/dist/worker.transport-CdzSZJmw.d.ts.map +0 -1
  230. package/dist/worker.transport-JvGPog3C.d.mts.map +0 -1
  231. package/dist/worker.transport-lPxO2MVL.mjs.map +0 -1
@@ -0,0 +1,142 @@
1
+ // src/utils/sensitive-names.ts
2
+ /**
3
+ * The one list of sensitive names. Log redaction (redact.utils), the HTTP logger
4
+ * middleware and transport secret handling (transports/secret-config) all read it,
5
+ * so the lists cannot drift. No imports: safe from any module, including browser code.
6
+ */
7
+ /** Field names redacted by name, wherever they appear in logged data. */
8
+ const SENSITIVE_KEY_NAMES = [
9
+ "password",
10
+ "passwd",
11
+ "secret",
12
+ "token",
13
+ "apiKey",
14
+ "api_key",
15
+ "accessToken",
16
+ "access_token",
17
+ "refreshToken",
18
+ "refresh_token",
19
+ "authorization",
20
+ "credentials",
21
+ "privateKey",
22
+ "private_key",
23
+ "clientSecret",
24
+ "client_secret",
25
+ "cookie",
26
+ "set-cookie",
27
+ "x-api-key",
28
+ "session",
29
+ "proxy-authorization",
30
+ "x-auth-token",
31
+ "x-access-token",
32
+ "aws_secret_access_key",
33
+ "awsSecretAccessKey",
34
+ "secretAccessKey"
35
+ ];
36
+ /**
37
+ * Extra names that only mean "secret" inside transport configuration, where
38
+ * short words like `key` or `signature` are credentials, not log fields.
39
+ */
40
+ const TRANSPORT_CONFIG_SECRET_NAMES = [
41
+ "writeKey",
42
+ "apiSecret",
43
+ "connectionString",
44
+ "sessionToken",
45
+ "passphrase",
46
+ "signature",
47
+ "pwd",
48
+ "pfx",
49
+ "cert",
50
+ "key",
51
+ "auth"
52
+ ];
53
+ /** Request headers whose values are never logged. */
54
+ const DEFAULT_REDACT_HEADERS = [
55
+ "authorization",
56
+ "cookie",
57
+ "set-cookie",
58
+ "x-api-key",
59
+ "proxy-authorization",
60
+ "x-auth-token",
61
+ "x-access-token",
62
+ "x-csrf-token",
63
+ "x-amz-security-token"
64
+ ];
65
+ /** Query-string parameters whose values are never logged. */
66
+ const DEFAULT_REDACT_QUERY_PARAMS = [
67
+ "token",
68
+ "access_token",
69
+ "refresh_token",
70
+ "code",
71
+ "password",
72
+ "secret",
73
+ "api_key",
74
+ "apikey",
75
+ "key",
76
+ "signature",
77
+ "sig",
78
+ "auth"
79
+ ];
80
+ // src/utils/internal-log.ts
81
+ /**
82
+ * Internal logging helpers for use within the logixia library itself.
83
+ *
84
+ * These functions write directly to stderr/stdout without going through
85
+ * LogixiaLogger — this avoids circular dependencies and ensures internal
86
+ * diagnostics still surface even when the logger is misconfigured.
87
+ *
88
+ * Library code must NEVER call console.log/warn/error directly. Use these
89
+ * helpers instead so that internal output can be silenced in tests by setting
90
+ * the LOGIXIA_SILENT_INTERNAL=1 environment variable.
91
+ */
92
+ /**
93
+ * Read the silence flag on each call rather than caching it at import time, so
94
+ * setting LOGIXIA_SILENT_INTERNAL=1 AFTER the module is first imported (e.g. in
95
+ * a test setup file) still takes effect — the documented test-silencing
96
+ * behavior was previously unreliable because the value was frozen at load.
97
+ */
98
+ function isSilent() {
99
+ var _process$env;
100
+ if (typeof process !== "undefined" && ((_process$env = process.env) === null || _process$env === void 0 ? void 0 : _process$env.LOGIXIA_SILENT_INTERNAL) === "1") return true;
101
+ const flag = globalThis["LOGIXIA_SILENT_INTERNAL"];
102
+ return flag === "1" || flag === 1 || flag === true;
103
+ }
104
+ /**
105
+ * Write a line to stderr, falling back to the matching console method where
106
+ * `process` is unavailable (browsers, Cloudflare Workers, Deno without Node compat).
107
+ */
108
+ function writeLine(method, line) {
109
+ var _process$stderr;
110
+ if (typeof process !== "undefined" && typeof ((_process$stderr = process.stderr) === null || _process$stderr === void 0 ? void 0 : _process$stderr.write) === "function") process.stderr.write(`${line}\n`);
111
+ else if (typeof console !== "undefined" && typeof console[method] === "function") console[method](line);
112
+ }
113
+ /**
114
+ * Emit an internal debug/info message to stderr.
115
+ * Use for field-enable/disable notifications that a developer might want to see
116
+ * during development but should not appear in production log streams.
117
+ */
118
+ function internalLog(message) {
119
+ if (!isSilent()) writeLine("log", `[logixia] ${message}`);
120
+ }
121
+ /**
122
+ * Emit an internal warning to stderr.
123
+ * Use when something is misconfigured but logixia can continue operating.
124
+ */
125
+ function internalWarn(message) {
126
+ if (!isSilent()) writeLine("warn", `[logixia:warn] ${message}`);
127
+ }
128
+ /**
129
+ * Emit an internal error to stderr.
130
+ * Use when a transport write fails or a serious internal error occurs.
131
+ */
132
+ function internalError(message, error) {
133
+ if (!isSilent()) {
134
+ let errStr = "";
135
+ if (error instanceof Error) errStr = ` — ${error.message}`;
136
+ else if (error != null) errStr = ` — ${String(error)}`;
137
+ writeLine("error", `[logixia:error] ${message}${errStr}`);
138
+ }
139
+ }
140
+ export { DEFAULT_REDACT_QUERY_PARAMS as a, DEFAULT_REDACT_HEADERS as i, internalLog as n, SENSITIVE_KEY_NAMES as o, internalWarn as r, TRANSPORT_CONFIG_SECRET_NAMES as s, internalError as t };
141
+
142
+ //# sourceMappingURL=internal-log-uCSd1PMc.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internal-log-uCSd1PMc.mjs","names":[],"sources":["../src/utils/sensitive-names.ts","../src/utils/internal-log.ts"],"sourcesContent":["/**\n * The one list of sensitive names. Log redaction (redact.utils), the HTTP logger\n * middleware and transport secret handling (transports/secret-config) all read it,\n * so the lists cannot drift. No imports: safe from any module, including browser code.\n */\n\n/** Field names redacted by name, wherever they appear in logged data. */\nexport const SENSITIVE_KEY_NAMES: readonly string[] = [\n 'password',\n 'passwd',\n 'secret',\n 'token',\n 'apiKey',\n 'api_key',\n 'accessToken',\n 'access_token',\n 'refreshToken',\n 'refresh_token',\n 'authorization',\n 'credentials',\n 'privateKey',\n 'private_key',\n 'clientSecret',\n 'client_secret',\n 'cookie',\n 'set-cookie',\n 'x-api-key',\n 'session',\n 'proxy-authorization',\n 'x-auth-token',\n 'x-access-token',\n 'aws_secret_access_key',\n 'awsSecretAccessKey',\n 'secretAccessKey',\n];\n\n/**\n * Extra names that only mean \"secret\" inside transport configuration, where\n * short words like `key` or `signature` are credentials, not log fields.\n */\nexport const TRANSPORT_CONFIG_SECRET_NAMES: readonly string[] = [\n 'writeKey',\n 'apiSecret',\n 'connectionString',\n 'sessionToken',\n 'passphrase',\n 'signature',\n 'pwd',\n 'pfx',\n 'cert',\n 'key',\n 'auth',\n];\n\n/** Request headers whose values are never logged. */\nexport const DEFAULT_REDACT_HEADERS: readonly string[] = [\n 'authorization',\n 'cookie',\n 'set-cookie',\n 'x-api-key',\n 'proxy-authorization',\n 'x-auth-token',\n 'x-access-token',\n 'x-csrf-token',\n 'x-amz-security-token',\n];\n\n/** Query-string parameters whose values are never logged. */\nexport const DEFAULT_REDACT_QUERY_PARAMS: readonly string[] = [\n 'token',\n 'access_token',\n 'refresh_token',\n 'code',\n 'password',\n 'secret',\n 'api_key',\n 'apikey',\n 'key',\n 'signature',\n 'sig',\n 'auth',\n];\n","/**\n * Internal logging helpers for use within the logixia library itself.\n *\n * These functions write directly to stderr/stdout without going through\n * LogixiaLogger — this avoids circular dependencies and ensures internal\n * diagnostics still surface even when the logger is misconfigured.\n *\n * Library code must NEVER call console.log/warn/error directly. Use these\n * helpers instead so that internal output can be silenced in tests by setting\n * the LOGIXIA_SILENT_INTERNAL=1 environment variable.\n */\n\n/**\n * Read the silence flag on each call rather than caching it at import time, so\n * setting LOGIXIA_SILENT_INTERNAL=1 AFTER the module is first imported (e.g. in\n * a test setup file) still takes effect — the documented test-silencing\n * behavior was previously unreliable because the value was frozen at load.\n */\nfunction isSilent(): boolean {\n if (typeof process !== 'undefined' && process.env?.LOGIXIA_SILENT_INTERNAL === '1') return true;\n const flag = (globalThis as Record<string, unknown>)['LOGIXIA_SILENT_INTERNAL'];\n return flag === '1' || flag === 1 || flag === true;\n}\n\ntype ConsoleMethod = 'log' | 'warn' | 'error';\n\n/**\n * Write a line to stderr, falling back to the matching console method where\n * `process` is unavailable (browsers, Cloudflare Workers, Deno without Node compat).\n */\nfunction writeLine(method: ConsoleMethod, line: string): void {\n if (typeof process !== 'undefined' && typeof process.stderr?.write === 'function') {\n process.stderr.write(`${line}\\n`);\n } else if (typeof console !== 'undefined' && typeof console[method] === 'function') {\n console[method](line);\n }\n}\n\n/**\n * Emit an internal debug/info message to stderr.\n * Use for field-enable/disable notifications that a developer might want to see\n * during development but should not appear in production log streams.\n */\nexport function internalLog(message: string): void {\n if (!isSilent()) {\n writeLine('log', `[logixia] ${message}`);\n }\n}\n\n/**\n * Emit an internal warning to stderr.\n * Use when something is misconfigured but logixia can continue operating.\n */\nexport function internalWarn(message: string): void {\n if (!isSilent()) {\n writeLine('warn', `[logixia:warn] ${message}`);\n }\n}\n\n/**\n * Emit an internal error to stderr.\n * Use when a transport write fails or a serious internal error occurs.\n */\nexport function internalError(message: string, error?: unknown): void {\n if (!isSilent()) {\n let errStr = '';\n if (error instanceof Error) {\n errStr = ` — ${error.message}`;\n } else if (error != null) {\n errStr = ` — ${String(error)}`;\n }\n writeLine('error', `[logixia:error] ${message}${errStr}`);\n }\n}\n"],"mappings":";;;;;;;AAOA,MAAa,sBAAyC;CACpD;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;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F"}
@@ -1,7 +1,4 @@
1
- import { b as LoggerWithLevels, f as ILogger, h as LogEntry, p as ILoggerDefault, v as LogLevelString, x as NamespaceLevels, y as LoggerConfig } from "./index-DhIoploR.js";
2
-
3
- //#region src/plugin.d.ts
4
-
1
+ import { b as LoggerWithLevels, f as ILogger, h as LogEntry, p as ILoggerDefault, v as LogLevelString, x as NamespaceLevels, y as LoggerConfig } from "./index-DwozbmB4.js";
5
2
  interface LogixiaPlugin {
6
3
  /**
7
4
  * Unique plugin name.
@@ -98,8 +95,19 @@ declare const globalPluginRegistry: PluginRegistry;
98
95
  * ```
99
96
  */
100
97
  declare function usePlugin(plugin: LogixiaPlugin): void;
101
- //#endregion
102
- //#region src/core/logitron-logger.d.ts
98
+ /**
99
+ * The logixia logger. Create instances with {@link createLogger} so that custom
100
+ * levels from `levelOptions.levels` also become methods.
101
+ *
102
+ * @example
103
+ * ```ts
104
+ * const logger = createLogger({ appName: 'api', environment: 'production' });
105
+ * await logger.info('Server started', { port: 3000 });
106
+ * const req = logger.child('RequestHandler', { requestId: 'r-1' });
107
+ * await req.error(new Error('boom'));
108
+ * await logger.close(); // flush buffered transports before exit
109
+ * ```
110
+ */
103
111
  declare class LogixiaLogger<TConfig extends LoggerConfig<Record<string, number>> = LoggerConfig> implements ILoggerDefault {
104
112
  [K: string]: any;
105
113
  private config;
@@ -114,6 +122,8 @@ declare class LogixiaLogger<TConfig extends LoggerConfig<Record<string, number>>
114
122
  private _levelValues;
115
123
  /** Numeric threshold for the currently active log level. */
116
124
  private _minLevelValue;
125
+ /** Level set via setLevel(); outranks every other level source until the process ends. */
126
+ private _runtimeLevel;
117
127
  /** `source=value` pairs already reported as unknown levels — warn once per logger. */
118
128
  private readonly _warnedInvalidLevels;
119
129
  /** Pre-built ANSI color codes to avoid recreating the object in colorize(). */
@@ -145,17 +155,61 @@ declare class LogixiaLogger<TConfig extends LoggerConfig<Record<string, number>>
145
155
  * Keeps the actual log() call free of allocations in the common case.
146
156
  */
147
157
  private _buildPerfCaches;
158
+ /**
159
+ * Log at `error` level. An `Error` is logged with its message and serialized
160
+ * (name, message, stack) under `data.error`; a string is logged as-is.
161
+ * `data` is merged into the entry payload.
162
+ */
148
163
  error(messageOrError: string | Error, data?: Record<string, unknown>): Promise<void>;
164
+ /** Log `message` at `warn` level; `data` is merged into the entry payload. */
149
165
  warn(message: string, data?: Record<string, unknown>): Promise<void>;
166
+ /** Log `message` at `info` level; `data` is merged into the entry payload. */
150
167
  info(message: string, data?: Record<string, unknown>): Promise<void>;
168
+ /** Log `message` at `debug` level; `data` is merged into the entry payload. */
151
169
  debug(message: string, data?: Record<string, unknown>): Promise<void>;
170
+ /** Log `message` at `trace` level; `data` is merged into the entry payload. */
152
171
  trace(message: string, data?: Record<string, unknown>): Promise<void>;
172
+ /** Log `message` at `verbose` level; `data` is merged into the entry payload. */
153
173
  verbose(message: string, data?: Record<string, unknown>): Promise<void>;
174
+ /**
175
+ * Log at an arbitrary level name, including custom levels. Levels below the
176
+ * active threshold are dropped, as are level names that are not registered
177
+ * in `levelOptions.levels` (and are not built-in).
178
+ */
154
179
  logLevel(level: string, message: string, data?: Record<string, unknown>): Promise<void>;
180
+ /** Start a named timer; finish it with {@link timeEnd}. Reusing a label restarts it. */
155
181
  time(label: string): void;
182
+ /**
183
+ * Stop the timer `label`, log its duration at `info` level, and return the
184
+ * elapsed milliseconds. Logs a `warn` and returns `undefined` if the timer
185
+ * does not exist.
186
+ *
187
+ * @example
188
+ * ```ts
189
+ * logger.time('db');
190
+ * await query();
191
+ * const ms = await logger.timeEnd('db');
192
+ * ```
193
+ */
156
194
  timeEnd(label: string): Promise<number | undefined>;
157
195
  timeAsync<T>(label: string, fn: () => Promise<T>): Promise<T>;
196
+ /**
197
+ * Change the minimum log level at runtime. The override outranks
198
+ * `LOGIXIA_LEVEL`, `LOGIXIA_LEVEL_<NS>` and `namespaceLevels`, and survives
199
+ * later changes to fields or namespace levels. Unknown level names are
200
+ * ignored with a warning and the current level is kept.
201
+ *
202
+ * @example
203
+ * ```ts
204
+ * logger.setLevel('debug');
205
+ * ```
206
+ */
158
207
  setLevel(level: LogLevelString): void;
208
+ /**
209
+ * Return the configured minimum log level, not the per-namespace effective
210
+ * one. Without `setLevel()` it is `LOGIXIA_LEVEL`, else `levelOptions.level`,
211
+ * else a `NODE_ENV` default (`debug` in development, `warn` in test), else `info`.
212
+ */
159
213
  getLevel(): LogLevelString;
160
214
  private _validLevelList;
161
215
  /**
@@ -182,21 +236,43 @@ declare class LogixiaLogger<TConfig extends LoggerConfig<Record<string, number>>
182
236
  patchNamespaceLevels(levels: NamespaceLevels): void;
183
237
  /** Return a copy of the current per-namespace level map. */
184
238
  getNamespaceLevels(): NamespaceLevels;
239
+ /** Set the context label (e.g. a class or module name) attached to every subsequent entry. */
185
240
  setContext(context: string): void;
241
+ /** Return the current context label, or `undefined` if none is set. */
186
242
  getContext(): string | undefined;
243
+ /** Show `fieldName` in log output, overriding the config for this logger instance. */
187
244
  enableField(fieldName: string): void;
245
+ /** Hide `fieldName` from log output, overriding the config for this logger instance. */
188
246
  disableField(fieldName: string): void;
247
+ /** Whether `fieldName` is currently shown: runtime override first, then config, default `true`. */
189
248
  isFieldEnabled(fieldName: string): boolean;
249
+ /** Return the visibility (`true` = shown) of every standard log field. */
190
250
  getFieldState(): Record<string, boolean>;
251
+ /** Drop all runtime enable/disable overrides so field visibility follows the config again. */
191
252
  resetFieldState(): void;
192
253
  /** @deprecated No-op. Library code never prompts on stdin; use setTransportLevels(). */
193
254
  enableTransportLevelPrompting(): void;
194
255
  /** @deprecated No-op. */
195
256
  disableTransportLevelPrompting(): void;
257
+ /** Restrict `transportId` to only the given `levels`. Warns if no transports are configured. */
196
258
  setTransportLevels(transportId: string, levels: string[]): void;
259
+ /** Return the levels `transportId` is restricted to, or `undefined` if it has none. */
197
260
  getTransportLevels(transportId: string): string[] | undefined;
198
261
  clearTransportLevelPreferences(): void;
262
+ /** Return the identifiers of the configured transports (empty if none). */
199
263
  getAvailableTransports(): string[];
264
+ /**
265
+ * Create a child logger with its own `context` that shares this logger's
266
+ * configuration and transports. `data` is merged into the bound fields
267
+ * inherited from this logger and added to every entry the child writes.
268
+ * Closing a child does not close the shared transports.
269
+ *
270
+ * @example
271
+ * ```ts
272
+ * const req = logger.child('Checkout', { requestId: 'r-42' });
273
+ * await req.info('started'); // entry includes requestId
274
+ * ```
275
+ */
200
276
  child(context: string, data?: Record<string, unknown>): ILogger;
201
277
  /**
202
278
  * Register a plugin on this logger instance.
@@ -215,11 +291,27 @@ declare class LogixiaLogger<TConfig extends LoggerConfig<Record<string, number>>
215
291
  * No-op if the plugin is not registered on this instance.
216
292
  */
217
293
  unuse(pluginName: string): this;
294
+ /** Flush buffered entries in all transports without closing them. */
218
295
  flush(): Promise<void>;
296
+ /** Report whether the transports are healthy; `healthy: false` if no transport manager exists. */
219
297
  healthCheck(): Promise<{
220
298
  healthy: boolean;
221
299
  details: Record<string, unknown>;
222
300
  }>;
301
+ /**
302
+ * Warn about timers that were never ended, then flush and close all transports,
303
+ * stop the sampler and run plugin shutdown hooks. On a child logger only the
304
+ * timer warnings run; the shared transports stay open.
305
+ *
306
+ * To flush on SIGTERM/SIGINT, set the `gracefulShutdown` config option rather
307
+ * than writing your own signal handler; do not combine it with a manual
308
+ * handler that calls `process.exit`, which can cut the flush short.
309
+ *
310
+ * @example
311
+ * ```ts
312
+ * await logger.close(); // e.g. at the end of a script or a test
313
+ * ```
314
+ */
223
315
  close(): Promise<void>;
224
316
  private log;
225
317
  /**
@@ -231,6 +323,7 @@ declare class LogixiaLogger<TConfig extends LoggerConfig<Record<string, number>>
231
323
  * Feature 3: Resolve the effective log level for this logger instance.
232
324
  *
233
325
  * Priority:
326
+ * 0. A level set at runtime with `setLevel()` (explicit programmatic call, wins over all below)
234
327
  * 1. ENV `LOGIXIA_LEVEL_<NS_UPPER>` (e.g. LOGIXIA_LEVEL_DB for ns "db" or "db.queries")
235
328
  * 2. Matching `namespaceLevels` config entry (longer pattern = more specific, wins)
236
329
  * 3. Global `LOGIXIA_LEVEL` ENV override
@@ -251,7 +344,22 @@ declare class LogixiaLogger<TConfig extends LoggerConfig<Record<string, number>>
251
344
  * back to a direct stdout/stderr write so the entry is never lost. */
252
345
  private _handleOutputError;
253
346
  }
347
+ /**
348
+ * Create a logger from `config`, with an optional default `context` label.
349
+ *
350
+ * Every key of `levelOptions.levels` that is not already a method becomes an
351
+ * async method on the returned logger, typed through the config, and routes to
352
+ * {@link LogixiaLogger.logLevel}.
353
+ *
354
+ * @example
355
+ * ```ts
356
+ * const logger = createLogger({
357
+ * appName: 'api',
358
+ * levelOptions: { level: 'info', levels: { error: 0, warn: 1, info: 2, audit: 2 } },
359
+ * });
360
+ * await logger.audit('user exported data', { userId: 'u1' });
361
+ * ```
362
+ */
254
363
  declare function createLogger<T extends LoggerConfig<Record<string, number>>>(config: T, context?: string): LoggerWithLevels<T>;
255
- //#endregion
256
364
  export { globalPluginRegistry as a, PluginRegistry as i, createLogger as n, usePlugin as o, LogixiaPlugin as r, LogixiaLogger as t };
257
- //# sourceMappingURL=logitron-logger-UVeN-mQm.d.ts.map
365
+ //# sourceMappingURL=logitron-logger-D2B75Oc7.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logitron-logger-D2B75Oc7.d.ts","names":[],"sources":["../src/plugin.ts","../src/core/logitron-logger.ts"],"mappings":";UAkCiB;;;;;;EAMf;;;;;;EAOA,kBAAkB;;;;;;;;;;;;EAalB,OAAO,OAAO,WAAW,kBAAkB,QAAQ;;;;;;EAOnD,SAAS,OAAO,OAAO,QAAQ,kBAAkB;;;;;;EAOjD,sBAAsB;;;;;;;cAUX;mBACM;;;;;EAMjB,SAAS,QAAQ;;EAiBjB,WAAW;;EAMX,IAAI;;MAKA;;;;;;EASE,SAAS,OAAO,WAAW,QAAQ;;;;;EAsBnC,WAAW,OAAO,OAAO,QAAQ,WAAW;;EAiB5C,iBAAiB;;;;;;;;;cA2BZ,sBAAoB;;;;;;;;;;;;;;;;;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;;;;UAcA;;;UAuBM;;;;;;;;;;;;;;;;;;iBA+BA,aAAa,UAAU,aAAa,yBAClD,QAAQ,GACR,mBACC,iBAAiB"}
@@ -1,7 +1,4 @@
1
- import { b as LoggerWithLevels, f as ILogger, h as LogEntry, p as ILoggerDefault, v as LogLevelString, x as NamespaceLevels, y as LoggerConfig } from "./index-3mw5gaCw.mjs";
2
-
3
- //#region src/plugin.d.ts
4
-
1
+ import { b as LoggerWithLevels, f as ILogger, h as LogEntry, p as ILoggerDefault, v as LogLevelString, x as NamespaceLevels, y as LoggerConfig } from "./index-xqaJtAZn.mjs";
5
2
  interface LogixiaPlugin {
6
3
  /**
7
4
  * Unique plugin name.
@@ -98,8 +95,19 @@ declare const globalPluginRegistry: PluginRegistry;
98
95
  * ```
99
96
  */
100
97
  declare function usePlugin(plugin: LogixiaPlugin): void;
101
- //#endregion
102
- //#region src/core/logitron-logger.d.ts
98
+ /**
99
+ * The logixia logger. Create instances with {@link createLogger} so that custom
100
+ * levels from `levelOptions.levels` also become methods.
101
+ *
102
+ * @example
103
+ * ```ts
104
+ * const logger = createLogger({ appName: 'api', environment: 'production' });
105
+ * await logger.info('Server started', { port: 3000 });
106
+ * const req = logger.child('RequestHandler', { requestId: 'r-1' });
107
+ * await req.error(new Error('boom'));
108
+ * await logger.close(); // flush buffered transports before exit
109
+ * ```
110
+ */
103
111
  declare class LogixiaLogger<TConfig extends LoggerConfig<Record<string, number>> = LoggerConfig> implements ILoggerDefault {
104
112
  [K: string]: any;
105
113
  private config;
@@ -114,6 +122,8 @@ declare class LogixiaLogger<TConfig extends LoggerConfig<Record<string, number>>
114
122
  private _levelValues;
115
123
  /** Numeric threshold for the currently active log level. */
116
124
  private _minLevelValue;
125
+ /** Level set via setLevel(); outranks every other level source until the process ends. */
126
+ private _runtimeLevel;
117
127
  /** `source=value` pairs already reported as unknown levels — warn once per logger. */
118
128
  private readonly _warnedInvalidLevels;
119
129
  /** Pre-built ANSI color codes to avoid recreating the object in colorize(). */
@@ -145,17 +155,61 @@ declare class LogixiaLogger<TConfig extends LoggerConfig<Record<string, number>>
145
155
  * Keeps the actual log() call free of allocations in the common case.
146
156
  */
147
157
  private _buildPerfCaches;
158
+ /**
159
+ * Log at `error` level. An `Error` is logged with its message and serialized
160
+ * (name, message, stack) under `data.error`; a string is logged as-is.
161
+ * `data` is merged into the entry payload.
162
+ */
148
163
  error(messageOrError: string | Error, data?: Record<string, unknown>): Promise<void>;
164
+ /** Log `message` at `warn` level; `data` is merged into the entry payload. */
149
165
  warn(message: string, data?: Record<string, unknown>): Promise<void>;
166
+ /** Log `message` at `info` level; `data` is merged into the entry payload. */
150
167
  info(message: string, data?: Record<string, unknown>): Promise<void>;
168
+ /** Log `message` at `debug` level; `data` is merged into the entry payload. */
151
169
  debug(message: string, data?: Record<string, unknown>): Promise<void>;
170
+ /** Log `message` at `trace` level; `data` is merged into the entry payload. */
152
171
  trace(message: string, data?: Record<string, unknown>): Promise<void>;
172
+ /** Log `message` at `verbose` level; `data` is merged into the entry payload. */
153
173
  verbose(message: string, data?: Record<string, unknown>): Promise<void>;
174
+ /**
175
+ * Log at an arbitrary level name, including custom levels. Levels below the
176
+ * active threshold are dropped, as are level names that are not registered
177
+ * in `levelOptions.levels` (and are not built-in).
178
+ */
154
179
  logLevel(level: string, message: string, data?: Record<string, unknown>): Promise<void>;
180
+ /** Start a named timer; finish it with {@link timeEnd}. Reusing a label restarts it. */
155
181
  time(label: string): void;
182
+ /**
183
+ * Stop the timer `label`, log its duration at `info` level, and return the
184
+ * elapsed milliseconds. Logs a `warn` and returns `undefined` if the timer
185
+ * does not exist.
186
+ *
187
+ * @example
188
+ * ```ts
189
+ * logger.time('db');
190
+ * await query();
191
+ * const ms = await logger.timeEnd('db');
192
+ * ```
193
+ */
156
194
  timeEnd(label: string): Promise<number | undefined>;
157
195
  timeAsync<T>(label: string, fn: () => Promise<T>): Promise<T>;
196
+ /**
197
+ * Change the minimum log level at runtime. The override outranks
198
+ * `LOGIXIA_LEVEL`, `LOGIXIA_LEVEL_<NS>` and `namespaceLevels`, and survives
199
+ * later changes to fields or namespace levels. Unknown level names are
200
+ * ignored with a warning and the current level is kept.
201
+ *
202
+ * @example
203
+ * ```ts
204
+ * logger.setLevel('debug');
205
+ * ```
206
+ */
158
207
  setLevel(level: LogLevelString): void;
208
+ /**
209
+ * Return the configured minimum log level, not the per-namespace effective
210
+ * one. Without `setLevel()` it is `LOGIXIA_LEVEL`, else `levelOptions.level`,
211
+ * else a `NODE_ENV` default (`debug` in development, `warn` in test), else `info`.
212
+ */
159
213
  getLevel(): LogLevelString;
160
214
  private _validLevelList;
161
215
  /**
@@ -182,21 +236,43 @@ declare class LogixiaLogger<TConfig extends LoggerConfig<Record<string, number>>
182
236
  patchNamespaceLevels(levels: NamespaceLevels): void;
183
237
  /** Return a copy of the current per-namespace level map. */
184
238
  getNamespaceLevels(): NamespaceLevels;
239
+ /** Set the context label (e.g. a class or module name) attached to every subsequent entry. */
185
240
  setContext(context: string): void;
241
+ /** Return the current context label, or `undefined` if none is set. */
186
242
  getContext(): string | undefined;
243
+ /** Show `fieldName` in log output, overriding the config for this logger instance. */
187
244
  enableField(fieldName: string): void;
245
+ /** Hide `fieldName` from log output, overriding the config for this logger instance. */
188
246
  disableField(fieldName: string): void;
247
+ /** Whether `fieldName` is currently shown: runtime override first, then config, default `true`. */
189
248
  isFieldEnabled(fieldName: string): boolean;
249
+ /** Return the visibility (`true` = shown) of every standard log field. */
190
250
  getFieldState(): Record<string, boolean>;
251
+ /** Drop all runtime enable/disable overrides so field visibility follows the config again. */
191
252
  resetFieldState(): void;
192
253
  /** @deprecated No-op. Library code never prompts on stdin; use setTransportLevels(). */
193
254
  enableTransportLevelPrompting(): void;
194
255
  /** @deprecated No-op. */
195
256
  disableTransportLevelPrompting(): void;
257
+ /** Restrict `transportId` to only the given `levels`. Warns if no transports are configured. */
196
258
  setTransportLevels(transportId: string, levels: string[]): void;
259
+ /** Return the levels `transportId` is restricted to, or `undefined` if it has none. */
197
260
  getTransportLevels(transportId: string): string[] | undefined;
198
261
  clearTransportLevelPreferences(): void;
262
+ /** Return the identifiers of the configured transports (empty if none). */
199
263
  getAvailableTransports(): string[];
264
+ /**
265
+ * Create a child logger with its own `context` that shares this logger's
266
+ * configuration and transports. `data` is merged into the bound fields
267
+ * inherited from this logger and added to every entry the child writes.
268
+ * Closing a child does not close the shared transports.
269
+ *
270
+ * @example
271
+ * ```ts
272
+ * const req = logger.child('Checkout', { requestId: 'r-42' });
273
+ * await req.info('started'); // entry includes requestId
274
+ * ```
275
+ */
200
276
  child(context: string, data?: Record<string, unknown>): ILogger;
201
277
  /**
202
278
  * Register a plugin on this logger instance.
@@ -215,11 +291,27 @@ declare class LogixiaLogger<TConfig extends LoggerConfig<Record<string, number>>
215
291
  * No-op if the plugin is not registered on this instance.
216
292
  */
217
293
  unuse(pluginName: string): this;
294
+ /** Flush buffered entries in all transports without closing them. */
218
295
  flush(): Promise<void>;
296
+ /** Report whether the transports are healthy; `healthy: false` if no transport manager exists. */
219
297
  healthCheck(): Promise<{
220
298
  healthy: boolean;
221
299
  details: Record<string, unknown>;
222
300
  }>;
301
+ /**
302
+ * Warn about timers that were never ended, then flush and close all transports,
303
+ * stop the sampler and run plugin shutdown hooks. On a child logger only the
304
+ * timer warnings run; the shared transports stay open.
305
+ *
306
+ * To flush on SIGTERM/SIGINT, set the `gracefulShutdown` config option rather
307
+ * than writing your own signal handler; do not combine it with a manual
308
+ * handler that calls `process.exit`, which can cut the flush short.
309
+ *
310
+ * @example
311
+ * ```ts
312
+ * await logger.close(); // e.g. at the end of a script or a test
313
+ * ```
314
+ */
223
315
  close(): Promise<void>;
224
316
  private log;
225
317
  /**
@@ -231,6 +323,7 @@ declare class LogixiaLogger<TConfig extends LoggerConfig<Record<string, number>>
231
323
  * Feature 3: Resolve the effective log level for this logger instance.
232
324
  *
233
325
  * Priority:
326
+ * 0. A level set at runtime with `setLevel()` (explicit programmatic call, wins over all below)
234
327
  * 1. ENV `LOGIXIA_LEVEL_<NS_UPPER>` (e.g. LOGIXIA_LEVEL_DB for ns "db" or "db.queries")
235
328
  * 2. Matching `namespaceLevels` config entry (longer pattern = more specific, wins)
236
329
  * 3. Global `LOGIXIA_LEVEL` ENV override
@@ -251,7 +344,22 @@ declare class LogixiaLogger<TConfig extends LoggerConfig<Record<string, number>>
251
344
  * back to a direct stdout/stderr write so the entry is never lost. */
252
345
  private _handleOutputError;
253
346
  }
347
+ /**
348
+ * Create a logger from `config`, with an optional default `context` label.
349
+ *
350
+ * Every key of `levelOptions.levels` that is not already a method becomes an
351
+ * async method on the returned logger, typed through the config, and routes to
352
+ * {@link LogixiaLogger.logLevel}.
353
+ *
354
+ * @example
355
+ * ```ts
356
+ * const logger = createLogger({
357
+ * appName: 'api',
358
+ * levelOptions: { level: 'info', levels: { error: 0, warn: 1, info: 2, audit: 2 } },
359
+ * });
360
+ * await logger.audit('user exported data', { userId: 'u1' });
361
+ * ```
362
+ */
254
363
  declare function createLogger<T extends LoggerConfig<Record<string, number>>>(config: T, context?: string): LoggerWithLevels<T>;
255
- //#endregion
256
364
  export { globalPluginRegistry as a, PluginRegistry as i, createLogger as n, usePlugin as o, LogixiaPlugin as r, LogixiaLogger as t };
257
- //# sourceMappingURL=logitron-logger-BFDSO8Io.d.mts.map
365
+ //# sourceMappingURL=logitron-logger-oEd6wNhf.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logitron-logger-oEd6wNhf.d.mts","names":[],"sources":["../src/plugin.ts","../src/core/logitron-logger.ts"],"mappings":";UAkCiB;;;;;;EAMf;;;;;;EAOA,kBAAkB;;;;;;;;;;;;EAalB,OAAO,OAAO,WAAW,kBAAkB,QAAQ;;;;;;EAOnD,SAAS,OAAO,OAAO,QAAQ,kBAAkB;;;;;;EAOjD,sBAAsB;;;;;;;cAUX;mBACM;;;;;EAMjB,SAAS,QAAQ;;EAiBjB,WAAW;;EAMX,IAAI;;MAKA;;;;;;EASE,SAAS,OAAO,WAAW,QAAQ;;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IAAU;IAAkB,SAAS;;;;;;;;;;;;;;;;EAqBpD,SAAS;UAsBD;;;;;UA0GN;;;;;;;;;;;UAeA;UAwCA;UAgDA;;;;;;;;UAcA;;;UAuBM;;;;;;;;;;;;;;;;;;iBA+BA,aAAa,UAAU,aAAa,yBAClD,QAAQ,GACR,mBACC,iBAAiB"}
@@ -1,8 +1,4 @@
1
- import "./transport.types-BMnurPcc.mjs";
2
- import { u as IBaseLogger } from "./index-3mw5gaCw.mjs";
3
-
4
- //#region src/middleware/http-logger.d.ts
5
-
1
+ import { u as IBaseLogger } from "./index-xqaJtAZn.mjs";
6
2
  interface HttpLoggerOptions {
7
3
  /**
8
4
  * Skip logging for a request. Called before any I/O.
@@ -28,10 +24,13 @@ interface HttpLoggerOptions {
28
24
  */
29
25
  extraFields?: (req: IncomingRequest) => Record<string, unknown>;
30
26
  /**
31
- * Trace ID header. Default: 'x-trace-id'.
32
- * If the header is absent, a short random ID is generated.
27
+ * Header name, or list of names tried in order, to read the trace ID from.
28
+ * Default: the library-wide list (`DEFAULT_TRACE_HEADERS`: traceparent,
29
+ * x-trace-id, x-request-id, x-correlation-id, trace-id).
30
+ * If none is present, `request.id` is used when it is not a framework counter,
31
+ * otherwise a UUID is generated and shared with the logixia context helpers.
33
32
  */
34
- traceIdHeader?: string;
33
+ traceIdHeader?: string | readonly string[];
35
34
  /**
36
35
  * Additional headers to redact from logged output. Merged with the defaults
37
36
  * (authorization, cookie, set-cookie, x-api-key, proxy-authorization,
@@ -73,7 +72,7 @@ interface OutgoingResponse {
73
72
  /**
74
73
  * Create an Express / Connect compatible middleware that replaces Morgan.
75
74
  */
76
- declare function createExpressMiddleware(logger: IBaseLogger, options?: HttpLoggerOptions): (req: IncomingRequest, res: OutgoingResponse, next: () => void) => void;
75
+ export declare function createExpressMiddleware(logger: IBaseLogger, options?: HttpLoggerOptions): (req: IncomingRequest, res: OutgoingResponse, next: () => void) => void;
77
76
  interface FastifyInstance {
78
77
  addHook: (name: string, fn: (req: unknown, reply: unknown, done: () => void) => void) => void;
79
78
  }
@@ -85,9 +84,8 @@ interface FastifyInstance {
85
84
  * await fastify.register(createFastifyPlugin(logger, { slowRequestThresholdMs: 500 }));
86
85
  * ```
87
86
  */
88
- declare function createFastifyPlugin(logger: IBaseLogger, options?: HttpLoggerOptions): ((fastify: FastifyInstance, _opts: unknown, done: () => void) => void) & {
87
+ export declare function createFastifyPlugin(logger: IBaseLogger, options?: HttpLoggerOptions): ((fastify: FastifyInstance, _opts: unknown, done: () => void) => void) & {
89
88
  [x: symbol]: string | boolean;
90
89
  };
91
- //#endregion
92
- export { type FastifyInstance, type HttpLoggerOptions, type IncomingRequest, type OutgoingResponse, createExpressMiddleware, createFastifyPlugin };
90
+ export type { FastifyInstance, HttpLoggerOptions, IncomingRequest, OutgoingResponse };
93
91
  //# sourceMappingURL=middleware.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"middleware.d.mts","names":[],"sources":["../src/middleware/http-logger.ts"],"sourcesContent":[],"mappings":";;;;;UA+BiB,iBAAA;;;;;eAKF;;;;;;;;;;;;;;;;;;sBAkBO,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;UA8BzB,eAAA;;;YAGL;;;;;;;UAMK,gBAAA;;;;;;;;;iBAsID,uBAAA,SACN,uBACC,0BACF,sBAAsB;UAqFd,eAAA;;;;;;;;;;;iBAYD,mBAAA,SAA4B,uBAAsB,+BAYzB"}
1
+ {"version":3,"file":"middleware.d.mts","names":[],"sources":["../src/middleware/http-logger.ts"],"mappings":";UAgCiB;;;;;EAKf,QAAQ,KAAK;;;;;;EAMb;;EAEA;;;;;EAKA;;;;;EAKA,eAAe,KAAK,oBAAoB;;;;;;;;EAQxC;;;;;;EAMA;;;;;;EAMA;;;;;EAKA;;EAEA;;EAEA;;UAIe;EACf;EACA;EACA,UAAU;EACV;EACA;IAAW;;EACX;;UAGe;EACf;EACA,MAAM,eAAe;EACrB,QAAQ,eAAe;EACvB,aAAa;;;;;wBAkGC,wBACd,QAAQ,aACR,UAAS,qBACP,KAAK,iBAAiB,KAAK,kBAAkB;UAqFhC;EACf,UAAU,cAAc,KAAK,cAAc,gBAAgB;;;;;;;;;;wBAW7C,oBAAoB,QAAQ,aAAa,UAAS,sBAAsB,SAY/C,iBAAe,gBAAgB"}