logixia 1.13.3 → 2.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (229) hide show
  1. package/README.md +117 -44
  2. package/dist/async-context-B05ArHgM.mjs +134 -0
  3. package/dist/async-context-B05ArHgM.mjs.map +1 -0
  4. package/dist/async-context-DTQgi8f7.js +150 -0
  5. package/dist/async-context-DTQgi8f7.js.map +1 -0
  6. package/dist/{azure-monitor.transport-CHnjVRF-.mjs → azure-monitor.transport-BPbgjATu.mjs} +27 -15
  7. package/dist/azure-monitor.transport-BPbgjATu.mjs.map +1 -0
  8. package/dist/{azure-monitor.transport-BDFO4F-i.d.ts → azure-monitor.transport-C7kYyZUW.d.mts} +3 -6
  9. package/dist/azure-monitor.transport-C7kYyZUW.d.mts.map +1 -0
  10. package/dist/{azure-monitor.transport-CrvfHd9C.js → azure-monitor.transport-CwbOLZHB.js} +32 -20
  11. package/dist/azure-monitor.transport-CwbOLZHB.js.map +1 -0
  12. package/dist/{azure-monitor.transport-D5wQEH04.d.mts → azure-monitor.transport-DV03Z5P4.d.ts} +3 -6
  13. package/dist/azure-monitor.transport-DV03Z5P4.d.ts.map +1 -0
  14. package/dist/azure.d.mts +1 -2
  15. package/dist/azure.d.ts +1 -2
  16. package/dist/azure.js +3 -6
  17. package/dist/azure.mjs +1 -6
  18. package/dist/{batch-buffer-PGvSgbmd.mjs → batch-buffer-0fgLmIPn.mjs} +21 -7
  19. package/dist/batch-buffer-0fgLmIPn.mjs.map +1 -0
  20. package/dist/{batch-buffer-BY-mRWIK.js → batch-buffer-DT4gdXmf.js} +53 -40
  21. package/dist/batch-buffer-DT4gdXmf.js.map +1 -0
  22. package/dist/browser.d.mts +52 -23
  23. package/dist/browser.d.mts.map +1 -1
  24. package/dist/browser.d.ts +52 -23
  25. package/dist/browser.d.ts.map +1 -1
  26. package/dist/browser.js +460 -62
  27. package/dist/browser.js.map +1 -1
  28. package/dist/browser.mjs +461 -65
  29. package/dist/browser.mjs.map +1 -1
  30. package/dist/{nestjs-extras-ImbuDhs1.mjs → builder-D70z6kjj.mjs} +279 -965
  31. package/dist/builder-D70z6kjj.mjs.map +1 -0
  32. package/dist/{nestjs-extras-DnJ6vrIC.js → builder-M7NoaugM.js} +421 -1177
  33. package/dist/builder-M7NoaugM.js.map +1 -0
  34. package/dist/cli/index.js +86 -67
  35. package/dist/cloudwatch.d.mts +1 -2
  36. package/dist/cloudwatch.d.ts +1 -2
  37. package/dist/cloudwatch.js +3 -7
  38. package/dist/cloudwatch.mjs +1 -7
  39. package/dist/{cloudwatch.transport-BO1ahxw-.js → cloudwatch.transport-B2wKQFF7.js} +61 -36
  40. package/dist/cloudwatch.transport-B2wKQFF7.js.map +1 -0
  41. package/dist/{cloudwatch.transport-DZ6ies7g.mjs → cloudwatch.transport-BTvYfLs9.mjs} +54 -28
  42. package/dist/cloudwatch.transport-BTvYfLs9.mjs.map +1 -0
  43. package/dist/{cloudwatch.transport-B00st6Xv.d.ts → cloudwatch.transport-Bf7L4I59.d.ts} +2 -6
  44. package/dist/cloudwatch.transport-Bf7L4I59.d.ts.map +1 -0
  45. package/dist/{cloudwatch.transport-Blc7Gtxt.d.mts → cloudwatch.transport-Rj4yTpRn.d.mts} +2 -6
  46. package/dist/cloudwatch.transport-Rj4yTpRn.d.mts.map +1 -0
  47. package/dist/{coerce.utils-Cu6IUTgX.mjs → coerce.utils-B_rEudCn.mjs} +3 -4
  48. package/dist/{coerce.utils-Cu6IUTgX.mjs.map → coerce.utils-B_rEudCn.mjs.map} +1 -1
  49. package/dist/{coerce.utils-B-LilukN.js → coerce.utils-C1C5sIX0.js} +8 -10
  50. package/dist/{coerce.utils-B-LilukN.js.map → coerce.utils-C1C5sIX0.js.map} +1 -1
  51. package/dist/correlation.d.mts +13 -16
  52. package/dist/correlation.d.mts.map +1 -1
  53. package/dist/correlation.d.ts +13 -16
  54. package/dist/correlation.d.ts.map +1 -1
  55. package/dist/correlation.js +58 -9
  56. package/dist/correlation.js.map +1 -1
  57. package/dist/correlation.mjs +56 -6
  58. package/dist/correlation.mjs.map +1 -1
  59. package/dist/{entry-fields-BJkuPnIg.mjs → entry-fields-CGuvT2R0.mjs} +5 -6
  60. package/dist/entry-fields-CGuvT2R0.mjs.map +1 -0
  61. package/dist/{entry-fields-BvOLFlJ4.js → entry-fields-RLd1jCoR.js} +10 -12
  62. package/dist/entry-fields-RLd1jCoR.js.map +1 -0
  63. package/dist/gcp.d.mts +1 -2
  64. package/dist/gcp.d.ts +1 -2
  65. package/dist/gcp.js +3 -7
  66. package/dist/gcp.mjs +1 -7
  67. package/dist/{gcp.transport-m4fVw0b1.d.ts → gcp.transport-C5D72b1g.d.mts} +3 -6
  68. package/dist/gcp.transport-C5D72b1g.d.mts.map +1 -0
  69. package/dist/{gcp.transport-zzNyIoih.d.mts → gcp.transport-CFQfdAOK.d.ts} +3 -6
  70. package/dist/gcp.transport-CFQfdAOK.d.ts.map +1 -0
  71. package/dist/{gcp.transport-DBX5TPIy.mjs → gcp.transport-CGKopAhQ.mjs} +55 -16
  72. package/dist/gcp.transport-CGKopAhQ.mjs.map +1 -0
  73. package/dist/{gcp.transport-CHV8MGgz.js → gcp.transport-KZe9hCAR.js} +60 -22
  74. package/dist/gcp.transport-KZe9hCAR.js.map +1 -0
  75. package/dist/{index-nZEeCr3X.d.ts → index-DwozbmB4.d.ts} +3 -8
  76. package/dist/index-DwozbmB4.d.ts.map +1 -0
  77. package/dist/{index-BPwEisy4.d.mts → index-xqaJtAZn.d.mts} +3 -8
  78. package/dist/index-xqaJtAZn.d.mts.map +1 -0
  79. package/dist/index.d.mts +141 -203
  80. package/dist/index.d.mts.map +1 -1
  81. package/dist/index.d.ts +140 -202
  82. package/dist/index.d.ts.map +1 -1
  83. package/dist/index.js +196 -381
  84. package/dist/index.js.map +1 -1
  85. package/dist/index.mjs +145 -294
  86. package/dist/index.mjs.map +1 -1
  87. package/dist/internal-log-b0Vp4qrB.js +183 -0
  88. package/dist/internal-log-b0Vp4qrB.js.map +1 -0
  89. package/dist/internal-log-uCSd1PMc.mjs +142 -0
  90. package/dist/internal-log-uCSd1PMc.mjs.map +1 -0
  91. package/dist/logitron-logger-D2B75Oc7.d.ts +365 -0
  92. package/dist/logitron-logger-D2B75Oc7.d.ts.map +1 -0
  93. package/dist/logitron-logger-oEd6wNhf.d.mts +365 -0
  94. package/dist/logitron-logger-oEd6wNhf.d.mts.map +1 -0
  95. package/dist/middleware.d.mts +10 -12
  96. package/dist/middleware.d.mts.map +1 -1
  97. package/dist/middleware.d.ts +10 -12
  98. package/dist/middleware.d.ts.map +1 -1
  99. package/dist/middleware.js +16 -47
  100. package/dist/middleware.js.map +1 -1
  101. package/dist/middleware.mjs +13 -45
  102. package/dist/middleware.mjs.map +1 -1
  103. package/dist/nest.d.mts +467 -10
  104. package/dist/nest.d.mts.map +1 -1
  105. package/dist/nest.d.ts +467 -10
  106. package/dist/nest.d.ts.map +1 -1
  107. package/dist/nest.js +889 -43
  108. package/dist/nest.js.map +1 -0
  109. package/dist/nest.mjs +850 -9
  110. package/dist/nest.mjs.map +1 -0
  111. package/dist/{trace.utils-CvXgaiQT.mjs → request-trace-C_fvIDv4.mjs} +44 -9
  112. package/dist/request-trace-C_fvIDv4.mjs.map +1 -0
  113. package/dist/{trace.utils-DpBOLDtq.js → request-trace-wTJdKp6-.js} +121 -77
  114. package/dist/request-trace-wTJdKp6-.js.map +1 -0
  115. package/dist/rolldown-runtime-D3PmRqjj.mjs +4 -0
  116. package/dist/{safe-stringify-DJ66tW5I.mjs → safe-stringify-BMRl3EX3.mjs} +3 -4
  117. package/dist/safe-stringify-BMRl3EX3.mjs.map +1 -0
  118. package/dist/{safe-stringify-DWo3aZp_.js → safe-stringify-DLz1Kz3o.js} +23 -25
  119. package/dist/safe-stringify-DLz1Kz3o.js.map +1 -0
  120. package/dist/{search-CHUZPl0h.d.ts → search-BH33XhuU.d.mts} +2 -22
  121. package/dist/search-BH33XhuU.d.mts.map +1 -0
  122. package/dist/{search-DjXSn6v5.mjs → search-CWMVYC-R.mjs} +34 -41
  123. package/dist/search-CWMVYC-R.mjs.map +1 -0
  124. package/dist/{search-BfBzDIT9.d.mts → search-CazwyX5Z.d.ts} +2 -22
  125. package/dist/search-CazwyX5Z.d.ts.map +1 -0
  126. package/dist/{search-B0MH1SJJ.js → search-DUfWuzFP.js} +64 -71
  127. package/dist/search-DUfWuzFP.js.map +1 -0
  128. package/dist/search.d.mts +2 -4
  129. package/dist/search.d.ts +2 -4
  130. package/dist/search.js +3 -4
  131. package/dist/search.mjs +1 -4
  132. package/dist/secret-config-BegMLkYl.mjs +209 -0
  133. package/dist/secret-config-BegMLkYl.mjs.map +1 -0
  134. package/dist/secret-config-CBZBs0p1.js +271 -0
  135. package/dist/secret-config-CBZBs0p1.js.map +1 -0
  136. package/dist/slack.transport-Ce96JBDk.mjs +824 -0
  137. package/dist/slack.transport-Ce96JBDk.mjs.map +1 -0
  138. package/dist/slack.transport-Dlx3xvb7.js +847 -0
  139. package/dist/slack.transport-Dlx3xvb7.js.map +1 -0
  140. package/dist/slack.transport-DrirgDNy.d.ts +159 -0
  141. package/dist/slack.transport-DrirgDNy.d.ts.map +1 -0
  142. package/dist/slack.transport-DxHOXlLu.d.mts +159 -0
  143. package/dist/slack.transport-DxHOXlLu.d.mts.map +1 -0
  144. package/dist/testing.d.mts +3 -8
  145. package/dist/testing.d.mts.map +1 -1
  146. package/dist/testing.d.ts +3 -8
  147. package/dist/testing.d.ts.map +1 -1
  148. package/dist/testing.js +3 -4
  149. package/dist/testing.js.map +1 -1
  150. package/dist/testing.mjs +2 -3
  151. package/dist/testing.mjs.map +1 -1
  152. package/dist/{transport.manager-Crau3Rle.js → transport.manager-DkcEOlqV.js} +331 -234
  153. package/dist/transport.manager-DkcEOlqV.js.map +1 -0
  154. package/dist/{transport.manager-CpdVHEGP.mjs → transport.manager-eZ_EeC00.mjs} +274 -178
  155. package/dist/transport.manager-eZ_EeC00.mjs.map +1 -0
  156. package/dist/{transport.types-CtNr3D7S.d.mts → transport.types-BJVL1QQl.d.mts} +5 -4
  157. package/dist/transport.types-BJVL1QQl.d.mts.map +1 -0
  158. package/dist/{transport.types-DqVLZTyf.d.ts → transport.types-BJVL1QQl.d.ts} +5 -4
  159. package/dist/transport.types-BJVL1QQl.d.ts.map +1 -0
  160. package/dist/transports.d.mts +32 -41
  161. package/dist/transports.d.mts.map +1 -1
  162. package/dist/transports.d.ts +32 -41
  163. package/dist/transports.d.ts.map +1 -1
  164. package/dist/transports.js +12 -12
  165. package/dist/transports.mjs +7 -12
  166. package/dist/worker-entry.js +337 -87
  167. package/dist/worker.d.mts +1 -2
  168. package/dist/worker.d.ts +1 -2
  169. package/dist/worker.js +3 -4
  170. package/dist/worker.mjs +1 -4
  171. package/dist/{worker.transport-Bj-i0P9V.d.ts → worker.transport-BuPwBi3d.d.ts} +2 -6
  172. package/dist/worker.transport-BuPwBi3d.d.ts.map +1 -0
  173. package/dist/{worker.transport-JP8YHBuU.js → worker.transport-C6GNl_r2.js} +44 -14
  174. package/dist/worker.transport-C6GNl_r2.js.map +1 -0
  175. package/dist/{worker.transport-otwhJ_Et.mjs → worker.transport-DLVA4y2e.mjs} +39 -9
  176. package/dist/worker.transport-DLVA4y2e.mjs.map +1 -0
  177. package/dist/{worker.transport-Bgv9heDI.d.mts → worker.transport-hJay1wxA.d.mts} +2 -6
  178. package/dist/worker.transport-hJay1wxA.d.mts.map +1 -0
  179. package/package.json +36 -19
  180. package/dist/async-context-BzJrbfQs.mjs +0 -72
  181. package/dist/async-context-BzJrbfQs.mjs.map +0 -1
  182. package/dist/async-context-DyQQYq3I.js +0 -92
  183. package/dist/async-context-DyQQYq3I.js.map +0 -1
  184. package/dist/azure-monitor.transport-BDFO4F-i.d.ts.map +0 -1
  185. package/dist/azure-monitor.transport-CHnjVRF-.mjs.map +0 -1
  186. package/dist/azure-monitor.transport-CrvfHd9C.js.map +0 -1
  187. package/dist/azure-monitor.transport-D5wQEH04.d.mts.map +0 -1
  188. package/dist/batch-buffer-BY-mRWIK.js.map +0 -1
  189. package/dist/batch-buffer-PGvSgbmd.mjs.map +0 -1
  190. package/dist/chunk-DLSkYcPk.mjs +0 -7
  191. package/dist/chunk-nOFOJqeH.js +0 -30
  192. package/dist/cloudwatch.transport-B00st6Xv.d.ts.map +0 -1
  193. package/dist/cloudwatch.transport-BO1ahxw-.js.map +0 -1
  194. package/dist/cloudwatch.transport-Blc7Gtxt.d.mts.map +0 -1
  195. package/dist/cloudwatch.transport-DZ6ies7g.mjs.map +0 -1
  196. package/dist/entry-fields-BJkuPnIg.mjs.map +0 -1
  197. package/dist/entry-fields-BvOLFlJ4.js.map +0 -1
  198. package/dist/gcp.transport-CHV8MGgz.js.map +0 -1
  199. package/dist/gcp.transport-DBX5TPIy.mjs.map +0 -1
  200. package/dist/gcp.transport-m4fVw0b1.d.ts.map +0 -1
  201. package/dist/gcp.transport-zzNyIoih.d.mts.map +0 -1
  202. package/dist/index-BPwEisy4.d.mts.map +0 -1
  203. package/dist/index-nZEeCr3X.d.ts.map +0 -1
  204. package/dist/internal-log-BUJYMZbE.js +0 -70
  205. package/dist/internal-log-BUJYMZbE.js.map +0 -1
  206. package/dist/internal-log-Cm8SOWSV.mjs +0 -52
  207. package/dist/internal-log-Cm8SOWSV.mjs.map +0 -1
  208. package/dist/nestjs-extras-DnJ6vrIC.js.map +0 -1
  209. package/dist/nestjs-extras-ImbuDhs1.mjs.map +0 -1
  210. package/dist/nestjs-extras-OkC796py.d.mts +0 -725
  211. package/dist/nestjs-extras-OkC796py.d.mts.map +0 -1
  212. package/dist/nestjs-extras-mKrHE9S6.d.ts +0 -725
  213. package/dist/nestjs-extras-mKrHE9S6.d.ts.map +0 -1
  214. package/dist/safe-stringify-DJ66tW5I.mjs.map +0 -1
  215. package/dist/safe-stringify-DWo3aZp_.js.map +0 -1
  216. package/dist/search-B0MH1SJJ.js.map +0 -1
  217. package/dist/search-BfBzDIT9.d.mts.map +0 -1
  218. package/dist/search-CHUZPl0h.d.ts.map +0 -1
  219. package/dist/search-DjXSn6v5.mjs.map +0 -1
  220. package/dist/trace.utils-CvXgaiQT.mjs.map +0 -1
  221. package/dist/trace.utils-DpBOLDtq.js.map +0 -1
  222. package/dist/transport.manager-CpdVHEGP.mjs.map +0 -1
  223. package/dist/transport.manager-Crau3Rle.js.map +0 -1
  224. package/dist/transport.types-CtNr3D7S.d.mts.map +0 -1
  225. package/dist/transport.types-DqVLZTyf.d.ts.map +0 -1
  226. package/dist/worker.transport-Bgv9heDI.d.mts.map +0 -1
  227. package/dist/worker.transport-Bj-i0P9V.d.ts.map +0 -1
  228. package/dist/worker.transport-JP8YHBuU.js.map +0 -1
  229. package/dist/worker.transport-otwhJ_Et.mjs.map +0 -1
package/dist/index.d.mts CHANGED
@@ -1,12 +1,46 @@
1
- import { p as TransportLogEntry, s as IAsyncTransport } from "./transport.types-CtNr3D7S.mjs";
2
- import { A as HttpResponse, C as RequestContext, D as TraceIdExtractorConfig, E as TraceIdConfig, M as RequestTiming, O as HttpError, S as RedactConfig, T as TimingEntry, _ as LogLevel, a as DEFAULT_LOG_LEVELS, b as LoggerWithLevels, c as ExtractLevels, d as ILogFormatter, f as ILogger, g as LogFieldKey, h as LogEntry, i as DEFAULT_LOG_COLORS, j as RequestMetrics, k as HttpRequest, l as GracefulShutdownConfig, m as LogColor, n as ContextData, o as Environment, p as ILoggerDefault, r as CustomLevelMethods, s as ErrorSerializationOptions, t as AdaptiveSamplingConfig, u as IBaseLogger, v as LogLevelString, w as SamplingConfig, x as NamespaceLevels, y as LoggerConfig } from "./index-BPwEisy4.mjs";
3
- import { C as usePlugin, S as globalPluginRegistry, _ as LogixiaServiceWithLevels, a as LogixiaExceptionFilter, b as LogixiaPlugin, c as LOGIXIA_LOGGER_PREFIX, d as LogixiaLoggerModule, f as LogixiaOptionsFactory, g as LogixiaServiceWith, h as LogixiaLoggerService, i as LogMethodOptions, l as LOGIXIA_TRACE_CONFIG, m as KafkaTraceInterceptor, n as LOGIXIA_EXCEPTION_FILTER_OPTIONS, o as LogixiaExceptionFilterOptions, p as WebSocketTraceInterceptor, r as LogMethod, s as LOGIXIA_LOGGER_CONFIG, t as InjectLogger, u as LogixiaAsyncOptions, v as LogixiaLogger, x as PluginRegistry, y as createLogger$1 } from "./nestjs-extras-OkC796py.mjs";
4
- import { A as SearchStats, C as SearchFilters, D as SearchPreset, E as SearchOptions, F as SuggestionType, I as TimeRange, L as TimelineEvent, M as SemanticIndex, N as SimilarLog, O as SearchQuery, P as SortField, S as RelativeTime, T as SearchMatch, _ as ParsedNLQuery, a as ILogSearchEngine, b as RelatedLog, c as SearchManager, d as CorrelatedLogs, f as EntityType, g as LogPattern, h as LogCorrelationSummary, i as BasicSearchEngine, j as SearchSuggestion, k as SearchResult, l as SearchManagerConfig, m as LogCluster, n as NLPSearchEngine, o as BasicLogIndexer, p as ExportOptions, r as CorrelationEngine, s as ILogIndexer, t as PatternRecognitionEngine, u as AnomalyDetection, v as QueryEntity, w as SearchHighlight, x as RelationshipType, y as QueryIntent } from "./search-BfBzDIT9.mjs";
5
- import { IncomingMessage, ServerResponse } from "node:http";
1
+ import { A as HttpResponse, C as RequestContext, D as TraceIdExtractorConfig, E as TraceIdConfig, M as RequestTiming, O as HttpError, S as RedactConfig, T as TimingEntry, _ as LogLevel, a as DEFAULT_LOG_LEVELS, b as LoggerWithLevels, c as ExtractLevels, d as ILogFormatter, f as ILogger, g as LogFieldKey, h as LogEntry, i as DEFAULT_LOG_COLORS, j as RequestMetrics, k as HttpRequest, l as GracefulShutdownConfig, m as LogColor, n as ContextData, o as Environment, p as ILoggerDefault, r as CustomLevelMethods, s as ErrorSerializationOptions, t as AdaptiveSamplingConfig, u as IBaseLogger, v as LogLevelString, w as SamplingConfig, x as NamespaceLevels, y as LoggerConfig } from "./index-xqaJtAZn.mjs";
2
+ import { a as globalPluginRegistry, i as PluginRegistry, n as createLogger$1, o as usePlugin, r as LogixiaPlugin, t as LogixiaLogger } from "./logitron-logger-oEd6wNhf.mjs";
3
+ import { a as DiscordTransport, c as OtlpLogTransportConfig, i as DiscordEmbed, l as toOtelSeverity, n as SlackTransport, o as DiscordTransportConfig, r as SlackTransportConfig, s as OtlpLogTransport, t as SlackMessage } from "./slack.transport-DxHOXlLu.mjs";
4
+ import { A as SearchStats, C as SearchFilters, D as SearchPreset, E as SearchOptions, F as SuggestionType, I as TimeRange, L as TimelineEvent, M as SemanticIndex, N as SimilarLog, O as SearchQuery, P as SortField, S as RelativeTime, T as SearchMatch, _ as ParsedNLQuery, a as ILogSearchEngine, b as RelatedLog, c as SearchManager, d as CorrelatedLogs, f as EntityType, g as LogPattern, h as LogCorrelationSummary, i as BasicSearchEngine, j as SearchSuggestion, k as SearchResult, l as SearchManagerConfig, m as LogCluster, n as NLPSearchEngine, o as BasicLogIndexer, p as ExportOptions, r as CorrelationEngine, s as ILogIndexer, t as PatternRecognitionEngine, u as AnomalyDetection, v as QueryEntity, w as SearchHighlight, x as RelationshipType, y as QueryIntent } from "./search-BH33XhuU.mjs";
6
5
  import { AsyncLocalStorage } from "node:async_hooks";
7
-
8
- //#region src/formatters/json.formatter.d.ts
9
- declare class JsonFormatter implements ILogFormatter {
6
+ import { IncomingMessage, ServerResponse } from "node:http";
7
+ /**
8
+ * Default configuration for Logixia logger
9
+ */
10
+ export declare const DEFAULT_CONFIG: {
11
+ appName: string;
12
+ environment: Environment;
13
+ traceId: boolean;
14
+ format: {
15
+ timestamp: boolean;
16
+ colorize: boolean;
17
+ json: boolean;
18
+ };
19
+ silent: boolean;
20
+ levelOptions: {
21
+ level: "info";
22
+ levels: {
23
+ error: number;
24
+ warn: number;
25
+ info: number;
26
+ debug: number;
27
+ trace: number;
28
+ verbose: number;
29
+ };
30
+ colors: Record<string, LogColor>;
31
+ };
32
+ fields: {
33
+ timestamp: boolean;
34
+ level: boolean;
35
+ appName: boolean;
36
+ traceId: boolean;
37
+ message: boolean;
38
+ payload: boolean;
39
+ timeTaken: boolean;
40
+ };
41
+ outputs: string[];
42
+ };
43
+ export declare class JsonFormatter implements ILogFormatter {
10
44
  private includeTimestamp;
11
45
  private includeLevel;
12
46
  private includeAppName;
@@ -24,9 +58,7 @@ declare class JsonFormatter implements ILogFormatter {
24
58
  format(entry: LogEntry): string;
25
59
  private serializePayload;
26
60
  }
27
- //#endregion
28
- //#region src/formatters/text.formatter.d.ts
29
- declare class TextFormatter implements ILogFormatter {
61
+ export declare class TextFormatter implements ILogFormatter {
30
62
  private colorize;
31
63
  private includeTimestamp;
32
64
  private includeAppName;
@@ -53,8 +85,6 @@ declare class TextFormatter implements ILogFormatter {
53
85
  static createDetailed(): TextFormatter;
54
86
  static createMinimal(): TextFormatter;
55
87
  }
56
- //#endregion
57
- //#region src/utils/error.utils.d.ts
58
88
  /**
59
89
  * Serialize an Error into a plain JSON-safe object, including:
60
90
  * - `name`, `message`, `stack`
@@ -63,17 +93,15 @@ declare class TextFormatter implements ILogFormatter {
63
93
  * - standard Node.js error fields (`code`, `statusCode`, `errno`, …)
64
94
  * - any other enumerable own properties
65
95
  */
66
- declare function serializeError(error: Error, options?: ErrorSerializationOptions): Record<string, unknown>;
96
+ export declare function serializeError(error: Error, options?: ErrorSerializationOptions): Record<string, unknown>;
67
97
  /**
68
98
  * Type guard: returns true if the value looks like an Error object.
69
99
  */
70
- declare function isError(value: unknown): value is Error;
100
+ export declare function isError(value: unknown): value is Error;
71
101
  /**
72
102
  * Coerce any thrown value into a proper Error instance.
73
103
  */
74
- declare function normalizeError(error: unknown): Error;
75
- //#endregion
76
- //#region src/utils/otel.d.ts
104
+ export declare function normalizeError(error: unknown): Error;
77
105
  /**
78
106
  * logixia — OpenTelemetry auto trace-log correlation
79
107
  *
@@ -150,7 +178,7 @@ interface OtelBridgeOptions {
150
178
  * - No active span exists (root context)
151
179
  * - The span context is invalid (all-zeros)
152
180
  */
153
- declare function getActiveOtelContext(opts?: OtelBridgeOptions): OtelSpanContext | undefined;
181
+ export declare function getActiveOtelContext(opts?: OtelBridgeOptions): OtelSpanContext | undefined;
154
182
  /**
155
183
  * Returns a metadata object with OTel context fields ready to merge into a log call,
156
184
  * using the configured field names.
@@ -165,7 +193,7 @@ declare function getActiveOtelContext(opts?: OtelBridgeOptions): OtelSpanContext
165
193
  * });
166
194
  * ```
167
195
  */
168
- declare function getOtelMetaFields(opts?: OtelBridgeOptions): Record<string, unknown>;
196
+ export declare function getOtelMetaFields(opts?: OtelBridgeOptions): Record<string, unknown>;
169
197
  /**
170
198
  * Initialise the global OTel bridge.
171
199
  *
@@ -179,26 +207,22 @@ declare function getOtelMetaFields(opts?: OtelBridgeOptions): Record<string, unk
179
207
  * initOtelBridge();
180
208
  * ```
181
209
  */
182
- declare function initOtelBridge(opts?: OtelBridgeOptions): void;
210
+ export declare function initOtelBridge(opts?: OtelBridgeOptions): void;
183
211
  /**
184
212
  * Disable the OTel bridge (useful for tests).
185
213
  */
186
- declare function disableOtelBridge(): void;
187
- //#endregion
188
- //#region src/utils/redact.utils.d.ts
214
+ export declare function disableOtelBridge(): void;
189
215
  /**
190
216
  * Redact an object according to the given RedactConfig and return a new
191
217
  * top-level object. Subtrees with nothing to redact are shared with the input,
192
218
  * never mutated. Circular references become `[Circular]`.
193
219
  */
194
- declare function redactObject(obj: Record<string, unknown>, config: RedactConfig, _currentPath?: string): Record<string, unknown>;
220
+ export declare function redactObject(obj: Record<string, unknown>, config: RedactConfig, _currentPath?: string): Record<string, unknown>;
195
221
  /**
196
222
  * Apply redaction to a log payload (top-level call convenience wrapper).
197
223
  * Returns a new object — never mutates the input.
198
224
  */
199
- declare function applyRedaction(payload: Record<string, unknown> | undefined, config: RedactConfig | undefined): Record<string, unknown> | undefined;
200
- //#endregion
201
- //#region src/utils/runtime-control.d.ts
225
+ export declare function applyRedaction(payload: Record<string, unknown> | undefined, config: RedactConfig | undefined): Record<string, unknown> | undefined;
202
226
  /** Minimal logger surface the runtime controls need. */
203
227
  interface ReconfigurableLogger {
204
228
  getLevel(): LogLevelString;
@@ -220,7 +244,7 @@ interface LevelSignalOptions {
220
244
  * memorizable command (`kill -USR2 <pid>`) is enough to ratchet verbosity up
221
245
  * while chasing a bug and back down again — no value to remember.
222
246
  */
223
- declare function registerLevelSignal(logger: ReconfigurableLogger, options?: LevelSignalOptions): () => void;
247
+ export declare function registerLevelSignal(logger: ReconfigurableLogger, options?: LevelSignalOptions): () => void;
224
248
  interface MinimalReq {
225
249
  method?: string | undefined;
226
250
  headers?: Record<string, string | string[] | undefined> | undefined;
@@ -251,11 +275,9 @@ interface MinimalRes {
251
275
  * which also keeps cross-site form posts out) and a body of at most 16 KB
252
276
  * (otherwise 413).
253
277
  */
254
- declare function createLevelControlHandler(logger: ReconfigurableLogger, options?: {
278
+ export declare function createLevelControlHandler(logger: ReconfigurableLogger, options?: {
255
279
  allowedLevels?: string[];
256
280
  }): (req: MinimalReq, res: MinimalRes) => void;
257
- //#endregion
258
- //#region src/utils/safe-stringify.d.ts
259
281
  /**
260
282
  * logixia — robust JSON serialization for log payloads.
261
283
  *
@@ -295,27 +317,25 @@ interface SafeStringifyOptions {
295
317
  * Serialize any value to JSON without throwing on circular references or BigInt.
296
318
  * Circular refs become `"[Circular]"` (or `{ $ref }` pointers when `decycle`).
297
319
  */
298
- declare function safeStringify(value: unknown, options?: SafeStringifyOptions): string;
320
+ export declare function safeStringify(value: unknown, options?: SafeStringifyOptions): string;
299
321
  /**
300
322
  * Replace repeated object references with round-trippable `{ "$ref": "$..." }`
301
323
  * JSONPath pointers (the classic Crockford decycle). Pair with {@link retrocycle}
302
324
  * to reconstruct the original shared/circular graph.
303
325
  */
304
- declare function decycleValue(value: unknown, bigint?: 'string' | 'number'): unknown;
326
+ export declare function decycleValue(value: unknown, bigint?: 'string' | 'number'): unknown;
305
327
  /**
306
328
  * Inverse of {@link decycleValue}: resolve `{ "$ref": "$..." }` pointers back
307
329
  * into the live object graph (mutates and returns the parsed input).
308
330
  */
309
- declare function retrocycle<T>(root: T): T;
331
+ export declare function retrocycle<T>(root: T): T;
310
332
  /**
311
333
  * `JSON.stringify` for log output. Takes the plain fast path first and only
312
334
  * falls back to {@link safeStringify} when that throws (a cycle, a BigInt, a
313
335
  * throwing `toJSON`), so a bad payload costs nothing until it shows up.
314
336
  * Never throws: if even the safe walk fails, the value is replaced by a marker.
315
337
  */
316
- declare function stringifyForLog(value: unknown): string;
317
- //#endregion
318
- //#region src/utils/shutdown.utils.d.ts
338
+ export declare function stringifyForLog(value: unknown): string;
319
339
  /**
320
340
  * Graceful shutdown utilities for Logixia
321
341
  *
@@ -323,8 +343,8 @@ declare function stringifyForLog(value: unknown): string;
323
343
  * exits on SIGTERM / SIGINT — solving the "last N seconds of logs are lost on
324
344
  * deployment" problem reported in Pino issue #2002 and LogDNA issue #15.
325
345
  */
326
- type ExitMode = 'auto' | 'always' | 'never';
327
- interface FlushOnExitOptions {
346
+ export type ExitMode = 'auto' | 'always' | 'never';
347
+ export interface FlushOnExitOptions {
328
348
  /** How long (ms) to wait for transports to flush before force-exiting. Default: 5000 */
329
349
  timeout?: number;
330
350
  /** OS signals that trigger a graceful flush. Default: ['SIGTERM', 'SIGINT'] */
@@ -353,12 +373,12 @@ type Closeable = {
353
373
  * Called automatically when `gracefulShutdown: true` is set in logger config.
354
374
  */
355
375
  /** Test helper: number of loggers currently registered for graceful shutdown. */
356
- declare function _shutdownRegistrySize(): number;
357
- declare function registerForShutdown(logger: Closeable): void;
376
+ export declare function _shutdownRegistrySize(): number;
377
+ export declare function registerForShutdown(logger: Closeable): void;
358
378
  /**
359
379
  * Deregister a logger (e.g. after `logger.close()` is called manually).
360
380
  */
361
- declare function deregisterFromShutdown(logger: Closeable): void;
381
+ export declare function deregisterFromShutdown(logger: Closeable): void;
362
382
  /**
363
383
  * Register SIGTERM / SIGINT handlers that flush all registered loggers before
364
384
  * the process exits. Idempotent — the first call wins and later calls with
@@ -373,16 +393,14 @@ declare function deregisterFromShutdown(logger: Closeable): void;
373
393
  * flushOnExit({ timeout: 5000 });
374
394
  * ```
375
395
  */
376
- declare function flushOnExit(options?: FlushOnExitOptions): void;
396
+ export declare function flushOnExit(options?: FlushOnExitOptions): void;
377
397
  /**
378
398
  * Remove all graceful shutdown handlers and clear the registry.
379
399
  * Primarily useful in tests.
380
400
  */
381
- declare function resetShutdownHandlers(): void;
382
- //#endregion
383
- //#region src/utils/trace.utils.d.ts
401
+ export declare function resetShutdownHandlers(): void;
384
402
  /** Default key used to store the trace ID in AsyncLocalStorage. */
385
- declare const TRACE_CONTEXT_KEY: "traceId";
403
+ export declare const TRACE_CONTEXT_KEY: "traceId";
386
404
  /**
387
405
  * Singleton that owns the AsyncLocalStorage and the active contextKey.
388
406
  *
@@ -398,7 +416,7 @@ declare const TRACE_CONTEXT_KEY: "traceId";
398
416
  * TraceContext.instance.contextKey // → 'traceId' (or custom)
399
417
  * TraceContext.instance.getCurrentTraceId() // same as standalone fn
400
418
  */
401
- declare class TraceContext {
419
+ export declare class TraceContext {
402
420
  private static _instance;
403
421
  readonly storage: AsyncLocalStorage<Record<string, unknown>>;
404
422
  private _contextKey;
@@ -440,16 +458,16 @@ declare class TraceContext {
440
458
  * The shared AsyncLocalStorage instance.
441
459
  * @deprecated Prefer `TraceContext.instance.storage` for new code.
442
460
  */
443
- declare const traceStorage: AsyncLocalStorage<Record<string, unknown>>;
461
+ export declare const traceStorage: AsyncLocalStorage<Record<string, unknown>>;
444
462
  /** Returns the key currently used to store the trace ID in AsyncLocalStorage. */
445
- declare function getTraceContextKey(): string;
463
+ export declare function getTraceContextKey(): string;
446
464
  /** @internal Called by TraceMiddleware / traceMiddleware() when they boot. */
447
- declare function _setActiveContextKey(key: string): void;
465
+ export declare function _setActiveContextKey(key: string): void;
448
466
  /**
449
467
  * Get the current trace ID from async context.
450
468
  * Returns `undefined` when called outside a traced request.
451
469
  */
452
- declare function getCurrentTraceId(): string | undefined;
470
+ export declare function getCurrentTraceId(): string | undefined;
453
471
  /**
454
472
  * Set trace ID in the CURRENT async context without starting a new one.
455
473
  *
@@ -503,11 +521,11 @@ declare function getCurrentTraceId(): string | undefined;
503
521
  * @deprecated Use `runWithTraceId(traceId, fn)` — do not call `setTraceId`
504
522
  * from request-handling code.
505
523
  */
506
- declare function setTraceId(traceId: string, data?: Record<string, unknown>): void;
524
+ export declare function setTraceId(traceId: string, data?: Record<string, unknown>): void;
507
525
  /** Run `fn` inside a new async context carrying `traceId`. */
508
- declare function runWithTraceId<T>(traceId: string, fn: () => T, data?: Record<string, unknown>): T;
526
+ export declare function runWithTraceId<T>(traceId: string, fn: () => T, data?: Record<string, unknown>): T;
509
527
  /** Maximum accepted length for an incoming trace / correlation / request ID. */
510
- declare const MAX_INCOMING_ID_LENGTH = 128;
528
+ export declare const MAX_INCOMING_ID_LENGTH = 128;
511
529
  /**
512
530
  * Validate an externally supplied identifier (trace ID, correlation ID, origin
513
531
  * service name, message-queue ID). Accepts only 1-128 characters from
@@ -515,20 +533,18 @@ declare const MAX_INCOMING_ID_LENGTH = 128;
515
533
  * first element. Returns the cleaned value, or `undefined` when it is unusable
516
534
  * so callers can generate a fresh ID instead of passing client text through.
517
535
  */
518
- declare function sanitizeIncomingId(value: unknown): string | undefined;
536
+ export declare function sanitizeIncomingId(value: unknown): string | undefined;
519
537
  /** Extract trace ID from request using configuration (header → query → body → params). */
520
- declare function extractTraceId(request: unknown, config: TraceIdExtractorConfig): string | undefined;
538
+ export declare function extractTraceId(request: unknown, config: TraceIdExtractorConfig): string | undefined;
521
539
  /**
522
540
  * Default headers checked for incoming trace ID propagation, in priority order:
523
541
  * traceparent (W3C/OTel) → x-trace-id → x-request-id → x-correlation-id → trace-id
524
542
  */
525
- declare const DEFAULT_TRACE_HEADERS: string[];
543
+ export declare const DEFAULT_TRACE_HEADERS: string[];
526
544
  /**
527
545
  * Create trace ID middleware for Express/NestJS
528
546
  */
529
- declare function createTraceMiddleware(config: TraceIdConfig): (req: unknown, res: unknown, next: () => void) => void;
530
- //#endregion
531
- //#region src/utils/typed-logger.d.ts
547
+ export declare function createTraceMiddleware(config: TraceIdConfig): (req: unknown, res: unknown, next: () => void) => void;
532
548
  /**
533
549
  * logixia — TypeScript typed log fields
534
550
  *
@@ -577,7 +593,7 @@ interface LogFieldDef {
577
593
  /** Custom validator — return a string to emit it as a warning message. */
578
594
  validate?: (value: unknown) => string | undefined;
579
595
  }
580
- type LogSchema<TFields extends Record<string, unknown>> = { [K in keyof TFields]: LogFieldDef };
596
+ type LogSchema<TFields extends Record<string, unknown>> = { [K in keyof TFields]: LogFieldDef; };
581
597
  interface CompiledSchema<TFields extends Record<string, unknown>> {
582
598
  readonly fields: LogSchema<TFields>;
583
599
  /**
@@ -593,7 +609,7 @@ interface CompiledSchema<TFields extends Record<string, unknown>> {
593
609
  * Call this once at module initialisation and pass it to `createTypedLogger`.
594
610
  * In development, every log call is validated against the schema.
595
611
  */
596
- declare function defineLogSchema<TFields extends Record<string, unknown>>(fields: LogSchema<TFields>): CompiledSchema<TFields>;
612
+ export declare function defineLogSchema<TFields extends Record<string, unknown>>(fields: LogSchema<TFields>): CompiledSchema<TFields>;
597
613
  /** IBaseLogger-compatible subset used by TypedLogger */
598
614
  interface LoggerLike {
599
615
  error(message: string | Error, data?: Record<string, unknown>): Promise<void>;
@@ -626,9 +642,7 @@ interface TypedLogger<TFields extends Record<string, unknown>> {
626
642
  * @param logger Any object that implements `IBaseLogger` (e.g. the result of `createLogger()`)
627
643
  * @param schema Optional schema for dev-time validation. Created with `defineLogSchema()`.
628
644
  */
629
- declare function createTypedLogger<TFields extends Record<string, unknown>>(logger: LoggerLike, schema?: CompiledSchema<TFields>): TypedLogger<TFields>;
630
- //#endregion
631
- //#region src/wide-events.d.ts
645
+ export declare function createTypedLogger<TFields extends Record<string, unknown>>(logger: LoggerLike, schema?: CompiledSchema<TFields>): TypedLogger<TFields>;
632
646
  /**
633
647
  * logixia — Canonical Log Lines / Wide Events.
634
648
  *
@@ -686,18 +700,18 @@ interface WideEventOptions {
686
700
  * throw) when called outside a `withWideEvent` / middleware scope, so business
687
701
  * code can call it unconditionally.
688
702
  */
689
- declare function addEventFields(fields: WideEventFields): void;
703
+ export declare function addEventFields(fields: WideEventFields): void;
690
704
  /** Set a single field on the current wide event. */
691
- declare function setEventField(key: string, value: unknown): void;
705
+ export declare function setEventField(key: string, value: unknown): void;
692
706
  /** Read a shallow copy of the wide event accumulated so far, or undefined. */
693
- declare function getEventFields(): WideEventFields | undefined;
707
+ export declare function getEventFields(): WideEventFields | undefined;
694
708
  /**
695
709
  * Run `callback` inside a wide-event scope. `addEventFields` calls anywhere in
696
710
  * the (async) call tree accumulate onto one event, which is emitted exactly once
697
711
  * when the callback settles — on success OR error (the canonical "emit in
698
712
  * finally" guarantee). On error, `error` + `errorMessage` fields are added.
699
713
  */
700
- declare function withWideEvent<T>(logger: WideEventLogger, initialFields: WideEventFields, callback: () => Promise<T> | T, options?: WideEventOptions): Promise<T>;
714
+ export declare function withWideEvent<T>(logger: WideEventLogger, initialFields: WideEventFields, callback: () => Promise<T> | T, options?: WideEventOptions): Promise<T>;
701
715
  interface MwReq {
702
716
  method?: string | undefined;
703
717
  url?: string | undefined;
@@ -725,63 +739,17 @@ interface WideEventMiddlewareOptions extends WideEventOptions {
725
739
  * more via `addEventFields`. The completion event includes `statusCode` and the
726
740
  * request duration.
727
741
  */
728
- declare function wideEventMiddleware(logger: WideEventLogger, options?: WideEventMiddlewareOptions): (req: MwReq, res: MwRes, next: () => void) => void;
729
- //#endregion
730
- //#region src/transports/otlp.transport.d.ts
731
- interface OtlpLogTransportConfig {
732
- /** OTLP/HTTP logs endpoint, e.g. `http://localhost:4318/v1/logs`. */
733
- url: string;
734
- /** Extra HTTP headers (auth, tenant, etc.). */
735
- headers?: Record<string, string>;
736
- /** `service.name` resource attribute. Default: 'logixia'. */
737
- serviceName?: string;
738
- /** `service.version` resource attribute. */
739
- serviceVersion?: string;
740
- /** `deployment.environment` resource attribute. */
741
- environment?: string;
742
- /** Extra resource attributes merged into the OTLP resource. */
743
- resourceAttributes?: Record<string, string | number | boolean>;
744
- /** Entries per batch / per POST. Default: 100. */
745
- batchSize?: number;
746
- /** Auto-flush interval (ms). Default: 5000. */
747
- flushIntervalMs?: number;
748
- /** Abort a request that has not finished after this many ms. Default: 10000. */
749
- requestTimeoutMs?: number;
750
- /** Max buffered entries; the oldest are dropped past this. Default: 10000. */
751
- maxBufferSize?: number;
752
- level?: string;
753
- }
742
+ export declare function wideEventMiddleware(logger: WideEventLogger, options?: WideEventMiddlewareOptions): (req: MwReq, res: MwRes, next: () => void) => void;
754
743
  /**
755
- * Map a logixia level name to an OTel SeverityNumber (1–24) and text.
756
- * Per the OTel logs SDK spec: TRACE=1, DEBUG=5, INFO=9, WARN=13, ERROR=17,
757
- * FATAL=21. Custom/unknown levels fall back to INFO (9).
744
+ * Per-request trace ID resolution shared by the HTTP logger middleware and the
745
+ * context helpers. Internal: not re-exported from the package entry points.
758
746
  */
759
- declare function toOtelSeverity(level: string): {
760
- number: number;
761
- text: string;
762
- };
763
- declare class OtlpLogTransport implements IAsyncTransport {
764
- readonly name = "otlp";
765
- readonly level: string | undefined;
766
- private readonly url;
767
- private readonly headers;
768
- private readonly batchSize;
769
- private readonly flushIntervalMs;
770
- private readonly requestTimeoutMs;
771
- private readonly resourceAttrs;
772
- private readonly buffer;
773
- private flushTimer;
774
- constructor(config: OtlpLogTransportConfig);
775
- write(entry: TransportLogEntry): void;
776
- /** Convert one entry into an OTLP LogRecord. */
777
- private toLogRecord;
778
- private buildPayload;
779
- flush(): Promise<void>;
780
- private send;
781
- close(): Promise<void>;
747
+ type TraceHeaderOption = string | readonly string[];
748
+ /** Minimal structural request shape; Express and Fastify requests satisfy it. */
749
+ interface ContextRequestLike {
750
+ headers?: Record<string, string | string[] | undefined>;
751
+ id?: unknown;
782
752
  }
783
- //#endregion
784
- //#region src/context/async-context.d.ts
785
753
  interface LogContext {
786
754
  traceId?: string;
787
755
  spanId?: string;
@@ -790,7 +758,7 @@ interface LogContext {
790
758
  sessionId?: string;
791
759
  [key: string]: unknown;
792
760
  }
793
- declare const LogixiaContext: {
761
+ export declare const LogixiaContext: {
794
762
  /**
795
763
  * Run `callback` inside an async context that carries `store` fields.
796
764
  * All loggers queried within `callback` (and its async descendants) will
@@ -820,33 +788,53 @@ declare const LogixiaContext: {
820
788
  */
821
789
  getStorage(): AsyncLocalStorage<LogContext>;
822
790
  };
791
+ interface ContextHelperOptions<Req extends ContextRequestLike> {
792
+ /**
793
+ * Extract additional fields from the request. A `traceId` returned here is ignored:
794
+ * the resolved request trace ID always wins.
795
+ */
796
+ enrich?: (request: Req & Record<string, unknown>) => Partial<LogContext>;
797
+ /**
798
+ * Header name, or list of names tried in order, to read the trace ID from.
799
+ * Default: `DEFAULT_TRACE_HEADERS` (traceparent is parsed to its 32-hex trace id).
800
+ */
801
+ traceIdHeader?: TraceHeaderOption;
802
+ /**
803
+ * Echo the resolved trace ID on the response under this header name.
804
+ * Default: `false` (no response header is set).
805
+ */
806
+ responseHeader?: string | false;
807
+ }
823
808
  /**
824
809
  * Create an Express/Connect-compatible middleware that wraps each request in
825
810
  * a `LogixiaContext.run()` scope populated with common request fields.
826
811
  *
812
+ * Trace ID: the first present header of `traceIdHeader` (default
813
+ * `DEFAULT_TRACE_HEADERS`, `traceparent` parsed), else `request.id`, else a
814
+ * generated UUID. It is available via `getCurrentTraceId()` and is the logger's
815
+ * top-level `traceId` inside the request. No response header is set unless
816
+ * `responseHeader` is given.
817
+ *
827
818
  * @example
828
819
  * ```ts
829
820
  * import { createExpressContextMiddleware } from 'logixia';
830
- * app.use(createExpressContextMiddleware());
821
+ * app.use(createExpressContextMiddleware({ responseHeader: 'x-trace-id' }));
831
822
  * ```
832
823
  */
833
- declare function createExpressContextMiddleware(options?: {
834
- /** Extract additional fields from the request. */
835
- enrich?: (req: Record<string, unknown>) => Partial<LogContext>;
836
- /** Header to read the traceId from. Default: 'x-trace-id'. */
837
- traceIdHeader?: string;
838
- }): (req: Record<string, unknown>, _res: unknown, next: () => void) => void;
824
+ export declare function createExpressContextMiddleware<Req extends ContextRequestLike = ContextRequestLike>(options?: ContextHelperOptions<Req>): (req: Req, res: {
825
+ setHeader?: (name: string, value: string) => unknown;
826
+ }, next: () => void) => void;
839
827
  /**
840
828
  * Create a Fastify lifecycle hook that wraps each request in a context scope.
841
829
  *
842
830
  * Register with `fastify.addHook('onRequest', createFastifyContextHook())`.
831
+ * Resolves the trace ID exactly like {@link createExpressContextMiddleware} and
832
+ * shares it with `createFastifyPlugin()` from `logixia/middleware`. Fastify's
833
+ * default counter `request.id` (`req-1`, ...) is never used as a trace ID.
843
834
  */
844
- declare function createFastifyContextHook(options?: {
845
- enrich?: (request: Record<string, unknown>) => Partial<LogContext>;
846
- traceIdHeader?: string;
847
- }): (request: Record<string, unknown>, _reply: unknown, done: () => void) => void;
848
- //#endregion
849
- //#region src/utils/sampling.utils.d.ts
835
+ export declare function createFastifyContextHook<Req extends ContextRequestLike = ContextRequestLike>(options?: ContextHelperOptions<Req>): (request: Req, reply: {
836
+ header?: (name: string, value: string) => unknown;
837
+ }, done: () => void) => void;
850
838
  interface SamplingStats {
851
839
  /** Total calls evaluated since last reset. */
852
840
  evaluated: number;
@@ -862,8 +850,6 @@ interface SamplingStats {
862
850
  /** Window start (ms since epoch). */
863
851
  windowStart: number;
864
852
  }
865
- //#endregion
866
- //#region src/exceptions/types.d.ts
867
853
  /**
868
854
  * Unified error response shape for logixia.
869
855
  *
@@ -971,8 +957,6 @@ interface ErrorDetail {
971
957
  */
972
958
  code: string;
973
959
  }
974
- //#endregion
975
- //#region src/exceptions/builder.d.ts
976
960
  /** Input parameters for `ErrorResponseBuilder.build`. */
977
961
  interface BuildParams {
978
962
  /** The caught exception — any type. */
@@ -1018,10 +1002,10 @@ interface BuildParams {
1018
1002
  *
1019
1003
  * @example `'550e8400-e29b-41d4-a716-446655440000'`
1020
1004
  */
1021
- declare function generateTraceId(): string;
1005
+ export declare function generateTraceId(): string;
1022
1006
  /** @deprecated Use `generateTraceId` instead. */
1023
- declare const generateRequestId: typeof generateTraceId;
1024
- declare class ErrorResponseBuilder {
1007
+ export declare const generateRequestId: typeof generateTraceId;
1008
+ export declare class ErrorResponseBuilder {
1025
1009
  /**
1026
1010
  * Build a `LogixiaErrorResponse` from any thrown value.
1027
1011
  *
@@ -1058,8 +1042,6 @@ declare class ErrorResponseBuilder {
1058
1042
  httpStatus: number;
1059
1043
  };
1060
1044
  }
1061
- //#endregion
1062
- //#region src/exceptions/exception.d.ts
1063
1045
  /**
1064
1046
  * Constructor options for `LogixiaException`.
1065
1047
  *
@@ -1119,7 +1101,7 @@ interface LogixiaExceptionOptions<TCode extends string = string, TType extends s
1119
1101
  */
1120
1102
  metadata?: Record<string, unknown>;
1121
1103
  }
1122
- declare class LogixiaException<TCode extends string = string, TType extends string = string> extends Error {
1104
+ export declare class LogixiaException<TCode extends string = string, TType extends string = string> extends Error {
1123
1105
  /** @readonly The machine-readable error code supplied by the caller. */
1124
1106
  readonly errorCode: TCode;
1125
1107
  /** @readonly The error type category supplied by the caller. */
@@ -1151,9 +1133,7 @@ declare class LogixiaException<TCode extends string = string, TType extends stri
1151
1133
  * }
1152
1134
  * ```
1153
1135
  */
1154
- declare function isLogixiaException<TCode extends string = string, TType extends string = string>(value?: unknown): value is LogixiaException<TCode, TType>;
1155
- //#endregion
1156
- //#region src/metrics.d.ts
1136
+ export declare function isLogixiaException<TCode extends string = string, TType extends string = string>(value?: unknown): value is LogixiaException<TCode, TType>;
1157
1137
  /**
1158
1138
  * Increment a counter on each matching log entry.
1159
1139
  *
@@ -1226,7 +1206,7 @@ interface GaugeConfig {
1226
1206
  type MetricConfig = CounterConfig | HistogramConfig | GaugeConfig;
1227
1207
  type MetricsMap = Record<string, MetricConfig>;
1228
1208
  /** Label value used for the series that absorbs label sets beyond the cardinality cap. */
1229
- declare const OVERFLOW_LABEL_VALUE = "__overflow__";
1209
+ export declare const OVERFLOW_LABEL_VALUE = "__overflow__";
1230
1210
  interface MetricsPluginOptions {
1231
1211
  /**
1232
1212
  * Maximum number of distinct label sets tracked per metric. Once reached, new
@@ -1252,7 +1232,7 @@ interface MetricsPluginOptions {
1252
1232
  * logger.use(metrics);
1253
1233
  * ```
1254
1234
  */
1255
- declare class MetricsPlugin implements LogixiaPlugin {
1235
+ export declare class MetricsPlugin implements LogixiaPlugin {
1256
1236
  readonly name = "logixia-metrics";
1257
1237
  private readonly map;
1258
1238
  private readonly metricState;
@@ -1343,61 +1323,17 @@ declare class MetricsPlugin implements LogixiaPlugin {
1343
1323
  *
1344
1324
  * Pass `{ maxLabelSets }` to change the per-metric label cardinality cap (default 1000).
1345
1325
  */
1346
- declare function createMetricsPlugin(map: MetricsMap, options?: MetricsPluginOptions): MetricsPlugin;
1347
- //#endregion
1348
- //#region src/index.d.ts
1349
- /**
1350
- * Default configuration for Logixia logger
1351
- */
1352
- declare const DEFAULT_CONFIG: {
1353
- appName: string;
1354
- environment: Environment;
1355
- traceId: boolean;
1356
- format: {
1357
- timestamp: boolean;
1358
- colorize: boolean;
1359
- json: boolean;
1360
- };
1361
- silent: boolean;
1362
- levelOptions: {
1363
- level: "info";
1364
- levels: {
1365
- error: number;
1366
- warn: number;
1367
- info: number;
1368
- debug: number;
1369
- trace: number;
1370
- verbose: number;
1371
- };
1372
- colors: Record<string, LogColor>;
1373
- };
1374
- fields: {
1375
- timestamp: boolean;
1376
- level: boolean;
1377
- appName: boolean;
1378
- traceId: boolean;
1379
- message: boolean;
1380
- payload: boolean;
1381
- timeTaken: boolean;
1382
- };
1383
- outputs: string[];
1384
- };
1326
+ export declare function createMetricsPlugin(map: MetricsMap, options?: MetricsPluginOptions): MetricsPlugin;
1385
1327
  /**
1386
1328
  * Create a new Logixia logger instance with TypeScript support for custom levels
1387
1329
  * @param config - Logger configuration
1388
1330
  * @returns Typed logger instance
1389
1331
  */
1390
- declare const createLogger: typeof createLogger$1;
1391
- /**
1392
- * Create a new Logixia logger service for NestJS
1393
- * @param config - Logger configuration
1394
- * @returns LogixiaLoggerService instance
1395
- */
1396
- declare function createLoggerService(config?: Partial<LoggerConfig>): LogixiaLoggerService;
1332
+ export declare const createLogger: typeof createLogger$1;
1397
1333
  /**
1398
1334
  * Default logger instance
1399
1335
  */
1400
- declare const logger: LogixiaLogger<{
1336
+ export declare const logger: LogixiaLogger<{
1401
1337
  appName: string;
1402
1338
  environment: Environment;
1403
1339
  traceId: boolean;
@@ -1430,6 +1366,8 @@ declare const logger: LogixiaLogger<{
1430
1366
  };
1431
1367
  outputs: string[];
1432
1368
  }>;
1433
- //#endregion
1434
- export { AdaptiveSamplingConfig, AnomalyDetection, BasicLogIndexer, BasicSearchEngine, type BuildParams, type CompiledSchema, ContextData, CorrelatedLogs, CorrelationEngine, type CounterConfig, CustomLevelMethods, DEFAULT_CONFIG, DEFAULT_LOG_COLORS, DEFAULT_LOG_LEVELS, DEFAULT_TRACE_HEADERS, EntityType, Environment, type ErrorDetail, ErrorResponseBuilder, ErrorSerializationOptions, ExitMode, ExportOptions, ExtractLevels, FlushOnExitOptions, type GaugeConfig, GracefulShutdownConfig, type HistogramConfig, HttpError, HttpRequest, HttpResponse, IBaseLogger, ILogFormatter, ILogIndexer, ILogSearchEngine, ILogger, ILoggerDefault, InjectLogger, JsonFormatter, KafkaTraceInterceptor, LOGIXIA_EXCEPTION_FILTER_OPTIONS, LOGIXIA_LOGGER_CONFIG, LOGIXIA_LOGGER_PREFIX, LOGIXIA_TRACE_CONFIG, type LevelSignalOptions, LogCluster, LogColor, type LogContext, LogCorrelationSummary, LogEntry, type LogFieldDef, LogFieldKey, type LogFieldType, LogLevel, LogLevelString, LogMethod, type LogMethodOptions, LogPattern, type LogSchema, LoggerConfig, LoggerConfig as LoggerConfigInterface, type LoggerLike, LoggerWithLevels, LogixiaAsyncOptions, LogixiaContext, type LogixiaErrorResponse, LogixiaException, LogixiaExceptionFilter, type LogixiaExceptionFilterOptions, type LogixiaExceptionOptions, LogixiaLogger, LogixiaLoggerModule, LogixiaLoggerService, LogixiaOptionsFactory, type LogixiaPlugin, LogixiaServiceWith, LogixiaServiceWithLevels, MAX_INCOMING_ID_LENGTH, type MetricConfig, type MetricsMap, MetricsPlugin, type MetricsPluginOptions, NLPSearchEngine, NamespaceLevels, OVERFLOW_LABEL_VALUE, type OtelBridgeOptions, type OtelSpanContext, OtlpLogTransport, type OtlpLogTransportConfig, ParsedNLQuery, PatternRecognitionEngine, PluginRegistry, QueryEntity, QueryIntent, type ReconfigurableLogger, type RedactConfig, RelatedLog, RelationshipType, RelativeTime, RequestContext, RequestMetrics, RequestTiming, type SafeStringifyOptions, SamplingConfig, type SamplingStats, SearchFilters, SearchHighlight, SearchManager, SearchManagerConfig, SearchMatch, SearchOptions, SearchPreset, SearchQuery, SearchResult, SearchStats, SearchSuggestion, SemanticIndex, SimilarLog, SortField, SuggestionType, TRACE_CONTEXT_KEY, TextFormatter, TimeRange, TimelineEvent, TimingEntry, TraceContext, TraceIdConfig, TraceIdExtractorConfig, type TypedLogger, WebSocketTraceInterceptor, type WideEventFields, type WideEventLogger, type WideEventMiddlewareOptions, type WideEventOptions, _setActiveContextKey, _shutdownRegistrySize, addEventFields, applyRedaction, createExpressContextMiddleware, createFastifyContextHook, createLevelControlHandler, createLogger, createLoggerService, createMetricsPlugin, createTraceMiddleware, createTypedLogger, decycleValue, defineLogSchema, deregisterFromShutdown, disableOtelBridge, extractTraceId, flushOnExit, generateRequestId, generateTraceId, getActiveOtelContext, getCurrentTraceId, getEventFields, getOtelMetaFields, getTraceContextKey, globalPluginRegistry, initOtelBridge, isError, isLogixiaException, logger, normalizeError, redactObject, registerForShutdown, registerLevelSignal, resetShutdownHandlers, retrocycle, runWithTraceId, safeStringify, sanitizeIncomingId, serializeError, setEventField, setTraceId, stringifyForLog, toOtelSeverity, traceStorage, usePlugin, wideEventMiddleware, withWideEvent };
1369
+ /**
1370
+ * Export default configuration for reference
1371
+ */
1372
+ export { AdaptiveSamplingConfig, type AnomalyDetection, BasicLogIndexer, BasicSearchEngine, type BuildParams, type CompiledSchema, ContextData, type CorrelatedLogs, CorrelationEngine, type CounterConfig, CustomLevelMethods, DEFAULT_LOG_COLORS, DEFAULT_LOG_LEVELS, type DiscordEmbed, DiscordTransport, type DiscordTransportConfig, type EntityType, Environment, type ErrorDetail, ErrorSerializationOptions, type ExportOptions, ExtractLevels, type GaugeConfig, GracefulShutdownConfig, type HistogramConfig, HttpError, HttpRequest, HttpResponse, IBaseLogger, ILogFormatter, type ILogIndexer, type ILogSearchEngine, ILogger, ILoggerDefault, type LevelSignalOptions, type LogCluster, LogColor, type LogContext, type LogCorrelationSummary, LogEntry, type LogFieldDef, LogFieldKey, type LogFieldType, LogLevel, LogLevelString, type LogPattern, type LogSchema, LoggerConfig, type LoggerConfig as LoggerConfigInterface, type LoggerLike, LoggerWithLevels, type LogixiaErrorResponse, type LogixiaExceptionOptions, LogixiaLogger, type LogixiaPlugin, type MetricConfig, type MetricsMap, type MetricsPluginOptions, NLPSearchEngine, NamespaceLevels, type OtelBridgeOptions, type OtelSpanContext, OtlpLogTransport, type OtlpLogTransportConfig, type ParsedNLQuery, PatternRecognitionEngine, PluginRegistry, type QueryEntity, type QueryIntent, type ReconfigurableLogger, RedactConfig, type RelatedLog, type RelationshipType, type RelativeTime, RequestContext, RequestMetrics, RequestTiming, type SafeStringifyOptions, SamplingConfig, type SamplingStats, type SearchFilters, type SearchHighlight, SearchManager, type SearchManagerConfig, type SearchMatch, type SearchOptions, type SearchPreset, type SearchQuery, type SearchResult, type SearchStats, type SearchSuggestion, type SemanticIndex, type SimilarLog, type SlackMessage, SlackTransport, type SlackTransportConfig, type SortField, type SuggestionType, type TimeRange, type TimelineEvent, TimingEntry, TraceIdConfig, TraceIdExtractorConfig, type TypedLogger, type WideEventFields, type WideEventLogger, type WideEventMiddlewareOptions, type WideEventOptions, globalPluginRegistry, toOtelSeverity, usePlugin };
1435
1373
  //# sourceMappingURL=index.d.mts.map