logixia 1.6.7 → 1.7.0

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.
@@ -807,6 +807,8 @@ var v4_default = v4;
807
807
 
808
808
  //#endregion
809
809
  //#region src/utils/trace.utils.ts
810
+ /** The key under which the trace ID is stored in AsyncLocalStorage. */
811
+ const TRACE_CONTEXT_KEY = "traceId";
810
812
  const traceStorage = new AsyncLocalStorage();
811
813
  /**
812
814
  * Default trace ID generator using UUID v4
@@ -900,12 +902,16 @@ const DEFAULT_TRACE_HEADERS$1 = [
900
902
  * Create trace ID middleware for Express/NestJS
901
903
  */
902
904
  function createTraceMiddleware(config) {
905
+ const defaultExtractor = {
906
+ header: DEFAULT_TRACE_HEADERS$1,
907
+ query: ["traceId", "trace_id"]
908
+ };
903
909
  const resolvedConfig = {
904
- extractor: {
905
- header: DEFAULT_TRACE_HEADERS$1,
906
- query: ["traceId", "trace_id"]
907
- },
908
- ...config
910
+ ...config,
911
+ extractor: (config === null || config === void 0 ? void 0 : config.extractor) ? {
912
+ ...defaultExtractor,
913
+ ...config.extractor
914
+ } : defaultExtractor
909
915
  };
910
916
  return (req, res, next) => {
911
917
  let traceId;
@@ -1636,6 +1642,10 @@ let LogixiaLoggerService = _LogixiaLoggerService = class LogixiaLoggerService$1
1636
1642
  getCurrentTraceId() {
1637
1643
  return getCurrentTraceId();
1638
1644
  }
1645
+ /** The AsyncLocalStorage key under which the trace ID is stored ('traceId'). */
1646
+ get traceContextKey() {
1647
+ return TRACE_CONTEXT_KEY;
1648
+ }
1639
1649
  async close() {
1640
1650
  return this.logger.close();
1641
1651
  }
@@ -10601,15 +10611,19 @@ const DEFAULT_TRACE_HEADERS = [
10601
10611
  let TraceMiddleware = class TraceMiddleware$1 {
10602
10612
  constructor(config) {
10603
10613
  this.config = config;
10614
+ const defaultExtractor = {
10615
+ header: DEFAULT_TRACE_HEADERS,
10616
+ query: ["traceId", "trace_id"]
10617
+ };
10604
10618
  this.config = {
10605
10619
  enabled: true,
10606
10620
  generator: generateTraceId,
10607
10621
  contextKey: "traceId",
10608
- extractor: {
10609
- header: DEFAULT_TRACE_HEADERS,
10610
- query: ["traceId", "trace_id"]
10611
- },
10612
- ...config
10622
+ ...config,
10623
+ extractor: (config === null || config === void 0 ? void 0 : config.extractor) ? {
10624
+ ...defaultExtractor,
10625
+ ...config.extractor
10626
+ } : defaultExtractor
10613
10627
  };
10614
10628
  }
10615
10629
  use(req, res, next) {
@@ -10910,5 +10924,5 @@ let LogixiaLoggerModule = class LogixiaLoggerModule$1 {
10910
10924
  LogixiaLoggerModule = _LogixiaLoggerModule = __decorate([Module({})], LogixiaLoggerModule);
10911
10925
 
10912
10926
  //#endregion
10913
- export { initOtelBridge as A, LogixiaContext as B, registerForShutdown as C, disableOtelBridge as D, redactObject as E, DEFAULT_LOG_LEVELS as F, createFastifyContextHook as H, LogLevel as I, PluginRegistry as L, normalizeError as M, serializeError as N, getActiveOtelContext as O, DEFAULT_LOG_COLORS as P, globalPluginRegistry as R, flushOnExit as S, applyRedaction as T, createExpressContextMiddleware as V, getCurrentTraceId as _, TraceMiddleware as a, traceStorage as b, LogixiaLoggerService as c, LogixiaLogger as d, createLogger as f, generateTraceId as g, extractTraceId as h, WebSocketTraceInterceptor as i, isError as j, getOtelMetaFields as k, __decorate as l, createTraceMiddleware as m, LOGIXIA_LOGGER_PREFIX as n, __decorateParam as o, DEFAULT_TRACE_HEADERS$1 as p, LogixiaLoggerModule as r, KafkaTraceInterceptor as s, LOGIXIA_LOGGER_CONFIG as t, __decorateMetadata as u, runWithTraceId as v, resetShutdownHandlers as w, deregisterFromShutdown as x, setTraceId as y, usePlugin as z };
10914
- //# sourceMappingURL=logitron-logger.module-Br8Q2IUG.mjs.map
10927
+ export { getOtelMetaFields as A, usePlugin as B, flushOnExit as C, redactObject as D, applyRedaction as E, DEFAULT_LOG_COLORS as F, createExpressContextMiddleware as H, DEFAULT_LOG_LEVELS as I, LogLevel as L, isError as M, normalizeError as N, disableOtelBridge as O, serializeError as P, PluginRegistry as R, deregisterFromShutdown as S, resetShutdownHandlers as T, createFastifyContextHook as U, LogixiaContext as V, generateTraceId as _, TraceMiddleware as a, setTraceId as b, LogixiaLoggerService as c, LogixiaLogger as d, createLogger as f, extractTraceId as g, createTraceMiddleware as h, WebSocketTraceInterceptor as i, initOtelBridge as j, getActiveOtelContext as k, __decorate as l, TRACE_CONTEXT_KEY as m, LOGIXIA_LOGGER_PREFIX as n, __decorateParam as o, DEFAULT_TRACE_HEADERS$1 as p, LogixiaLoggerModule as r, KafkaTraceInterceptor as s, LOGIXIA_LOGGER_CONFIG as t, __decorateMetadata as u, getCurrentTraceId as v, registerForShutdown as w, traceStorage as x, runWithTraceId as y, globalPluginRegistry as z };
10928
+ //# sourceMappingURL=logitron-logger.module-DnRTDcoz.mjs.map