logixia 2.0.0 → 2.0.6

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 (239) hide show
  1. package/README.md +172 -2597
  2. package/dist/async-context-2mbUKhcl.mjs +132 -0
  3. package/dist/async-context-2mbUKhcl.mjs.map +1 -0
  4. package/dist/async-context-DUFMDYAr.js +148 -0
  5. package/dist/async-context-DUFMDYAr.js.map +1 -0
  6. package/dist/{azure-monitor.transport-CrvfHd9C.js → azure-monitor.transport-Bu4S2I2q.js} +32 -20
  7. package/dist/azure-monitor.transport-Bu4S2I2q.js.map +1 -0
  8. package/dist/{azure-monitor.transport-Cn_3Usvu.d.ts → azure-monitor.transport-Bvf7Xegt.d.ts} +3 -6
  9. package/dist/azure-monitor.transport-Bvf7Xegt.d.ts.map +1 -0
  10. package/dist/{azure-monitor.transport-CHnjVRF-.mjs → azure-monitor.transport-C1RWAumT.mjs} +27 -15
  11. package/dist/azure-monitor.transport-C1RWAumT.mjs.map +1 -0
  12. package/dist/{azure-monitor.transport-D7Da4RAb.d.mts → azure-monitor.transport-CbSHOnNX.d.mts} +3 -6
  13. package/dist/azure-monitor.transport-CbSHOnNX.d.mts.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-BvXLDPlV.mjs} +21 -7
  19. package/dist/batch-buffer-BvXLDPlV.mjs.map +1 -0
  20. package/dist/{batch-buffer-BY-mRWIK.js → batch-buffer-C7Am4Mw-.js} +53 -40
  21. package/dist/batch-buffer-C7Am4Mw-.js.map +1 -0
  22. package/dist/browser.d.mts +47 -27
  23. package/dist/browser.d.mts.map +1 -1
  24. package/dist/browser.d.ts +47 -27
  25. package/dist/browser.d.ts.map +1 -1
  26. package/dist/browser.js +464 -62
  27. package/dist/browser.js.map +1 -1
  28. package/dist/browser.mjs +465 -65
  29. package/dist/browser.mjs.map +1 -1
  30. package/dist/{builder-0gEzRopq.mjs → builder-DhNhvOkt.mjs} +307 -246
  31. package/dist/builder-DhNhvOkt.mjs.map +1 -0
  32. package/dist/{builder-D44QktIo.js → builder-yFvJrz7o.js} +435 -399
  33. package/dist/builder-yFvJrz7o.js.map +1 -0
  34. package/dist/cli/index.js +216 -125
  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-DsEq633o.d.ts → cloudwatch.transport-CQyT6U91.d.ts} +2 -6
  40. package/dist/cloudwatch.transport-CQyT6U91.d.ts.map +1 -0
  41. package/dist/{cloudwatch.transport-BO1ahxw-.js → cloudwatch.transport-Ch1Uae-0.js} +61 -36
  42. package/dist/cloudwatch.transport-Ch1Uae-0.js.map +1 -0
  43. package/dist/{cloudwatch.transport-UlyZFWMn.d.mts → cloudwatch.transport-CjVrI6S4.d.mts} +2 -6
  44. package/dist/cloudwatch.transport-CjVrI6S4.d.mts.map +1 -0
  45. package/dist/{cloudwatch.transport-DZ6ies7g.mjs → cloudwatch.transport-DZqF2xZO.mjs} +54 -28
  46. package/dist/cloudwatch.transport-DZqF2xZO.mjs.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 +15 -69
  52. package/dist/correlation.d.mts.map +1 -1
  53. package/dist/correlation.d.ts +15 -69
  54. package/dist/correlation.d.ts.map +1 -1
  55. package/dist/correlation.js +69 -20
  56. package/dist/correlation.js.map +1 -1
  57. package/dist/correlation.mjs +67 -17
  58. package/dist/correlation.mjs.map +1 -1
  59. package/dist/{entry-fields-BvOLFlJ4.js → entry-fields-BSLkzw18.js} +16 -13
  60. package/dist/entry-fields-BSLkzw18.js.map +1 -0
  61. package/dist/{entry-fields-BJkuPnIg.mjs → entry-fields-J1OBi24o.mjs} +11 -7
  62. package/dist/entry-fields-J1OBi24o.mjs.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-BCIvdFV-.d.ts} +5 -8
  68. package/dist/gcp.transport-BCIvdFV-.d.ts.map +1 -0
  69. package/dist/{gcp.transport-GrJurKo8.d.mts → gcp.transport-D9SdLPwP.d.mts} +5 -8
  70. package/dist/gcp.transport-D9SdLPwP.d.mts.map +1 -0
  71. package/dist/{gcp.transport-DBX5TPIy.mjs → gcp.transport-DVCmnA3b.mjs} +59 -16
  72. package/dist/gcp.transport-DVCmnA3b.mjs.map +1 -0
  73. package/dist/{gcp.transport-CHV8MGgz.js → gcp.transport-Dy2Lf8FI.js} +64 -22
  74. package/dist/gcp.transport-Dy2Lf8FI.js.map +1 -0
  75. package/dist/http-shapes-BnBkJcid.d.mts +32 -0
  76. package/dist/http-shapes-BnBkJcid.d.mts.map +1 -0
  77. package/dist/http-shapes-BnBkJcid.d.ts +32 -0
  78. package/dist/http-shapes-BnBkJcid.d.ts.map +1 -0
  79. package/dist/{index-3mw5gaCw.d.mts → index-BSTtFcQ6.d.mts} +142 -13
  80. package/dist/index-BSTtFcQ6.d.mts.map +1 -0
  81. package/dist/{index-DhIoploR.d.ts → index-CFDGkI8n.d.ts} +142 -13
  82. package/dist/index-CFDGkI8n.d.ts.map +1 -0
  83. package/dist/index.d.mts +114 -217
  84. package/dist/index.d.mts.map +1 -1
  85. package/dist/index.d.ts +113 -216
  86. package/dist/index.d.ts.map +1 -1
  87. package/dist/index.js +182 -279
  88. package/dist/index.js.map +1 -1
  89. package/dist/index.mjs +160 -256
  90. package/dist/index.mjs.map +1 -1
  91. package/dist/internal-log-Bg4V1cPg.mjs +170 -0
  92. package/dist/internal-log-Bg4V1cPg.mjs.map +1 -0
  93. package/dist/internal-log-By4Govmu.js +223 -0
  94. package/dist/internal-log-By4Govmu.js.map +1 -0
  95. package/dist/{logitron-logger-UVeN-mQm.d.ts → logitron-logger-D22Yb61K.d.mts} +121 -100
  96. package/dist/logitron-logger-D22Yb61K.d.mts.map +1 -0
  97. package/dist/{logitron-logger-BFDSO8Io.d.mts → logitron-logger-D_MYYrQt.d.ts} +121 -100
  98. package/dist/logitron-logger-D_MYYrQt.d.ts.map +1 -0
  99. package/dist/middleware.d.mts +13 -28
  100. package/dist/middleware.d.mts.map +1 -1
  101. package/dist/middleware.d.ts +13 -28
  102. package/dist/middleware.d.ts.map +1 -1
  103. package/dist/middleware.js +20 -81
  104. package/dist/middleware.js.map +1 -1
  105. package/dist/middleware.mjs +17 -79
  106. package/dist/middleware.mjs.map +1 -1
  107. package/dist/nest.d.mts +37 -48
  108. package/dist/nest.d.mts.map +1 -1
  109. package/dist/nest.d.ts +37 -48
  110. package/dist/nest.d.ts.map +1 -1
  111. package/dist/nest.js +124 -135
  112. package/dist/nest.js.map +1 -1
  113. package/dist/nest.mjs +69 -78
  114. package/dist/nest.mjs.map +1 -1
  115. package/dist/{transport.manager-BiuCAJd2.mjs → otel-Dt5riXuE.mjs} +275 -117
  116. package/dist/otel-Dt5riXuE.mjs.map +1 -0
  117. package/dist/{transport.manager-CXbKKdVE.js → otel-DyeH6DVR.js} +373 -178
  118. package/dist/otel-DyeH6DVR.js.map +1 -0
  119. package/dist/own-property-BWkibepN.js +40 -0
  120. package/dist/own-property-BWkibepN.js.map +1 -0
  121. package/dist/own-property-CjFw9qwZ.mjs +29 -0
  122. package/dist/own-property-CjFw9qwZ.mjs.map +1 -0
  123. package/dist/{trace.utils-CvXgaiQT.mjs → request-trace-BgNykH9M.mjs} +40 -9
  124. package/dist/request-trace-BgNykH9M.mjs.map +1 -0
  125. package/dist/{trace.utils-DpBOLDtq.js → request-trace-ByujsUZk.js} +117 -77
  126. package/dist/request-trace-ByujsUZk.js.map +1 -0
  127. package/dist/rolldown-runtime-D3PmRqjj.mjs +4 -0
  128. package/dist/{safe-stringify-DJ66tW5I.mjs → safe-stringify-B5p5ktFe.mjs} +39 -15
  129. package/dist/safe-stringify-B5p5ktFe.mjs.map +1 -0
  130. package/dist/{safe-stringify-DWo3aZp_.js → safe-stringify-J3sh-7YM.js} +59 -36
  131. package/dist/safe-stringify-J3sh-7YM.js.map +1 -0
  132. package/dist/{search-C4V0OMEn.js → search-CRjhHxe9.js} +319 -92
  133. package/dist/search-CRjhHxe9.js.map +1 -0
  134. package/dist/{search-CNh9uVwR.d.ts → search-DA3ft3X5.d.mts} +5 -22
  135. package/dist/search-DA3ft3X5.d.mts.map +1 -0
  136. package/dist/{search-BFbu_oVn.mjs → search-DAXKE-P9.mjs} +289 -62
  137. package/dist/search-DAXKE-P9.mjs.map +1 -0
  138. package/dist/{search-DXANsQ2n.d.mts → search-DEl3Pe47.d.ts} +5 -22
  139. package/dist/search-DEl3Pe47.d.ts.map +1 -0
  140. package/dist/search.d.mts +2 -4
  141. package/dist/search.d.ts +2 -4
  142. package/dist/search.js +3 -4
  143. package/dist/search.mjs +1 -4
  144. package/dist/secret-config-CmK2wVkr.js +272 -0
  145. package/dist/secret-config-CmK2wVkr.js.map +1 -0
  146. package/dist/secret-config-Dhb6pqTU.mjs +210 -0
  147. package/dist/secret-config-Dhb6pqTU.mjs.map +1 -0
  148. package/dist/{slack.transport-CXjQYOes.d.ts → slack.transport-BDyENuR0.d.mts} +56 -9
  149. package/dist/slack.transport-BDyENuR0.d.mts.map +1 -0
  150. package/dist/{slack.transport-Bzw7sucI.mjs → slack.transport-BTEwsREY.mjs} +263 -31
  151. package/dist/slack.transport-BTEwsREY.mjs.map +1 -0
  152. package/dist/{slack.transport-BZzoXDPn.d.mts → slack.transport-C6E0l4kw.d.ts} +56 -9
  153. package/dist/slack.transport-C6E0l4kw.d.ts.map +1 -0
  154. package/dist/{slack.transport-BfJRouB2.js → slack.transport-UbYvOdKx.js} +286 -42
  155. package/dist/slack.transport-UbYvOdKx.js.map +1 -0
  156. package/dist/testing.d.mts +13 -11
  157. package/dist/testing.d.mts.map +1 -1
  158. package/dist/testing.d.ts +13 -11
  159. package/dist/testing.d.ts.map +1 -1
  160. package/dist/testing.js +41 -7
  161. package/dist/testing.js.map +1 -1
  162. package/dist/testing.mjs +40 -6
  163. package/dist/testing.mjs.map +1 -1
  164. package/dist/{transport.types-CGoHpWQR.d.ts → transport.types-CzJq4IrF.d.mts} +14 -5
  165. package/dist/transport.types-CzJq4IrF.d.mts.map +1 -0
  166. package/dist/{transport.types-BMnurPcc.d.mts → transport.types-CzJq4IrF.d.ts} +14 -5
  167. package/dist/transport.types-CzJq4IrF.d.ts.map +1 -0
  168. package/dist/transports.d.mts +39 -41
  169. package/dist/transports.d.mts.map +1 -1
  170. package/dist/transports.d.ts +39 -41
  171. package/dist/transports.d.ts.map +1 -1
  172. package/dist/transports.js +19 -22
  173. package/dist/transports.mjs +7 -13
  174. package/dist/worker-entry.js +438 -107
  175. package/dist/worker.d.mts +1 -2
  176. package/dist/worker.d.ts +1 -2
  177. package/dist/worker.js +3 -4
  178. package/dist/worker.mjs +1 -4
  179. package/dist/{worker.transport-JvGPog3C.d.mts → worker.transport-B9mCQSM1.d.ts} +7 -6
  180. package/dist/worker.transport-B9mCQSM1.d.ts.map +1 -0
  181. package/dist/{worker.transport-CdzSZJmw.d.ts → worker.transport-Bl8lFRck.d.mts} +7 -6
  182. package/dist/worker.transport-Bl8lFRck.d.mts.map +1 -0
  183. package/dist/{worker.transport-lPxO2MVL.mjs → worker.transport-BmmOKb1-.mjs} +43 -10
  184. package/dist/worker.transport-BmmOKb1-.mjs.map +1 -0
  185. package/dist/{worker.transport-BdPxu3PN.js → worker.transport-DxxbqQCG.js} +48 -15
  186. package/dist/worker.transport-DxxbqQCG.js.map +1 -0
  187. package/package.json +51 -75
  188. package/dist/async-context-BzJrbfQs.mjs +0 -72
  189. package/dist/async-context-BzJrbfQs.mjs.map +0 -1
  190. package/dist/async-context-DyQQYq3I.js +0 -92
  191. package/dist/async-context-DyQQYq3I.js.map +0 -1
  192. package/dist/azure-monitor.transport-CHnjVRF-.mjs.map +0 -1
  193. package/dist/azure-monitor.transport-Cn_3Usvu.d.ts.map +0 -1
  194. package/dist/azure-monitor.transport-CrvfHd9C.js.map +0 -1
  195. package/dist/azure-monitor.transport-D7Da4RAb.d.mts.map +0 -1
  196. package/dist/batch-buffer-BY-mRWIK.js.map +0 -1
  197. package/dist/batch-buffer-PGvSgbmd.mjs.map +0 -1
  198. package/dist/builder-0gEzRopq.mjs.map +0 -1
  199. package/dist/builder-D44QktIo.js.map +0 -1
  200. package/dist/chunk-DLSkYcPk.mjs +0 -7
  201. package/dist/chunk-nOFOJqeH.js +0 -30
  202. package/dist/cloudwatch.transport-BO1ahxw-.js.map +0 -1
  203. package/dist/cloudwatch.transport-DZ6ies7g.mjs.map +0 -1
  204. package/dist/cloudwatch.transport-DsEq633o.d.ts.map +0 -1
  205. package/dist/cloudwatch.transport-UlyZFWMn.d.mts.map +0 -1
  206. package/dist/entry-fields-BJkuPnIg.mjs.map +0 -1
  207. package/dist/entry-fields-BvOLFlJ4.js.map +0 -1
  208. package/dist/gcp.transport-B7oc97sG.d.ts.map +0 -1
  209. package/dist/gcp.transport-CHV8MGgz.js.map +0 -1
  210. package/dist/gcp.transport-DBX5TPIy.mjs.map +0 -1
  211. package/dist/gcp.transport-GrJurKo8.d.mts.map +0 -1
  212. package/dist/index-3mw5gaCw.d.mts.map +0 -1
  213. package/dist/index-DhIoploR.d.ts.map +0 -1
  214. package/dist/internal-log-BUJYMZbE.js +0 -70
  215. package/dist/internal-log-BUJYMZbE.js.map +0 -1
  216. package/dist/internal-log-Cm8SOWSV.mjs +0 -52
  217. package/dist/internal-log-Cm8SOWSV.mjs.map +0 -1
  218. package/dist/logitron-logger-BFDSO8Io.d.mts.map +0 -1
  219. package/dist/logitron-logger-UVeN-mQm.d.ts.map +0 -1
  220. package/dist/safe-stringify-DJ66tW5I.mjs.map +0 -1
  221. package/dist/safe-stringify-DWo3aZp_.js.map +0 -1
  222. package/dist/search-BFbu_oVn.mjs.map +0 -1
  223. package/dist/search-C4V0OMEn.js.map +0 -1
  224. package/dist/search-CNh9uVwR.d.ts.map +0 -1
  225. package/dist/search-DXANsQ2n.d.mts.map +0 -1
  226. package/dist/slack.transport-BZzoXDPn.d.mts.map +0 -1
  227. package/dist/slack.transport-BfJRouB2.js.map +0 -1
  228. package/dist/slack.transport-Bzw7sucI.mjs.map +0 -1
  229. package/dist/slack.transport-CXjQYOes.d.ts.map +0 -1
  230. package/dist/trace.utils-CvXgaiQT.mjs.map +0 -1
  231. package/dist/trace.utils-DpBOLDtq.js.map +0 -1
  232. package/dist/transport.manager-BiuCAJd2.mjs.map +0 -1
  233. package/dist/transport.manager-CXbKKdVE.js.map +0 -1
  234. package/dist/transport.types-BMnurPcc.d.mts.map +0 -1
  235. package/dist/transport.types-CGoHpWQR.d.ts.map +0 -1
  236. package/dist/worker.transport-BdPxu3PN.js.map +0 -1
  237. package/dist/worker.transport-CdzSZJmw.d.ts.map +0 -1
  238. package/dist/worker.transport-JvGPog3C.d.mts.map +0 -1
  239. package/dist/worker.transport-lPxO2MVL.mjs.map +0 -1
@@ -0,0 +1,223 @@
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
+ function safeDecode(value) {
81
+ try {
82
+ return decodeURIComponent(value.replace(/\+/g, " "));
83
+ } catch {
84
+ return value;
85
+ }
86
+ }
87
+ /** Replace the values of sensitive query parameters, leaving the rest verbatim. */
88
+ function redactUrlQuery(url, redactParams) {
89
+ const q = url.indexOf("?");
90
+ if (q === -1) return url;
91
+ const hashAt = url.indexOf("#", q);
92
+ const query = url.slice(q + 1, hashAt === -1 ? void 0 : hashAt);
93
+ const hash = hashAt === -1 ? "" : url.slice(hashAt);
94
+ const cleaned = query.split("&").map((pair) => {
95
+ const eq = pair.indexOf("=");
96
+ const rawKey = eq === -1 ? pair : pair.slice(0, eq);
97
+ const decoded = safeDecode(rawKey);
98
+ const bracket = decoded.indexOf("[");
99
+ const name = (bracket === -1 ? decoded : decoded.slice(0, bracket)).toLowerCase();
100
+ return redactParams.has(name) && eq !== -1 ? `${rawKey}=[REDACTED]` : pair;
101
+ }).join("&");
102
+ return `${url.slice(0, q)}?${cleaned}${hash}`;
103
+ }
104
+ /** Lower-cased lookup set of the default names plus any extras. */
105
+ function buildNameSet(defaults, extra) {
106
+ return new Set([...defaults, ...extra ?? []].map((n) => n.toLowerCase()));
107
+ }
108
+ // src/utils/internal-log.ts
109
+ /**
110
+ * Internal logging helpers for use within the logixia library itself.
111
+ *
112
+ * These functions write directly to stderr/stdout without going through
113
+ * LogixiaLogger — this avoids circular dependencies and ensures internal
114
+ * diagnostics still surface even when the logger is misconfigured.
115
+ *
116
+ * Library code must NEVER call console.log/warn/error directly. Use these
117
+ * helpers instead so that internal output can be silenced in tests by setting
118
+ * the LOGIXIA_SILENT_INTERNAL=1 environment variable.
119
+ */
120
+ /**
121
+ * Read the silence flag on each call rather than caching it at import time, so
122
+ * setting LOGIXIA_SILENT_INTERNAL=1 AFTER the module is first imported (e.g. in
123
+ * a test setup file) still takes effect — the documented test-silencing
124
+ * behavior was previously unreliable because the value was frozen at load.
125
+ */
126
+ function isSilent() {
127
+ var _process$env;
128
+ if (typeof process !== "undefined" && ((_process$env = process.env) === null || _process$env === void 0 ? void 0 : _process$env.LOGIXIA_SILENT_INTERNAL) === "1") return true;
129
+ const flag = globalThis["LOGIXIA_SILENT_INTERNAL"];
130
+ return flag === "1" || flag === 1 || flag === true;
131
+ }
132
+ /**
133
+ * Write a line to stderr, falling back to the matching console method where
134
+ * `process` is unavailable (browsers, Cloudflare Workers, Deno without Node compat).
135
+ */
136
+ function writeLine(method, line) {
137
+ var _process$stderr;
138
+ 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`);
139
+ else if (typeof console !== "undefined" && typeof console[method] === "function") console[method](line);
140
+ }
141
+ /**
142
+ * Emit an internal debug/info message to stderr.
143
+ * Use for field-enable/disable notifications that a developer might want to see
144
+ * during development but should not appear in production log streams.
145
+ */
146
+ function internalLog(message) {
147
+ if (!isSilent()) writeLine("log", `[logixia] ${message}`);
148
+ }
149
+ /**
150
+ * Emit an internal warning to stderr.
151
+ * Use when something is misconfigured but logixia can continue operating.
152
+ */
153
+ function internalWarn(message) {
154
+ if (!isSilent()) writeLine("warn", `[logixia:warn] ${message}`);
155
+ }
156
+ /**
157
+ * Emit an internal error to stderr.
158
+ * Use when a transport write fails or a serious internal error occurs.
159
+ */
160
+ function internalError(message, error) {
161
+ if (!isSilent()) {
162
+ let errStr = "";
163
+ if (error instanceof Error) errStr = ` — ${error.message}`;
164
+ else if (error != null) errStr = ` — ${String(error)}`;
165
+ writeLine("error", `[logixia:error] ${message}${errStr}`);
166
+ }
167
+ }
168
+ Object.defineProperty(exports, "DEFAULT_REDACT_HEADERS", {
169
+ enumerable: true,
170
+ get: function() {
171
+ return DEFAULT_REDACT_HEADERS;
172
+ }
173
+ });
174
+ Object.defineProperty(exports, "DEFAULT_REDACT_QUERY_PARAMS", {
175
+ enumerable: true,
176
+ get: function() {
177
+ return DEFAULT_REDACT_QUERY_PARAMS;
178
+ }
179
+ });
180
+ Object.defineProperty(exports, "SENSITIVE_KEY_NAMES", {
181
+ enumerable: true,
182
+ get: function() {
183
+ return SENSITIVE_KEY_NAMES;
184
+ }
185
+ });
186
+ Object.defineProperty(exports, "TRANSPORT_CONFIG_SECRET_NAMES", {
187
+ enumerable: true,
188
+ get: function() {
189
+ return TRANSPORT_CONFIG_SECRET_NAMES;
190
+ }
191
+ });
192
+ Object.defineProperty(exports, "buildNameSet", {
193
+ enumerable: true,
194
+ get: function() {
195
+ return buildNameSet;
196
+ }
197
+ });
198
+ Object.defineProperty(exports, "internalError", {
199
+ enumerable: true,
200
+ get: function() {
201
+ return internalError;
202
+ }
203
+ });
204
+ Object.defineProperty(exports, "internalLog", {
205
+ enumerable: true,
206
+ get: function() {
207
+ return internalLog;
208
+ }
209
+ });
210
+ Object.defineProperty(exports, "internalWarn", {
211
+ enumerable: true,
212
+ get: function() {
213
+ return internalWarn;
214
+ }
215
+ });
216
+ Object.defineProperty(exports, "redactUrlQuery", {
217
+ enumerable: true,
218
+ get: function() {
219
+ return redactUrlQuery;
220
+ }
221
+ });
222
+
223
+ //# sourceMappingURL=internal-log-By4Govmu.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internal-log-By4Govmu.js","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\nfunction safeDecode(value: string): string {\n try {\n return decodeURIComponent(value.replace(/\\+/g, ' '));\n } catch {\n return value;\n }\n}\n\n/** Replace the values of sensitive query parameters, leaving the rest verbatim. */\nexport function redactUrlQuery(url: string, redactParams: ReadonlySet<string>): string {\n const q = url.indexOf('?');\n if (q === -1) return url;\n const hashAt = url.indexOf('#', q);\n const query = url.slice(q + 1, hashAt === -1 ? undefined : hashAt);\n const hash = hashAt === -1 ? '' : url.slice(hashAt);\n const cleaned = query\n .split('&')\n .map((pair) => {\n const eq = pair.indexOf('=');\n const rawKey = eq === -1 ? pair : pair.slice(0, eq);\n const decoded = safeDecode(rawKey);\n const bracket = decoded.indexOf('[');\n const name = (bracket === -1 ? decoded : decoded.slice(0, bracket)).toLowerCase();\n return redactParams.has(name) && eq !== -1 ? `${rawKey}=[REDACTED]` : pair;\n })\n .join('&');\n return `${url.slice(0, q)}?${cleaned}${hash}`;\n}\n\n/** Lower-cased lookup set of the default names plus any extras. */\nexport function buildNameSet(\n defaults: readonly string[],\n extra: readonly string[] | undefined\n): Set<string> {\n return new Set([...defaults, ...(extra ?? [])].map((n) => n.toLowerCase()));\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":"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"}
@@ -1,105 +1,17 @@
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
-
5
- interface LogixiaPlugin {
6
- /**
7
- * Unique plugin name.
8
- * logixia uses this to prevent duplicate registration of the same plugin
9
- * on the same logger instance.
10
- */
11
- name: string;
12
- /**
13
- * Called once immediately after `logger.use(plugin)` is called.
14
- * Use for one-time setup (open connections, allocate buffers, etc.).
15
- * Async `onInit` errors are silently swallowed to avoid blocking the logger.
16
- */
17
- onInit?(): void | Promise<void>;
18
- /**
19
- * Called for every log entry **after** PII redaction and **before** transport
20
- * dispatch. Plugins run in registration order; each receives the (possibly
21
- * modified) output of the previous plugin.
22
- *
23
- * - Return the entry (modified or unchanged) to continue processing.
24
- * - Return `null` to **drop** the entry — no transport will receive it.
25
- *
26
- * Errors thrown inside `onLog` are swallowed so a buggy plugin cannot crash
27
- * logging; the chain continues with the previous (un-transformed) entry.
28
- */
29
- onLog?(entry: LogEntry): LogEntry | null | Promise<LogEntry | null>;
30
- /**
31
- * Called when a transport write fails (after any configured retries).
32
- * Useful for routing transport errors to an alerting or metrics system.
33
- * Errors thrown inside `onError` are silently swallowed.
34
- */
35
- onError?(error: Error, entry?: LogEntry): void | Promise<void>;
36
- /**
37
- * Called when the logger is closed via `logger.close()` or the process
38
- * receives a shutdown signal (when `gracefulShutdown` is enabled).
39
- * Errors thrown inside `onShutdown` are silently swallowed.
40
- */
41
- onShutdown?(): void | Promise<void>;
42
- }
43
- /**
44
- * Holds an ordered list of `LogixiaPlugin` instances and dispatches lifecycle
45
- * events to them. One registry is created per logger instance; a global
46
- * singleton is also exported for process-wide registration.
47
- */
48
- declare class PluginRegistry {
49
- private readonly _plugins;
50
- /**
51
- * Register a plugin. Silently skips if a plugin with the same `name` is
52
- * already registered on this registry.
53
- */
54
- register(plugin: LogixiaPlugin): void;
55
- /** Remove a previously registered plugin by name. No-op if not found. */
56
- unregister(name: string): void;
57
- /** Returns `true` if a plugin with the given name is registered. */
58
- has(name: string): boolean;
59
- /** Number of currently registered plugins. */
60
- get size(): number;
61
- /**
62
- * Run all `onLog` hooks in order.
63
- * Returns `null` if any plugin cancels the entry; otherwise returns the
64
- * (possibly transformed) entry.
65
- */
66
- runOnLog(entry: LogEntry): Promise<LogEntry | null>;
67
- /**
68
- * Notify all `onError` hooks.
69
- * Errors thrown inside hooks are swallowed to prevent error cascades.
70
- */
71
- runOnError(error: Error, entry?: LogEntry): Promise<void>;
72
- /** Run all `onShutdown` hooks concurrently. Hook errors are swallowed. */
73
- runOnShutdown(): Promise<void>;
74
- }
1
+ import { C as LogixiaLoggerInstance, L as LogixiaPlugin, b as LoggerConfig, p as ILoggerDefault, w as NamespaceLevels, x as LoggerWithLevels, y as LogLevelString } from "./index-BSTtFcQ6.mjs";
75
2
  /**
76
- * Module-level singleton registry.
77
- *
78
- * Plugins registered here are automatically copied into every **new** logger
79
- * instance created after the registration. Already-created loggers are not
80
- * retroactively affected — use `logger.use(plugin)` for per-instance control.
81
- */
82
- declare const globalPluginRegistry: PluginRegistry;
83
- /**
84
- * Register a plugin in the global registry so it applies to every future
85
- * logger instance.
3
+ * The logixia logger. Create instances with {@link createLogger} so that custom
4
+ * levels from `levelOptions.levels` also become methods.
86
5
  *
87
6
  * @example
88
7
  * ```ts
89
- * import { usePlugin } from 'logixia';
90
- *
91
- * usePlugin({
92
- * name: 'audit-sink',
93
- * onLog(entry) {
94
- * if (entry.level === 'error') auditQueue.push(entry);
95
- * return entry;
96
- * },
97
- * });
8
+ * const logger = createLogger({ appName: 'api', environment: 'production' });
9
+ * await logger.info('Server started', { port: 3000 });
10
+ * const req = logger.child('RequestHandler', { requestId: 'r-1' });
11
+ * await req.error(new Error('boom'));
12
+ * await logger.close(); // flush buffered transports before exit
98
13
  * ```
99
14
  */
100
- declare function usePlugin(plugin: LogixiaPlugin): void;
101
- //#endregion
102
- //#region src/core/logitron-logger.d.ts
103
15
  declare class LogixiaLogger<TConfig extends LoggerConfig<Record<string, number>> = LoggerConfig> implements ILoggerDefault {
104
16
  [K: string]: any;
105
17
  private config;
@@ -114,6 +26,8 @@ declare class LogixiaLogger<TConfig extends LoggerConfig<Record<string, number>>
114
26
  private _levelValues;
115
27
  /** Numeric threshold for the currently active log level. */
116
28
  private _minLevelValue;
29
+ /** Level set via setLevel(); outranks every other level source until the process ends. */
30
+ private _runtimeLevel;
117
31
  /** `source=value` pairs already reported as unknown levels — warn once per logger. */
118
32
  private readonly _warnedInvalidLevels;
119
33
  /** Pre-built ANSI color codes to avoid recreating the object in colorize(). */
@@ -137,6 +51,10 @@ declare class LogixiaLogger<TConfig extends LoggerConfig<Record<string, number>>
137
51
  private readonly _pluginRegistry;
138
52
  /** Set on loggers created by child(); they borrow the root's transports, sampler and plugins. */
139
53
  private readonly _parent;
54
+ /** Namespace level map shared by a logger and all its children; `version` bumps on every change. */
55
+ private readonly _nsStore;
56
+ /** Store version this logger's threshold was last computed against. */
57
+ private _nsSeenVersion;
140
58
  constructor(config: TConfig, context?: string, parent?: LogixiaLogger<TConfig>);
141
59
  private setupGracefulShutdown;
142
60
  private createCustomLevelMethods;
@@ -145,17 +63,61 @@ declare class LogixiaLogger<TConfig extends LoggerConfig<Record<string, number>>
145
63
  * Keeps the actual log() call free of allocations in the common case.
146
64
  */
147
65
  private _buildPerfCaches;
66
+ /**
67
+ * Log at `error` level. An `Error` is logged with its message and serialized
68
+ * (name, message, stack) under `data.error`; a string is logged as-is.
69
+ * `data` is merged into the entry payload.
70
+ */
148
71
  error(messageOrError: string | Error, data?: Record<string, unknown>): Promise<void>;
72
+ /** Log `message` at `warn` level; `data` is merged into the entry payload. */
149
73
  warn(message: string, data?: Record<string, unknown>): Promise<void>;
74
+ /** Log `message` at `info` level; `data` is merged into the entry payload. */
150
75
  info(message: string, data?: Record<string, unknown>): Promise<void>;
76
+ /** Log `message` at `debug` level; `data` is merged into the entry payload. */
151
77
  debug(message: string, data?: Record<string, unknown>): Promise<void>;
78
+ /** Log `message` at `trace` level; `data` is merged into the entry payload. */
152
79
  trace(message: string, data?: Record<string, unknown>): Promise<void>;
80
+ /** Log `message` at `verbose` level; `data` is merged into the entry payload. */
153
81
  verbose(message: string, data?: Record<string, unknown>): Promise<void>;
82
+ /**
83
+ * Log at an arbitrary level name, including custom levels. Levels below the
84
+ * active threshold are dropped, as are level names that are not registered
85
+ * in `levelOptions.levels` (and are not built-in).
86
+ */
154
87
  logLevel(level: string, message: string, data?: Record<string, unknown>): Promise<void>;
88
+ /** Start a named timer; finish it with {@link timeEnd}. Reusing a label restarts it. */
155
89
  time(label: string): void;
90
+ /**
91
+ * Stop the timer `label`, log its duration at `info` level, and return the
92
+ * elapsed milliseconds. Logs a `warn` and returns `undefined` if the timer
93
+ * does not exist.
94
+ *
95
+ * @example
96
+ * ```ts
97
+ * logger.time('db');
98
+ * await query();
99
+ * const ms = await logger.timeEnd('db');
100
+ * ```
101
+ */
156
102
  timeEnd(label: string): Promise<number | undefined>;
157
103
  timeAsync<T>(label: string, fn: () => Promise<T>): Promise<T>;
104
+ /**
105
+ * Change the minimum log level at runtime. The override outranks
106
+ * `LOGIXIA_LEVEL`, `LOGIXIA_LEVEL_<NS>` and `namespaceLevels`, and survives
107
+ * later changes to fields or namespace levels. Unknown level names are
108
+ * ignored with a warning and the current level is kept.
109
+ *
110
+ * @example
111
+ * ```ts
112
+ * logger.setLevel('debug');
113
+ * ```
114
+ */
158
115
  setLevel(level: LogLevelString): void;
116
+ /**
117
+ * Return the configured minimum log level, not the per-namespace effective
118
+ * one. Without `setLevel()` it is `LOGIXIA_LEVEL`, else `levelOptions.level`,
119
+ * else a `NODE_ENV` default (`debug` in development, `warn` in test), else `info`.
120
+ */
159
121
  getLevel(): LogLevelString;
160
122
  private _validLevelList;
161
123
  /**
@@ -171,6 +133,10 @@ declare class LogixiaLogger<TConfig extends LoggerConfig<Record<string, number>>
171
133
  * (flip a module's verbosity live to chase a bug without raising global
172
134
  * volume). The new map fully replaces the previous one.
173
135
  *
136
+ * The map is shared by a logger and all its `child()` loggers: calling this on
137
+ * a child changes the whole family, and existing children pick the change up on
138
+ * their next log call.
139
+ *
174
140
  * @example
175
141
  * ```ts
176
142
  * // Turn on debug for the DB layer only, live:
@@ -182,22 +148,45 @@ declare class LogixiaLogger<TConfig extends LoggerConfig<Record<string, number>>
182
148
  patchNamespaceLevels(levels: NamespaceLevels): void;
183
149
  /** Return a copy of the current per-namespace level map. */
184
150
  getNamespaceLevels(): NamespaceLevels;
151
+ private _syncNamespaceLevels;
152
+ /** Set the context label (e.g. a class or module name) attached to every subsequent entry. */
185
153
  setContext(context: string): void;
154
+ /** Return the current context label, or `undefined` if none is set. */
186
155
  getContext(): string | undefined;
156
+ /** Show `fieldName` in log output, overriding the config for this logger instance. */
187
157
  enableField(fieldName: string): void;
158
+ /** Hide `fieldName` from log output, overriding the config for this logger instance. */
188
159
  disableField(fieldName: string): void;
160
+ /** Whether `fieldName` is currently shown: runtime override first, then config, default `true`. */
189
161
  isFieldEnabled(fieldName: string): boolean;
162
+ /** Return the visibility (`true` = shown) of every standard log field. */
190
163
  getFieldState(): Record<string, boolean>;
164
+ /** Drop all runtime enable/disable overrides so field visibility follows the config again. */
191
165
  resetFieldState(): void;
192
166
  /** @deprecated No-op. Library code never prompts on stdin; use setTransportLevels(). */
193
167
  enableTransportLevelPrompting(): void;
194
168
  /** @deprecated No-op. */
195
169
  disableTransportLevelPrompting(): void;
170
+ /** Restrict `transportId` to only the given `levels`. Warns if no transports are configured. */
196
171
  setTransportLevels(transportId: string, levels: string[]): void;
172
+ /** Return the levels `transportId` is restricted to, or `undefined` if it has none. */
197
173
  getTransportLevels(transportId: string): string[] | undefined;
198
174
  clearTransportLevelPreferences(): void;
175
+ /** Return the identifiers of the configured transports (empty if none). */
199
176
  getAvailableTransports(): string[];
200
- child(context: string, data?: Record<string, unknown>): ILogger;
177
+ /**
178
+ * Create a child logger with its own `context` that shares this logger's
179
+ * configuration and transports. `data` is merged into the bound fields
180
+ * inherited from this logger and added to every entry the child writes.
181
+ * Closing a child does not close the shared transports.
182
+ *
183
+ * @example
184
+ * ```ts
185
+ * const req = logger.child('Checkout', { requestId: 'r-42' });
186
+ * await req.info('started'); // entry includes requestId
187
+ * ```
188
+ */
189
+ child(context: string, data?: Record<string, unknown>): LogixiaLoggerInstance;
201
190
  /**
202
191
  * Register a plugin on this logger instance.
203
192
  *
@@ -215,11 +204,27 @@ declare class LogixiaLogger<TConfig extends LoggerConfig<Record<string, number>>
215
204
  * No-op if the plugin is not registered on this instance.
216
205
  */
217
206
  unuse(pluginName: string): this;
207
+ /** Flush buffered entries in all transports without closing them. */
218
208
  flush(): Promise<void>;
209
+ /** Report whether the transports are healthy; `healthy: false` if no transport manager exists. */
219
210
  healthCheck(): Promise<{
220
211
  healthy: boolean;
221
212
  details: Record<string, unknown>;
222
213
  }>;
214
+ /**
215
+ * Warn about timers that were never ended, then flush and close all transports,
216
+ * stop the sampler and run plugin shutdown hooks. On a child logger only the
217
+ * timer warnings run; the shared transports stay open.
218
+ *
219
+ * To flush on SIGTERM/SIGINT, set the `gracefulShutdown` config option rather
220
+ * than writing your own signal handler; do not combine it with a manual
221
+ * handler that calls `process.exit`, which can cut the flush short.
222
+ *
223
+ * @example
224
+ * ```ts
225
+ * await logger.close(); // e.g. at the end of a script or a test
226
+ * ```
227
+ */
223
228
  close(): Promise<void>;
224
229
  private log;
225
230
  /**
@@ -231,6 +236,7 @@ declare class LogixiaLogger<TConfig extends LoggerConfig<Record<string, number>>
231
236
  * Feature 3: Resolve the effective log level for this logger instance.
232
237
  *
233
238
  * Priority:
239
+ * 0. A level set at runtime with `setLevel()` (explicit programmatic call, wins over all below)
234
240
  * 1. ENV `LOGIXIA_LEVEL_<NS_UPPER>` (e.g. LOGIXIA_LEVEL_DB for ns "db" or "db.queries")
235
241
  * 2. Matching `namespaceLevels` config entry (longer pattern = more specific, wins)
236
242
  * 3. Global `LOGIXIA_LEVEL` ENV override
@@ -251,7 +257,22 @@ declare class LogixiaLogger<TConfig extends LoggerConfig<Record<string, number>>
251
257
  * back to a direct stdout/stderr write so the entry is never lost. */
252
258
  private _handleOutputError;
253
259
  }
260
+ /**
261
+ * Create a logger from `config`, with an optional default `context` label.
262
+ *
263
+ * Every key of `levelOptions.levels` that is not already a method becomes an
264
+ * async method on the returned logger, typed through the config, and routes to
265
+ * {@link LogixiaLogger.logLevel}.
266
+ *
267
+ * @example
268
+ * ```ts
269
+ * const logger = createLogger({
270
+ * appName: 'api',
271
+ * levelOptions: { level: 'info', levels: { error: 0, warn: 1, info: 2, audit: 2 } },
272
+ * });
273
+ * await logger.audit('user exported data', { userId: 'u1' });
274
+ * ```
275
+ */
254
276
  declare function createLogger<T extends LoggerConfig<Record<string, number>>>(config: T, context?: string): LoggerWithLevels<T>;
255
- //#endregion
256
- 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
277
+ export { createLogger as n, LogixiaLogger as t };
278
+ //# sourceMappingURL=logitron-logger-D22Yb61K.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logitron-logger-D22Yb61K.d.mts","names":[],"sources":["../src/core/logitron-logger.ts"],"mappings":";;;;;;;;;;;;;;cAyLa,cACX,gBAAgB,aAAa,0BAA0B,yBAC5C;GAEV;UAEO;UACA;UACA;UACA;UACA;UACA;;mBAGS;;UAIT;;UAEA;;UAEA;;mBAES;;UAET;;UAEA;;UAEA;;;;;UAKA;;UAEA;;UAEA;;UAEA;;mBAES;;mBAEA;;mBAEA;;UAET;EAEI,YAAA,QAAQ,SAAS,kBAAkB,SAAS,cAAc;UA4G9D;UAiBA;;;;;UAsBA;;;;;;EA2HF,MAAM,yBAAyB,OAAO,OAAO,0BAA0B;;EAYvE,KAAK,iBAAiB,OAAO,0BAA0B;;EAKvD,KAAK,iBAAiB,OAAO,0BAA0B;;EAKvD,MAAM,iBAAiB,OAAO,0BAA0B;;EAKxD,MAAM,iBAAiB,OAAO,0BAA0B;;EAKxD,QAAQ,iBAAiB,OAAO,0BAA0B;;;;;;EAS1D,SAAS,eAAe,iBAAiB,OAAO,0BAA0B;;EAOhF,KAAK;;;;;;;;;;;;;EAgBC,QAAQ,gBAAgB;EAmBxB,UAAU,GAAG,eAAe,UAAU,QAAQ,KAAK,QAAQ;;;;;;;;;;;;EAyBjE,SAAS,OAAO;;;;;;EAuBhB,YAAY;UAIJ;;;;;UAQA;;;;;;;;;;;;;;;;;;;EAkCR,mBAAmB,QAAQ;;EAS3B,qBAAqB,QAAQ;;EAO7B,sBAAsB;UAId;;EAMR,WAAW;;EAKX;;EAOA,YAAY;;EASZ,aAAa;;EASb,eAAe;;EASf,iBAAiB;;EAmBjB;;EAQA;;EAMA;;EAMA,mBAAmB,qBAAqB;;EAMxC,mBAAmB;EAMnB;;EAMA;;;;;;;;;;;;;EAkBA,MAAM,iBAAiB,OAAO,0BAA0B;;;;;;;;;;;;EA0BxD,IAAI,QAAQ;;;;;EASZ,MAAM;;EAQA,SAAS;;EAKT,eAAe;IAAU;IAAkB,SAAS;;;;;;;;;;;;;;;;EAqBpD,SAAS;UAsBD;;;;;UA8GN;;;;;;;;;;;UAgBA;UAwCA;UAgDA;;;;;;;;UAcA;;;UAuBM;;;;;;;;;;;;;;;;;;iBA+BA,aAAa,UAAU,aAAa,yBAClD,QAAQ,GACR,mBACC,iBAAiB"}