logixia 1.3.1 → 1.5.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.
Files changed (59) hide show
  1. package/README.md +848 -7
  2. package/dist/.tsbuildinfo +1 -1
  3. package/dist/{index-iDTW2-eY.d.mts → index-Ium497V3.d.mts} +180 -2
  4. package/dist/index-Ium497V3.d.mts.map +1 -0
  5. package/dist/{index-CHIsdA9n.d.ts → index-t-ActikQ.d.ts} +180 -2
  6. package/dist/index-t-ActikQ.d.ts.map +1 -0
  7. package/dist/index.d.mts +734 -3
  8. package/dist/index.d.mts.map +1 -1
  9. package/dist/index.d.ts +734 -3
  10. package/dist/index.d.ts.map +1 -1
  11. package/dist/index.js +643 -2
  12. package/dist/index.js.map +1 -1
  13. package/dist/index.mjs +618 -3
  14. package/dist/index.mjs.map +1 -1
  15. package/dist/{logitron-logger.module-BqNKp0Fs.js → logitron-logger.module-B7CsnCYA.js} +418 -52
  16. package/dist/logitron-logger.module-B7CsnCYA.js.map +1 -0
  17. package/dist/{logitron-logger.module-Bq3_KckP.d.ts → logitron-logger.module-CMRBDGwm.d.ts} +181 -34
  18. package/dist/logitron-logger.module-CMRBDGwm.d.ts.map +1 -0
  19. package/dist/{logitron-logger.module-2AzkadqZ.mjs → logitron-logger.module-DdVy45xE.mjs} +366 -54
  20. package/dist/logitron-logger.module-DdVy45xE.mjs.map +1 -0
  21. package/dist/{logitron-logger.module-DW_mmXbj.d.mts → logitron-logger.module-Eaw6bH9M.d.mts} +181 -34
  22. package/dist/logitron-logger.module-Eaw6bH9M.d.mts.map +1 -0
  23. package/dist/middleware.d.mts +1 -1
  24. package/dist/middleware.d.ts +1 -1
  25. package/dist/nest.d.mts +2 -2
  26. package/dist/nest.d.ts +2 -2
  27. package/dist/nest.js +2 -2
  28. package/dist/nest.mjs +2 -2
  29. package/dist/{promise-DaiZ2BaH.js → promise-BI-3eI4n.js} +285 -128
  30. package/dist/promise-BI-3eI4n.js.map +1 -0
  31. package/dist/{promise-C4pQPcK4.mjs → promise-BrZcjavs.mjs} +285 -128
  32. package/dist/promise-BrZcjavs.mjs.map +1 -0
  33. package/dist/testing.d.mts +1 -1
  34. package/dist/testing.d.ts +1 -1
  35. package/dist/testing.js +7 -1
  36. package/dist/testing.js.map +1 -1
  37. package/dist/testing.mjs +7 -1
  38. package/dist/testing.mjs.map +1 -1
  39. package/dist/{transport.manager-5VVdqS3o.mjs → transport.manager-DR7TLXQT.mjs} +82 -4
  40. package/dist/transport.manager-DR7TLXQT.mjs.map +1 -0
  41. package/dist/{transport.manager-DCOm4uIQ.js → transport.manager-DVTM978M.js} +82 -4
  42. package/dist/transport.manager-DVTM978M.js.map +1 -0
  43. package/dist/transports.d.mts +61 -168
  44. package/dist/transports.d.mts.map +1 -1
  45. package/dist/transports.d.ts +61 -168
  46. package/dist/transports.d.ts.map +1 -1
  47. package/dist/transports.js +1 -1
  48. package/dist/transports.mjs +1 -1
  49. package/package.json +62 -1
  50. package/dist/index-CHIsdA9n.d.ts.map +0 -1
  51. package/dist/index-iDTW2-eY.d.mts.map +0 -1
  52. package/dist/logitron-logger.module-2AzkadqZ.mjs.map +0 -1
  53. package/dist/logitron-logger.module-Bq3_KckP.d.ts.map +0 -1
  54. package/dist/logitron-logger.module-BqNKp0Fs.js.map +0 -1
  55. package/dist/logitron-logger.module-DW_mmXbj.d.mts.map +0 -1
  56. package/dist/promise-C4pQPcK4.mjs.map +0 -1
  57. package/dist/promise-DaiZ2BaH.js.map +0 -1
  58. package/dist/transport.manager-5VVdqS3o.mjs.map +0 -1
  59. package/dist/transport.manager-DCOm4uIQ.js.map +0 -1
@@ -1,5 +1,5 @@
1
1
  const require_chunk = require('./chunk-BTgCAUrQ.js');
2
- const require_transport_manager = require('./transport.manager-DCOm4uIQ.js');
2
+ const require_transport_manager = require('./transport.manager-DVTM978M.js');
3
3
  let fast_json_stringify = require("fast-json-stringify");
4
4
  fast_json_stringify = require_chunk.__toESM(fast_json_stringify);
5
5
  let node_async_hooks = require("node:async_hooks");
@@ -77,6 +77,103 @@ function createFastifyContextHook(options = {}) {
77
77
  };
78
78
  }
79
79
 
80
+ //#endregion
81
+ //#region src/plugin.ts
82
+ /**
83
+ * Holds an ordered list of `LogixiaPlugin` instances and dispatches lifecycle
84
+ * events to them. One registry is created per logger instance; a global
85
+ * singleton is also exported for process-wide registration.
86
+ */
87
+ var PluginRegistry = class {
88
+ constructor() {
89
+ this._plugins = [];
90
+ }
91
+ /**
92
+ * Register a plugin. Silently skips if a plugin with the same `name` is
93
+ * already registered on this registry.
94
+ */
95
+ register(plugin) {
96
+ if (this._plugins.some((p) => p.name === plugin.name)) return;
97
+ this._plugins.push(plugin);
98
+ if (plugin.onInit) {
99
+ const result = plugin.onInit();
100
+ if (result instanceof Promise) result.catch(() => {});
101
+ }
102
+ }
103
+ /** Remove a previously registered plugin by name. No-op if not found. */
104
+ unregister(name) {
105
+ const idx = this._plugins.findIndex((p) => p.name === name);
106
+ if (idx !== -1) this._plugins.splice(idx, 1);
107
+ }
108
+ /** Returns `true` if a plugin with the given name is registered. */
109
+ has(name) {
110
+ return this._plugins.some((p) => p.name === name);
111
+ }
112
+ /** Number of currently registered plugins. */
113
+ get size() {
114
+ return this._plugins.length;
115
+ }
116
+ /**
117
+ * Run all `onLog` hooks in order.
118
+ * Returns `null` if any plugin cancels the entry; otherwise returns the
119
+ * (possibly transformed) entry.
120
+ */
121
+ async runOnLog(entry) {
122
+ let current = entry;
123
+ for (const plugin of this._plugins) {
124
+ if (!plugin.onLog) continue;
125
+ current = await plugin.onLog(current);
126
+ if (current === null) return null;
127
+ }
128
+ return current;
129
+ }
130
+ /**
131
+ * Notify all `onError` hooks.
132
+ * Errors thrown inside hooks are swallowed to prevent error cascades.
133
+ */
134
+ async runOnError(error, entry) {
135
+ for (const plugin of this._plugins) if (plugin.onError) {
136
+ const r = plugin.onError(error, entry);
137
+ if (r instanceof Promise) await r.catch(() => {});
138
+ }
139
+ }
140
+ /** Run all `onShutdown` hooks concurrently. Hook errors are swallowed. */
141
+ async runOnShutdown() {
142
+ await Promise.all(this._plugins.filter((p) => Boolean(p.onShutdown)).map((p) => {
143
+ const r = p.onShutdown();
144
+ return r instanceof Promise ? r.catch(() => {}) : Promise.resolve();
145
+ }));
146
+ }
147
+ };
148
+ /**
149
+ * Module-level singleton registry.
150
+ *
151
+ * Plugins registered here are automatically copied into every **new** logger
152
+ * instance created after the registration. Already-created loggers are not
153
+ * retroactively affected — use `logger.use(plugin)` for per-instance control.
154
+ */
155
+ const globalPluginRegistry = new PluginRegistry();
156
+ /**
157
+ * Register a plugin in the global registry so it applies to every future
158
+ * logger instance.
159
+ *
160
+ * @example
161
+ * ```ts
162
+ * import { usePlugin } from 'logixia';
163
+ *
164
+ * usePlugin({
165
+ * name: 'audit-sink',
166
+ * onLog(entry) {
167
+ * if (entry.level === 'error') auditQueue.push(entry);
168
+ * return entry;
169
+ * },
170
+ * });
171
+ * ```
172
+ */
173
+ function usePlugin(plugin) {
174
+ globalPluginRegistry.register(plugin);
175
+ }
176
+
80
177
  //#endregion
81
178
  //#region src/types/index.ts
82
179
  const LogLevel = {
@@ -214,10 +311,187 @@ function normalizeError(error) {
214
311
  return new Error(String(error));
215
312
  }
216
313
 
314
+ //#endregion
315
+ //#region src/utils/otel.ts
316
+ let _otelApi;
317
+ function tryLoadOtelApi() {
318
+ if (_otelApi !== void 0) return _otelApi;
319
+ try {
320
+ _otelApi = require("@opentelemetry/api");
321
+ return _otelApi;
322
+ } catch {
323
+ _otelApi = null;
324
+ return null;
325
+ }
326
+ }
327
+ /**
328
+ * Read the currently active OTel span context (if any) and return its fields
329
+ * in a plain object suitable for spreading into a log entry.
330
+ *
331
+ * Returns `undefined` when:
332
+ * - `@opentelemetry/api` is not installed
333
+ * - No active span exists (root context)
334
+ * - The span context is invalid (all-zeros)
335
+ */
336
+ function getActiveOtelContext(opts = {}) {
337
+ const api = tryLoadOtelApi();
338
+ if (!api) return void 0;
339
+ const ctx = api.context.active();
340
+ const sc = api.trace.getSpanContext(ctx);
341
+ if (!sc || !api.trace.isSpanContextValid(sc)) return void 0;
342
+ const isSampled = (sc.traceFlags & api.trace.TraceFlags.SAMPLED) === api.trace.TraceFlags.SAMPLED;
343
+ if (opts.sampledOnly && !isSampled) return void 0;
344
+ return {
345
+ traceId: sc.traceId,
346
+ spanId: sc.spanId,
347
+ traceFlags: sc.traceFlags,
348
+ isSampled
349
+ };
350
+ }
351
+ /**
352
+ * Returns a metadata object with OTel context fields ready to merge into a log call,
353
+ * using the configured field names.
354
+ *
355
+ * Returns `{}` when no active span exists (safe to spread unconditionally).
356
+ *
357
+ * @example
358
+ * ```ts
359
+ * await logger.info('Payment processed', {
360
+ * ...getOtelMetaFields(),
361
+ * orderId: 'ord_123',
362
+ * });
363
+ * ```
364
+ */
365
+ function getOtelMetaFields(opts = {}) {
366
+ const { traceIdField = "traceId", spanIdField = "spanId", traceFlagsField = "traceFlags" } = opts;
367
+ const ctx = getActiveOtelContext(opts);
368
+ if (!ctx) return {};
369
+ return {
370
+ [traceIdField]: ctx.traceId,
371
+ [spanIdField]: ctx.spanId,
372
+ [traceFlagsField]: ctx.traceFlags
373
+ };
374
+ }
375
+ let _bridgeOptions = null;
376
+ /**
377
+ * Initialise the global OTel bridge.
378
+ *
379
+ * Once called, logixia's internal log pipeline checks for an active OTel span
380
+ * on **every** log call and automatically merges the span context into the
381
+ * entry's metadata — no per-call wiring needed.
382
+ *
383
+ * Call once at app startup, **after** the OTel SDK has been initialised:
384
+ * ```ts
385
+ * import { initOtelBridge } from 'logixia';
386
+ * initOtelBridge();
387
+ * ```
388
+ */
389
+ function initOtelBridge(opts = {}) {
390
+ _bridgeOptions = opts;
391
+ }
392
+ /**
393
+ * @internal
394
+ * Used by the core logger to inject OTel context when the bridge is active.
395
+ * Returns `{}` when the bridge is not initialised or no active span exists.
396
+ */
397
+ function _getOtelPayloadIfEnabled() {
398
+ if (!_bridgeOptions) return {};
399
+ return getOtelMetaFields(_bridgeOptions);
400
+ }
401
+ /**
402
+ * Disable the OTel bridge (useful for tests).
403
+ */
404
+ function disableOtelBridge() {
405
+ _bridgeOptions = null;
406
+ }
407
+
217
408
  //#endregion
218
409
  //#region src/utils/redact.utils.ts
219
410
  const DEFAULT_CENSOR = "[REDACTED]";
220
411
  /**
412
+ * Conservative patterns: tokens and secrets that should NEVER appear in logs.
413
+ * Applied when `autoDetect: true` or `autoDetect: 'conservative'`.
414
+ */
415
+ const PII_CONSERVATIVE_PATTERNS = [
416
+ /eyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]*/g,
417
+ /Bearer\s+[A-Za-z0-9._~+/-]+=*/gi,
418
+ /\b(?:sk|pk|api|key|secret|token)-[A-Za-z0-9_-]{16,}/gi,
419
+ /\bAKIA[0-9A-Z]{16}\b/g,
420
+ /\b[A-Za-z0-9/+]{40}\b(?=.*aws)/gi
421
+ ];
422
+ /**
423
+ * Conservative field-name paths auto-redacted by name regardless of value.
424
+ */
425
+ const PII_CONSERVATIVE_PATHS = [
426
+ "**.password",
427
+ "**.passwd",
428
+ "**.secret",
429
+ "**.token",
430
+ "**.apiKey",
431
+ "**.api_key",
432
+ "**.accessToken",
433
+ "**.access_token",
434
+ "**.refreshToken",
435
+ "**.refresh_token",
436
+ "**.authorization",
437
+ "**.credentials",
438
+ "**.privateKey",
439
+ "**.private_key",
440
+ "**.clientSecret",
441
+ "**.client_secret"
442
+ ];
443
+ /**
444
+ * Aggressive patterns: also catch personal data that could identify a person.
445
+ * Applied when `autoDetect: 'aggressive'`.
446
+ */
447
+ const PII_AGGRESSIVE_PATTERNS = [
448
+ /\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b/g,
449
+ /\b\d{3}-?\d{2}-?\d{4}\b/g,
450
+ /\b(?:\d[ -]?){13,19}\b/g,
451
+ /\b(?:\+?1[-.\s]?)?\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4}\b/g,
452
+ /\b(?:\d{1,3}\.){3}\d{1,3}\b/g
453
+ ];
454
+ const PII_AGGRESSIVE_PATHS = [
455
+ ...PII_CONSERVATIVE_PATHS,
456
+ "**.email",
457
+ "**.emailAddress",
458
+ "**.email_address",
459
+ "**.phone",
460
+ "**.phoneNumber",
461
+ "**.phone_number",
462
+ "**.mobile",
463
+ "**.ssn",
464
+ "**.sin",
465
+ "**.dob",
466
+ "**.dateOfBirth",
467
+ "**.date_of_birth",
468
+ "**.creditCard",
469
+ "**.credit_card",
470
+ "**.cardNumber",
471
+ "**.card_number",
472
+ "**.cvv",
473
+ "**.cvc",
474
+ "**.ipAddress",
475
+ "**.ip_address"
476
+ ];
477
+ /**
478
+ * Build an effective config that merges `autoDetect` PII rules into the
479
+ * explicit `paths` and `patterns` the caller provided.
480
+ */
481
+ function resolveConfig(config) {
482
+ const { autoDetect } = config;
483
+ if (!autoDetect) return config;
484
+ const aggressive = autoDetect === "aggressive";
485
+ const extraPaths = aggressive ? PII_AGGRESSIVE_PATHS : PII_CONSERVATIVE_PATHS;
486
+ const extraPatterns = aggressive ? [...PII_CONSERVATIVE_PATTERNS, ...PII_AGGRESSIVE_PATTERNS] : PII_CONSERVATIVE_PATTERNS;
487
+ const { paths = [], patterns = [] } = config;
488
+ return {
489
+ ...config,
490
+ paths: [...paths, ...extraPaths],
491
+ patterns: [...patterns, ...extraPatterns]
492
+ };
493
+ }
494
+ /**
221
495
  * Convert a dot-notation path pattern to a RegExp.
222
496
  * Supports `*` (one segment) and `**` (zero or more segments).
223
497
  *
@@ -289,8 +563,9 @@ function redactObject(obj, config, _currentPath = "") {
289
563
  */
290
564
  function applyRedaction(payload, config) {
291
565
  if (!payload || !config) return payload;
292
- if ((!config.paths || config.paths.length === 0) && (!config.patterns || config.patterns.length === 0)) return payload;
293
- return redactObject(payload, config);
566
+ const resolved$1 = resolveConfig(config);
567
+ if ((!resolved$1.paths || resolved$1.paths.length === 0) && (!resolved$1.patterns || resolved$1.patterns.length === 0)) return payload;
568
+ return redactObject(payload, resolved$1);
294
569
  }
295
570
  function isPlainObject(value) {
296
571
  return value !== null && typeof value === "object" && !Array.isArray(value) && !(value instanceof Date) && !(value instanceof Error) && !(value instanceof RegExp);
@@ -666,11 +941,17 @@ function namespacePatternToRegex(pattern) {
666
941
  const escaped = pattern.split(".").map((s) => s === "*" ? "[^.]+" : s.replace(/[$()*+.?[\\\]^{|}]/g, "\\$&")).join("\\.");
667
942
  return /* @__PURE__ */ new RegExp(`^${escaped}$`);
668
943
  }
944
+ /** Max compiled patterns to keep in memory. Oldest entry is evicted when full. */
945
+ const _NS_CACHE_MAX = 1e3;
669
946
  const _nsPatternCache = /* @__PURE__ */ new Map();
670
947
  function matchesNamespacePattern(ns, pattern) {
671
948
  let re = _nsPatternCache.get(pattern);
672
949
  if (!re) {
673
950
  re = namespacePatternToRegex(pattern);
951
+ if (_nsPatternCache.size >= _NS_CACHE_MAX) {
952
+ const firstKey = _nsPatternCache.keys().next().value;
953
+ if (firstKey !== void 0) _nsPatternCache.delete(firstKey);
954
+ }
674
955
  _nsPatternCache.set(pattern, re);
675
956
  }
676
957
  return re.test(ns);
@@ -701,6 +982,7 @@ var LogixiaLogger = class LogixiaLogger {
701
982
  this._formattedLevels = /* @__PURE__ */ new Map();
702
983
  this._formattedAppName = "";
703
984
  this._hasRedact = false;
985
+ this._pluginRegistry = new PluginRegistry();
704
986
  this.config = {
705
987
  appName: "App",
706
988
  environment: "development",
@@ -757,6 +1039,7 @@ var LogixiaLogger = class LogixiaLogger {
757
1039
  });
758
1040
  this.setupGracefulShutdown();
759
1041
  this.createCustomLevelMethods();
1042
+ for (const p of globalPluginRegistry._plugins) this._pluginRegistry.register(p);
760
1043
  this._buildPerfCaches();
761
1044
  }
762
1045
  setupGracefulShutdown() {
@@ -983,6 +1266,29 @@ var LogixiaLogger = class LogixiaLogger {
983
1266
  };
984
1267
  return childLogger;
985
1268
  }
1269
+ /**
1270
+ * Register a plugin on this logger instance.
1271
+ *
1272
+ * @example
1273
+ * ```ts
1274
+ * logger.use({
1275
+ * name: 'audit',
1276
+ * onLog(entry) { auditQueue.push(entry); return entry; },
1277
+ * });
1278
+ * ```
1279
+ */
1280
+ use(plugin) {
1281
+ this._pluginRegistry.register(plugin);
1282
+ return this;
1283
+ }
1284
+ /**
1285
+ * Remove a previously registered plugin by name.
1286
+ * No-op if the plugin is not registered on this instance.
1287
+ */
1288
+ unuse(pluginName) {
1289
+ this._pluginRegistry.unregister(pluginName);
1290
+ return this;
1291
+ }
986
1292
  async flush() {
987
1293
  if (this.transportManager) await this.transportManager.flush();
988
1294
  }
@@ -1005,6 +1311,7 @@ var LogixiaLogger = class LogixiaLogger {
1005
1311
  await this.transportManager.close();
1006
1312
  }
1007
1313
  (_this$_sampler = this._sampler) === null || _this$_sampler === void 0 || _this$_sampler.destroy();
1314
+ await this._pluginRegistry.runOnShutdown();
1008
1315
  deregisterFromShutdown(this);
1009
1316
  }
1010
1317
  async log(level, message, data) {
@@ -1015,10 +1322,19 @@ var LogixiaLogger = class LogixiaLogger {
1015
1322
  if (!this._sampler.shouldEmit(level, traceId$1)) return;
1016
1323
  }
1017
1324
  const alsContext = LogixiaContext.get();
1018
- const mergedData = alsContext && Object.keys(alsContext).length > 0 ? {
1325
+ const otelFields = _getOtelPayloadIfEnabled();
1326
+ const hasOtel = Object.keys(otelFields).length > 0;
1327
+ let mergedData;
1328
+ if (alsContext && Object.keys(alsContext).length > 0) mergedData = {
1019
1329
  ...alsContext,
1330
+ ...hasOtel ? otelFields : {},
1331
+ ...data
1332
+ };
1333
+ else if (hasOtel) mergedData = {
1334
+ ...otelFields,
1020
1335
  ...data
1021
- } : data;
1336
+ };
1337
+ else mergedData = data;
1022
1338
  const rawPayload = this._hasContextData ? {
1023
1339
  ...this.contextData,
1024
1340
  ...mergedData
@@ -1036,8 +1352,13 @@ var LogixiaLogger = class LogixiaLogger {
1036
1352
  if (this.context) entry.context = this.context;
1037
1353
  if (payload !== void 0) entry.payload = payload;
1038
1354
  if (traceId !== void 0) entry.traceId = traceId;
1039
- const formattedLog = this.formatLog(entry);
1040
- await this.output(formattedLog, level, entry);
1355
+ let finalEntry = entry;
1356
+ if (this._pluginRegistry.size > 0) {
1357
+ finalEntry = await this._pluginRegistry.runOnLog(entry);
1358
+ if (finalEntry === null) return;
1359
+ }
1360
+ const formattedLog = this.formatLog(finalEntry);
1361
+ await this.output(formattedLog, level, finalEntry);
1041
1362
  }
1042
1363
  /**
1043
1364
  * Hot-path level check: a single Map lookup + integer compare.
@@ -1172,45 +1493,57 @@ let LogixiaLoggerService = _LogixiaLoggerService = class LogixiaLoggerService$1
1172
1493
  });
1173
1494
  }
1174
1495
  /**
1175
- * NestJS LoggerService interface implementation
1496
+ * NestJS `LoggerService.log` void, string context.
1497
+ * Maps internally to `info`.
1498
+ *
1499
+ * @example `logger.log('User signed up', 'AuthService')`
1176
1500
  */
1177
1501
  log(message, context$1) {
1178
1502
  this.setContextIfProvided(context$1);
1179
1503
  this.logger.info(this.formatMessage(message)).catch((err) => require_transport_manager.internalError("LogixiaLoggerService.log failed", err));
1180
1504
  }
1181
- error(message, trace, context$1) {
1505
+ /**
1506
+ * Native async `info` — structured data, returns `Promise<void>`.
1507
+ *
1508
+ * @example `await logger.info('User signed up', { userId: 'u_abc' })`
1509
+ */
1510
+ async info(message, data) {
1511
+ return this.logger.info(message, data);
1512
+ }
1513
+ error(message, dataOrTrace, context$1) {
1514
+ if (typeof dataOrTrace === "object" && dataOrTrace !== null) return message instanceof Error ? this.logger.error(message, dataOrTrace) : this.logger.error(this.formatMessage(message), dataOrTrace);
1182
1515
  this.setContextIfProvided(context$1);
1183
1516
  const errorData = {};
1184
- if (trace) errorData.stack = trace;
1185
- (typeof message === "object" && message instanceof Error ? this.logger.error(message, errorData) : this.logger.error(this.formatMessage(message), errorData)).catch((err) => require_transport_manager.internalError("LogixiaLoggerService.error failed", err));
1517
+ if (typeof dataOrTrace === "string" && dataOrTrace) errorData.stack = dataOrTrace;
1518
+ (message instanceof Error ? this.logger.error(message, errorData) : this.logger.error(this.formatMessage(message), errorData)).catch((err) => require_transport_manager.internalError("LogixiaLoggerService.error failed", err));
1186
1519
  }
1187
- warn(message, context$1) {
1188
- this.setContextIfProvided(context$1);
1520
+ warn(message, dataOrContext) {
1521
+ if (typeof dataOrContext === "object" && dataOrContext !== null) return this.logger.warn(this.formatMessage(message), dataOrContext);
1522
+ this.setContextIfProvided(typeof dataOrContext === "string" ? dataOrContext : void 0);
1189
1523
  this.logger.warn(this.formatMessage(message)).catch((err) => require_transport_manager.internalError("LogixiaLoggerService.warn failed", err));
1190
1524
  }
1191
- debug(message, context$1) {
1192
- this.setContextIfProvided(context$1);
1525
+ debug(message, dataOrContext) {
1526
+ if (typeof dataOrContext === "object" && dataOrContext !== null) return this.logger.debug(this.formatMessage(message), dataOrContext);
1527
+ this.setContextIfProvided(typeof dataOrContext === "string" ? dataOrContext : void 0);
1193
1528
  this.logger.debug(this.formatMessage(message)).catch((err) => require_transport_manager.internalError("LogixiaLoggerService.debug failed", err));
1194
1529
  }
1195
- verbose(message, context$1) {
1196
- this.setContextIfProvided(context$1);
1530
+ verbose(message, dataOrContext) {
1531
+ if (typeof dataOrContext === "object" && dataOrContext !== null) return this.logger.trace(this.formatMessage(message), dataOrContext);
1532
+ this.setContextIfProvided(typeof dataOrContext === "string" ? dataOrContext : void 0);
1197
1533
  this.logger.trace(this.formatMessage(message)).catch((err) => require_transport_manager.internalError("LogixiaLoggerService.verbose failed", err));
1198
1534
  }
1199
1535
  /**
1200
- * Extended Logitron methods
1536
+ * Native async `trace` — lowest verbosity level, structured data.
1201
1537
  */
1202
- async info(message, data) {
1203
- return this.logger.info(message, data);
1204
- }
1205
1538
  async trace(message, data) {
1206
1539
  return this.logger.trace(message, data);
1207
1540
  }
1541
+ /**
1542
+ * Log at any named level with structured data.
1543
+ */
1208
1544
  logLevel(level, message, data) {
1209
1545
  return this.logger.logLevel(level, message, data);
1210
1546
  }
1211
- /**
1212
- * Timing methods
1213
- */
1214
1547
  time(label) {
1215
1548
  this.logger.time(label);
1216
1549
  }
@@ -1220,9 +1553,6 @@ let LogixiaLoggerService = _LogixiaLoggerService = class LogixiaLoggerService$1
1220
1553
  async timeAsync(label, fn) {
1221
1554
  return this.logger.timeAsync(label, fn);
1222
1555
  }
1223
- /**
1224
- * Context and level management
1225
- */
1226
1556
  setContext(context$1) {
1227
1557
  this.context = context$1;
1228
1558
  this.logger.setContext(context$1);
@@ -1236,30 +1566,24 @@ let LogixiaLoggerService = _LogixiaLoggerService = class LogixiaLoggerService$1
1236
1566
  getLevel() {
1237
1567
  return this.logger.getLevel();
1238
1568
  }
1239
- /**
1240
- * Create child logger
1241
- */
1242
1569
  child(context$1, data) {
1243
1570
  const childService = new _LogixiaLoggerService();
1244
1571
  childService.logger = this.logger.child(context$1, data);
1245
1572
  childService.context = context$1;
1246
1573
  return childService;
1247
1574
  }
1248
- /**
1249
- * Get current trace ID
1250
- */
1251
1575
  getCurrentTraceId() {
1252
1576
  return getCurrentTraceId();
1253
1577
  }
1254
- /**
1255
- * Close logger
1256
- */
1257
1578
  async close() {
1258
1579
  return this.logger.close();
1259
1580
  }
1260
- /**
1261
- * Private helper methods
1262
- */
1581
+ static create(config) {
1582
+ return new _LogixiaLoggerService(config);
1583
+ }
1584
+ getLogger() {
1585
+ return this.logger;
1586
+ }
1263
1587
  setContextIfProvided(context$1) {
1264
1588
  if (context$1 && context$1 !== this.context) this.setContext(context$1);
1265
1589
  }
@@ -1268,18 +1592,6 @@ let LogixiaLoggerService = _LogixiaLoggerService = class LogixiaLoggerService$1
1268
1592
  if (typeof message === "object") return JSON.stringify(message);
1269
1593
  return String(message);
1270
1594
  }
1271
- /**
1272
- * Static factory method for easy instantiation
1273
- */
1274
- static create(config) {
1275
- return new _LogixiaLoggerService(config);
1276
- }
1277
- /**
1278
- * Get the underlying Logitron logger instance
1279
- */
1280
- getLogger() {
1281
- return this.logger;
1282
- }
1283
1595
  };
1284
1596
  LogixiaLoggerService = _LogixiaLoggerService = __decorate([(0, __nestjs_common.Injectable)({ scope: __nestjs_common.Scope.TRANSIENT }), __decorateMetadata("design:paramtypes", [Object])], LogixiaLoggerService);
1285
1597
 
@@ -10591,6 +10903,12 @@ Object.defineProperty(exports, 'LogixiaLoggerService', {
10591
10903
  return LogixiaLoggerService;
10592
10904
  }
10593
10905
  });
10906
+ Object.defineProperty(exports, 'PluginRegistry', {
10907
+ enumerable: true,
10908
+ get: function () {
10909
+ return PluginRegistry;
10910
+ }
10911
+ });
10594
10912
  Object.defineProperty(exports, 'TraceMiddleware', {
10595
10913
  enumerable: true,
10596
10914
  get: function () {
@@ -10603,6 +10921,18 @@ Object.defineProperty(exports, 'WebSocketTraceInterceptor', {
10603
10921
  return WebSocketTraceInterceptor;
10604
10922
  }
10605
10923
  });
10924
+ Object.defineProperty(exports, '__decorate', {
10925
+ enumerable: true,
10926
+ get: function () {
10927
+ return __decorate;
10928
+ }
10929
+ });
10930
+ Object.defineProperty(exports, '__decorateMetadata', {
10931
+ enumerable: true,
10932
+ get: function () {
10933
+ return __decorateMetadata;
10934
+ }
10935
+ });
10606
10936
  Object.defineProperty(exports, 'applyRedaction', {
10607
10937
  enumerable: true,
10608
10938
  get: function () {
@@ -10639,6 +10969,12 @@ Object.defineProperty(exports, 'deregisterFromShutdown', {
10639
10969
  return deregisterFromShutdown;
10640
10970
  }
10641
10971
  });
10972
+ Object.defineProperty(exports, 'disableOtelBridge', {
10973
+ enumerable: true,
10974
+ get: function () {
10975
+ return disableOtelBridge;
10976
+ }
10977
+ });
10642
10978
  Object.defineProperty(exports, 'extractTraceId', {
10643
10979
  enumerable: true,
10644
10980
  get: function () {
@@ -10657,12 +10993,36 @@ Object.defineProperty(exports, 'generateTraceId', {
10657
10993
  return generateTraceId;
10658
10994
  }
10659
10995
  });
10996
+ Object.defineProperty(exports, 'getActiveOtelContext', {
10997
+ enumerable: true,
10998
+ get: function () {
10999
+ return getActiveOtelContext;
11000
+ }
11001
+ });
10660
11002
  Object.defineProperty(exports, 'getCurrentTraceId', {
10661
11003
  enumerable: true,
10662
11004
  get: function () {
10663
11005
  return getCurrentTraceId;
10664
11006
  }
10665
11007
  });
11008
+ Object.defineProperty(exports, 'getOtelMetaFields', {
11009
+ enumerable: true,
11010
+ get: function () {
11011
+ return getOtelMetaFields;
11012
+ }
11013
+ });
11014
+ Object.defineProperty(exports, 'globalPluginRegistry', {
11015
+ enumerable: true,
11016
+ get: function () {
11017
+ return globalPluginRegistry;
11018
+ }
11019
+ });
11020
+ Object.defineProperty(exports, 'initOtelBridge', {
11021
+ enumerable: true,
11022
+ get: function () {
11023
+ return initOtelBridge;
11024
+ }
11025
+ });
10666
11026
  Object.defineProperty(exports, 'isError', {
10667
11027
  enumerable: true,
10668
11028
  get: function () {
@@ -10717,4 +11077,10 @@ Object.defineProperty(exports, 'traceStorage', {
10717
11077
  return traceStorage;
10718
11078
  }
10719
11079
  });
10720
- //# sourceMappingURL=logitron-logger.module-BqNKp0Fs.js.map
11080
+ Object.defineProperty(exports, 'usePlugin', {
11081
+ enumerable: true,
11082
+ get: function () {
11083
+ return usePlugin;
11084
+ }
11085
+ });
11086
+ //# sourceMappingURL=logitron-logger.module-B7CsnCYA.js.map