logixia 2.0.9 → 2.0.11

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 (125) hide show
  1. package/dist/{async-context-COuvmwsS.mjs → async-context-BGUCdYAa.mjs} +3 -3
  2. package/dist/{async-context-COuvmwsS.mjs.map → async-context-BGUCdYAa.mjs.map} +1 -1
  3. package/dist/{async-context-Dv0bmPC-.js → async-context-D8um9I5V.js} +3 -3
  4. package/dist/{async-context-Dv0bmPC-.js.map → async-context-D8um9I5V.js.map} +1 -1
  5. package/dist/{azure-monitor.transport-D6ryi8rA.js → azure-monitor.transport-C8KdmsSw.js} +19 -8
  6. package/dist/{azure-monitor.transport-D6ryi8rA.js.map → azure-monitor.transport-C8KdmsSw.js.map} +1 -1
  7. package/dist/{azure-monitor.transport-Coz5Gesu.mjs → azure-monitor.transport-CTnfwA0F.mjs} +19 -8
  8. package/dist/{azure-monitor.transport-Coz5Gesu.mjs.map → azure-monitor.transport-CTnfwA0F.mjs.map} +1 -1
  9. package/dist/azure.js +1 -1
  10. package/dist/azure.mjs +1 -1
  11. package/dist/{batch-buffer-CQUWDMYq.mjs → batch-buffer-BJqzpfpT.mjs} +11 -7
  12. package/dist/{batch-buffer-CQUWDMYq.mjs.map → batch-buffer-BJqzpfpT.mjs.map} +1 -1
  13. package/dist/{batch-buffer-CFzKnuNZ.js → batch-buffer-BTQdAXwC.js} +11 -7
  14. package/dist/{batch-buffer-CFzKnuNZ.js.map → batch-buffer-BTQdAXwC.js.map} +1 -1
  15. package/dist/browser.js +24 -9
  16. package/dist/browser.js.map +1 -1
  17. package/dist/browser.mjs +24 -9
  18. package/dist/browser.mjs.map +1 -1
  19. package/dist/{builder-BlIJNIuk.mjs → builder-C6kKEVrU.mjs} +154 -52
  20. package/dist/builder-C6kKEVrU.mjs.map +1 -0
  21. package/dist/{builder-Bs0qkfkY.js → builder-Up4YxX7l.js} +157 -55
  22. package/dist/builder-Up4YxX7l.js.map +1 -0
  23. package/dist/cli/index.js +21 -16
  24. package/dist/cloudwatch.js +1 -1
  25. package/dist/cloudwatch.mjs +1 -1
  26. package/dist/{cloudwatch.transport-Cr1aeTGj.mjs → cloudwatch.transport-Bl1qzdBx.mjs} +24 -9
  27. package/dist/{cloudwatch.transport-Cr1aeTGj.mjs.map → cloudwatch.transport-Bl1qzdBx.mjs.map} +1 -1
  28. package/dist/{cloudwatch.transport-D4G5xYfG.js → cloudwatch.transport-BoCyxNKO.js} +24 -9
  29. package/dist/{cloudwatch.transport-D4G5xYfG.js.map → cloudwatch.transport-BoCyxNKO.js.map} +1 -1
  30. package/dist/correlation.js +3 -3
  31. package/dist/correlation.mjs +3 -3
  32. package/dist/{coerce.utils-C1C5sIX0.js → csv.utils-CbVHY1pd.js} +24 -1
  33. package/dist/csv.utils-CbVHY1pd.js.map +1 -0
  34. package/dist/{coerce.utils-B_rEudCn.mjs → csv.utils-ZdxSod5g.mjs} +19 -2
  35. package/dist/csv.utils-ZdxSod5g.mjs.map +1 -0
  36. package/dist/{entry-fields-CVwoQplO.js → entry-fields-CJbeaoBs.js} +2 -2
  37. package/dist/{entry-fields-CVwoQplO.js.map → entry-fields-CJbeaoBs.js.map} +1 -1
  38. package/dist/{entry-fields-DNTKQxoU.mjs → entry-fields-D_aNnjg0.mjs} +2 -2
  39. package/dist/{entry-fields-DNTKQxoU.mjs.map → entry-fields-D_aNnjg0.mjs.map} +1 -1
  40. package/dist/gcp.js +1 -1
  41. package/dist/gcp.mjs +1 -1
  42. package/dist/{gcp.transport-LLK2bw2-.mjs → gcp.transport-DOH4bpWM.mjs} +18 -9
  43. package/dist/{gcp.transport-LLK2bw2-.mjs.map → gcp.transport-DOH4bpWM.mjs.map} +1 -1
  44. package/dist/{gcp.transport-CVuRpchl.js → gcp.transport-D_NHVZrw.js} +18 -9
  45. package/dist/{gcp.transport-CVuRpchl.js.map → gcp.transport-D_NHVZrw.js.map} +1 -1
  46. package/dist/index.d.mts +1 -1
  47. package/dist/index.d.mts.map +1 -1
  48. package/dist/index.d.ts +1 -1
  49. package/dist/index.d.ts.map +1 -1
  50. package/dist/index.js +35 -19
  51. package/dist/index.js.map +1 -1
  52. package/dist/index.mjs +32 -16
  53. package/dist/index.mjs.map +1 -1
  54. package/dist/logitron-logger-DVUdgmBY.d.ts.map +1 -1
  55. package/dist/logitron-logger-DoWmMjYB.d.mts.map +1 -1
  56. package/dist/middleware.d.mts.map +1 -1
  57. package/dist/middleware.d.ts.map +1 -1
  58. package/dist/middleware.js +10 -6
  59. package/dist/middleware.js.map +1 -1
  60. package/dist/middleware.mjs +10 -6
  61. package/dist/middleware.mjs.map +1 -1
  62. package/dist/nest.d.mts +4 -3
  63. package/dist/nest.d.mts.map +1 -1
  64. package/dist/nest.d.ts +4 -3
  65. package/dist/nest.d.ts.map +1 -1
  66. package/dist/nest.js +41 -20
  67. package/dist/nest.js.map +1 -1
  68. package/dist/nest.mjs +39 -18
  69. package/dist/nest.mjs.map +1 -1
  70. package/dist/{otel-DOuwGPCd.mjs → otel-DAVxpArV.mjs} +135 -56
  71. package/dist/otel-DAVxpArV.mjs.map +1 -0
  72. package/dist/{otel-ChnVYRLA.js → otel-DH6-G6DR.js} +137 -58
  73. package/dist/otel-DH6-G6DR.js.map +1 -0
  74. package/dist/{request-trace-ByujsUZk.js → request-trace-C7kXMjx5.js} +5 -6
  75. package/dist/{request-trace-ByujsUZk.js.map → request-trace-C7kXMjx5.js.map} +1 -1
  76. package/dist/{request-trace-BgNykH9M.mjs → request-trace-Dekcnenb.mjs} +5 -6
  77. package/dist/{request-trace-BgNykH9M.mjs.map → request-trace-Dekcnenb.mjs.map} +1 -1
  78. package/dist/{safe-stringify-CN7icp8S.js → safe-stringify-CJisLyZ3.js} +2 -2
  79. package/dist/{safe-stringify-CN7icp8S.js.map → safe-stringify-CJisLyZ3.js.map} +1 -1
  80. package/dist/{safe-stringify--7gbe95n.mjs → safe-stringify-pZOnzGRJ.mjs} +2 -2
  81. package/dist/{safe-stringify--7gbe95n.mjs.map → safe-stringify-pZOnzGRJ.mjs.map} +1 -1
  82. package/dist/{search-DPwTKPve.d.ts → search-B4eEzrhM.d.ts} +3 -6
  83. package/dist/{search-DPwTKPve.d.ts.map → search-B4eEzrhM.d.ts.map} +1 -1
  84. package/dist/{search-CRjhHxe9.js → search-CJw_xoQl.js} +44 -35
  85. package/dist/search-CJw_xoQl.js.map +1 -0
  86. package/dist/{search-DAXKE-P9.mjs → search-CjYl-mo5.mjs} +41 -32
  87. package/dist/search-CjYl-mo5.mjs.map +1 -0
  88. package/dist/{search-D-8HJADE.d.mts → search-Crf2IEoA.d.mts} +3 -6
  89. package/dist/{search-D-8HJADE.d.mts.map → search-Crf2IEoA.d.mts.map} +1 -1
  90. package/dist/search.d.mts +1 -1
  91. package/dist/search.d.ts +1 -1
  92. package/dist/search.js +1 -1
  93. package/dist/search.mjs +1 -1
  94. package/dist/{secret-config-BvFl2dC8.js → secret-config-6hdODxBb.js} +2 -2
  95. package/dist/{secret-config-BvFl2dC8.js.map → secret-config-6hdODxBb.js.map} +1 -1
  96. package/dist/{secret-config-ByGq7kJd.mjs → secret-config-D1F4MW69.mjs} +2 -2
  97. package/dist/{secret-config-ByGq7kJd.mjs.map → secret-config-D1F4MW69.mjs.map} +1 -1
  98. package/dist/{sensitive-names-CHMowujD.js → sensitive-names-CNgHaqv9.js} +7 -1
  99. package/dist/{sensitive-names-CHMowujD.js.map → sensitive-names-CNgHaqv9.js.map} +1 -1
  100. package/dist/{sensitive-names-o__1PUUR.mjs → sensitive-names-wv27qBQC.mjs} +2 -2
  101. package/dist/{sensitive-names-o__1PUUR.mjs.map → sensitive-names-wv27qBQC.mjs.map} +1 -1
  102. package/dist/{slack.transport-zLQ9MGxS.js → slack.transport-CEYBVzUj.js} +46 -18
  103. package/dist/{slack.transport-zLQ9MGxS.js.map → slack.transport-CEYBVzUj.js.map} +1 -1
  104. package/dist/{slack.transport-CSj1j0_X.mjs → slack.transport-YvaLJxNv.mjs} +46 -18
  105. package/dist/{slack.transport-CSj1j0_X.mjs.map → slack.transport-YvaLJxNv.mjs.map} +1 -1
  106. package/dist/transports.d.mts.map +1 -1
  107. package/dist/transports.d.ts.map +1 -1
  108. package/dist/transports.js +6 -6
  109. package/dist/transports.mjs +6 -6
  110. package/dist/worker-entry.js +109 -41
  111. package/dist/worker.js +1 -1
  112. package/dist/worker.mjs +1 -1
  113. package/dist/{worker.transport-DQDv1nAJ.js → worker.transport-CwNpH98o.js} +21 -13
  114. package/dist/{worker.transport-DQDv1nAJ.js.map → worker.transport-CwNpH98o.js.map} +1 -1
  115. package/dist/{worker.transport-D78xhNhB.mjs → worker.transport-DgK_ZXlB.mjs} +21 -13
  116. package/dist/{worker.transport-D78xhNhB.mjs.map → worker.transport-DgK_ZXlB.mjs.map} +1 -1
  117. package/package.json +10 -3
  118. package/dist/builder-BlIJNIuk.mjs.map +0 -1
  119. package/dist/builder-Bs0qkfkY.js.map +0 -1
  120. package/dist/coerce.utils-B_rEudCn.mjs.map +0 -1
  121. package/dist/coerce.utils-C1C5sIX0.js.map +0 -1
  122. package/dist/otel-ChnVYRLA.js.map +0 -1
  123. package/dist/otel-DOuwGPCd.mjs.map +0 -1
  124. package/dist/search-CRjhHxe9.js.map +0 -1
  125. package/dist/search-DAXKE-P9.mjs.map +0 -1
@@ -1,11 +1,11 @@
1
- import { l as assignOwn, r as SENSITIVE_KEY_NAMES } from "./sensitive-names-o__1PUUR.mjs";
2
- import { o as TraceContext } from "./request-trace-BgNykH9M.mjs";
3
- import { t as LogixiaContext } from "./async-context-COuvmwsS.mjs";
4
- import { n as protectSecrets } from "./secret-config-ByGq7kJd.mjs";
1
+ import { a as buildNameSet, n as DEFAULT_REDACT_QUERY_PARAMS, o as redactUrlQuery, r as SENSITIVE_KEY_NAMES, s as redactUrlsInText, u as assignOwn } from "./sensitive-names-wv27qBQC.mjs";
2
+ import { o as TraceContext } from "./request-trace-Dekcnenb.mjs";
3
+ import { t as LogixiaContext } from "./async-context-BGUCdYAa.mjs";
4
+ import { n as protectSecrets } from "./secret-config-D1F4MW69.mjs";
5
5
  import { n as internalLog, r as internalWarn, t as internalError } from "./internal-log-Cy5nF1ZL.mjs";
6
- import { t as safeToString } from "./coerce.utils-B_rEudCn.mjs";
7
- import { i as stringifyForLog } from "./safe-stringify--7gbe95n.mjs";
8
- import { c as TransportManager, n as _getOtelPayloadIfEnabled, r as _isOtelBridgeEnabled, v as stripControlChars } from "./otel-DOuwGPCd.mjs";
6
+ import { n as safeToString } from "./csv.utils-ZdxSod5g.mjs";
7
+ import { i as stringifyForLog } from "./safe-stringify-pZOnzGRJ.mjs";
8
+ import { c as TransportManager, n as _getOtelPayloadIfEnabled, r as _isOtelBridgeEnabled, v as stripControlChars } from "./otel-DAVxpArV.mjs";
9
9
  import { constants } from "node:os";
10
10
  // src/types/index.ts
11
11
  const LogLevel = {
@@ -83,9 +83,7 @@ const DEFAULT_CONFIG = {
83
83
  * singleton is also exported for process-wide registration.
84
84
  */
85
85
  var PluginRegistry = class {
86
- constructor() {
87
- this._plugins = [];
88
- }
86
+ _plugins = [];
89
87
  /**
90
88
  * Register a plugin. Silently skips if a plugin with the same `name` is
91
89
  * already registered on this registry.
@@ -517,6 +515,35 @@ const CIRCULAR = "[Circular]";
517
515
  function joinPath(parent, key) {
518
516
  return parent ? `${parent}.${key}` : key;
519
517
  }
518
+ const CORRELATION_ID_KEYS = /* @__PURE__ */ new Set([
519
+ "traceid",
520
+ "spanid",
521
+ "parentspanid",
522
+ "requestid",
523
+ "correlationid",
524
+ "traceparent",
525
+ "xrequestid",
526
+ "xcorrelationid",
527
+ "xtraceid",
528
+ "xamzntraceid"
529
+ ]);
530
+ const ID_SHAPED = /^[\w.:;=-]{1,256}$/;
531
+ const DEFAULT_QUERY_NAMES = buildNameSet(DEFAULT_REDACT_QUERY_PARAMS, void 0);
532
+ const queryNameSets = /* @__PURE__ */ new WeakMap();
533
+ function queryNamesOf(config) {
534
+ const extra = config.queryParams;
535
+ if (!extra || extra.length === 0) return DEFAULT_QUERY_NAMES;
536
+ let names = queryNameSets.get(extra);
537
+ if (!names) {
538
+ names = buildNameSet(DEFAULT_REDACT_QUERY_PARAMS, extra);
539
+ queryNameSets.set(extra, names);
540
+ }
541
+ return names;
542
+ }
543
+ function isCorrelationId(fullPath, value) {
544
+ const key = fullPath.slice(fullPath.lastIndexOf(".") + 1);
545
+ return CORRELATION_ID_KEYS.has(key.toLowerCase().replace(/[-_]/g, "")) && ID_SHAPED.test(value);
546
+ }
520
547
  function walkValue(value, state, fullPath, bare, depth) {
521
548
  const { paths = [], excludePaths = [], patterns = [], censor = DEFAULT_CENSOR } = state.config;
522
549
  if (paths.some((p) => matchesPath(fullPath, p) || matchesPath(bare, p))) return censor;
@@ -526,8 +553,9 @@ function walkValue(value, state, fullPath, bare, depth) {
526
553
  }
527
554
  if (typeof value === "string") {
528
555
  if (patterns.length === 0) return value;
556
+ if (isCorrelationId(fullPath, value)) return value;
529
557
  if (excludePaths.some((p) => matchesPath(fullPath, p) || matchesPath(bare, p))) return value;
530
- return applyPatterns(value, patterns, censor);
558
+ return applyPatterns(value.includes("?") ? redactUrlsInText(value, queryNamesOf(state.config)) : value, patterns, censor);
531
559
  }
532
560
  if (Array.isArray(value)) return walkContainer(value, state, fullPath, bare, depth, walkArray);
533
561
  if (value instanceof Error) return walkContainer(value, state, fullPath, bare, depth, walkError);
@@ -535,7 +563,7 @@ function walkValue(value, state, fullPath, bare, depth) {
535
563
  const url = new URL(value.href);
536
564
  url.username = "";
537
565
  url.password = "";
538
- const redacted = walkValue(url.href, state, fullPath, bare, depth);
566
+ const redacted = walkValue(redactUrlQuery(url.href, queryNamesOf(state.config)), state, fullPath, bare, depth);
539
567
  return redacted === value.href ? value : redacted;
540
568
  }
541
569
  if (isPlainObject(value)) return walkContainer(value, state, fullPath, bare, depth, typeof value.toJSON === "function" ? walkToJSON : walkRecord);
@@ -611,14 +639,27 @@ function redactObject(obj, config, _currentPath = "") {
611
639
  }, _currentPath, _currentPath, 0);
612
640
  return result === obj ? { ...obj } : result;
613
641
  }
642
+ function redactMessageObject(value, config) {
643
+ if (!Array.isArray(value)) return applyRedaction(value, config);
644
+ return value.map((item) => {
645
+ var _applyRedaction;
646
+ if (typeof item === "string") return applyRedactionToString(item, config);
647
+ if (item === null || typeof item !== "object") return item;
648
+ if (!Array.isArray(item)) return applyRedaction(item, config);
649
+ return (_applyRedaction = applyRedaction({ items: item }, config)) === null || _applyRedaction === void 0 ? void 0 : _applyRedaction["items"];
650
+ });
651
+ }
614
652
  /**
615
- * Apply pattern-based redaction to a single string (e.g. the log message).
653
+ * Apply redaction to the log message and return it as a string.
616
654
  *
617
- * Path-based rules don't apply to a bare string — only the `patterns` are run.
655
+ * A string message gets only the `patterns`, because path rules don't apply to a
656
+ * bare string. An object logged as the message (`logger.log(dto)` in NestJS) gets
657
+ * every rule, as a payload would, before it is turned into a string.
618
658
  * Returns the input unchanged when no patterns are configured, so the hot path
619
659
  * stays allocation-free for the common no-redact case.
620
660
  */
621
661
  function applyRedactionToString(value, config) {
662
+ if (config && value !== null && typeof value === "object") return safeToString(redactMessageObject(value, config));
622
663
  const text = typeof value === "string" ? value : safeToString(value);
623
664
  if (!config) return text;
624
665
  const resolved = resolveConfig(config);
@@ -671,23 +712,31 @@ function isCacheableTraceId(id) {
671
712
  return true;
672
713
  }
673
714
  var Sampler = class {
715
+ config;
716
+ /**
717
+ * Per-trace decisions in LRU order (Map preserves insertion order; a hit
718
+ * re-inserts the key). Survives resetStats() so a long trace is not re-decided
719
+ * mid-flight. Bounded by size, by an idle TTL (refreshed on hit) and by a hard
720
+ * lifetime measured from the first decision.
721
+ */
722
+ traceDecisions = /* @__PURE__ */ new Map();
723
+ maxTrackedTraces = 1e5;
724
+ traceTtlMs = 3e5;
725
+ traceMaxLifetimeMs = 36e5;
726
+ _tokenBucket = 0;
727
+ _lastRefillMs = Date.now();
728
+ _adaptiveWindow = [];
729
+ _adaptiveHead = 0;
730
+ _adaptiveErrors = 0;
731
+ _stats = {
732
+ evaluated: 0,
733
+ emitted: 0,
734
+ dropped: 0,
735
+ byLevel: {},
736
+ windowStart: Date.now()
737
+ };
738
+ _statsTimer;
674
739
  constructor(config, onStats) {
675
- this.traceDecisions = /* @__PURE__ */ new Map();
676
- this.maxTrackedTraces = 1e5;
677
- this.traceTtlMs = 3e5;
678
- this.traceMaxLifetimeMs = 36e5;
679
- this._tokenBucket = 0;
680
- this._lastRefillMs = Date.now();
681
- this._adaptiveWindow = [];
682
- this._adaptiveHead = 0;
683
- this._adaptiveErrors = 0;
684
- this._stats = {
685
- evaluated: 0,
686
- emitted: 0,
687
- dropped: 0,
688
- byLevel: {},
689
- windowStart: Date.now()
690
- };
691
740
  this.config = config;
692
741
  if (config.maxLogsPerSecond && config.maxLogsPerSecond > 0) this._tokenBucket = config.maxLogsPerSecond;
693
742
  const interval = config.statsIntervalMs ?? 6e4;
@@ -1077,6 +1126,10 @@ function toJsonEntry(entry) {
1077
1126
  }
1078
1127
  return copy ?? entry;
1079
1128
  }
1129
+ function toContextLabel(context) {
1130
+ if (context === void 0 || context === null) return "";
1131
+ return typeof context === "string" ? context : safeToString(context);
1132
+ }
1080
1133
  function namespacePatternToRegex(pattern) {
1081
1134
  const escaped = pattern.split(".").map((s) => s === "*" ? "[^.]+" : s.replace(/[$()*+.?[\\\]^{|}]/g, "\\$&")).join("\\.");
1082
1135
  return new RegExp(`^${escaped}$`);
@@ -1145,26 +1198,58 @@ function resolveInitialLevel(config) {
1145
1198
  * ```
1146
1199
  */
1147
1200
  var LogixiaLogger = class LogixiaLogger {
1201
+ config;
1202
+ context;
1203
+ timers = /* @__PURE__ */ new Map();
1204
+ contextData = {};
1205
+ transportManager;
1206
+ fieldState = /* @__PURE__ */ new Map();
1207
+ /** Stable fallback trace ID generated ONCE per logger instance. */
1208
+ fallbackTraceId = TraceContext.instance.generate();
1209
+ /** Numeric value for each known log level — built once, read on every log call. */
1210
+ _levelValues = /* @__PURE__ */ new Map();
1211
+ /** Numeric threshold for the currently active log level. */
1212
+ _minLevelValue = 2;
1213
+ /** Level set via setLevel(); outranks every other level source until the process ends. */
1214
+ _runtimeLevel;
1215
+ /** `source=value` pairs already reported as unknown levels — warn once per logger. */
1216
+ _warnedInvalidLevels = /* @__PURE__ */ new Set();
1217
+ /** Pre-built ANSI color codes to avoid recreating the object in colorize(). */
1218
+ _colorMap = /* @__PURE__ */ new Map();
1219
+ /** Pre-computed field-enabled booleans so isFieldEnabled() isn't called per log. */
1220
+ _fieldCache = /* @__PURE__ */ new Map();
1221
+ /** True when contextData is non-empty — avoids Object.keys() check on hot path. */
1222
+ _hasContextData = false;
1223
+ /**
1224
+ * Pre-computed `[INFO] `, `[WARN] ` etc. strings — avoids a colorize() call per log.
1225
+ * Key: lowercase level name. Value: formatted bracket string ready to concatenate.
1226
+ */
1227
+ _formattedLevels = /* @__PURE__ */ new Map();
1228
+ /** Pre-computed `[appName] ` string — avoids template literal allocation per log. */
1229
+ _formattedAppName = "";
1230
+ /**
1231
+ * JSON line pieces between the timestamp and the message, keyed by level, for the
1232
+ * appName and environment they were built from. Rebuilt when either changes.
1233
+ */
1234
+ _jsonHeads = /* @__PURE__ */ new Map();
1235
+ _jsonHeadsApp = "";
1236
+ _jsonHeadsEnv = "";
1237
+ /** The `,"context":"..."` piece for `_jsonContextKey`. */
1238
+ _jsonContextKey = void 0;
1239
+ _jsonContext = "";
1240
+ /** True when a redact config is present — short-circuits applyRedaction when false. */
1241
+ _hasRedact = false;
1242
+ /** Sampling engine — only created when sampling config is present. */
1243
+ _sampler;
1244
+ /** Per-instance plugin registry — also inherits from the global registry at creation time. */
1245
+ _pluginRegistry;
1246
+ /** Set on loggers created by child(); they borrow the root's transports, sampler and plugins. */
1247
+ _parent;
1248
+ /** Namespace level map shared by a logger and all its children; `version` bumps on every change. */
1249
+ _nsStore;
1250
+ /** Store version this logger's threshold was last computed against. */
1251
+ _nsSeenVersion = 0;
1148
1252
  constructor(config, context, parent) {
1149
- this.timers = /* @__PURE__ */ new Map();
1150
- this.contextData = {};
1151
- this.fieldState = /* @__PURE__ */ new Map();
1152
- this.fallbackTraceId = TraceContext.instance.generate();
1153
- this._levelValues = /* @__PURE__ */ new Map();
1154
- this._minLevelValue = 2;
1155
- this._warnedInvalidLevels = /* @__PURE__ */ new Set();
1156
- this._colorMap = /* @__PURE__ */ new Map();
1157
- this._fieldCache = /* @__PURE__ */ new Map();
1158
- this._hasContextData = false;
1159
- this._formattedLevels = /* @__PURE__ */ new Map();
1160
- this._formattedAppName = "";
1161
- this._jsonHeads = /* @__PURE__ */ new Map();
1162
- this._jsonHeadsApp = "";
1163
- this._jsonHeadsEnv = "";
1164
- this._jsonContextKey = void 0;
1165
- this._jsonContext = "";
1166
- this._hasRedact = false;
1167
- this._nsSeenVersion = 0;
1168
1253
  this._parent = parent;
1169
1254
  this._nsStore = parent ? parent._nsStore : {
1170
1255
  levels: { ...config.namespaceLevels },
@@ -1220,7 +1305,7 @@ var LogixiaLogger = class LogixiaLogger {
1220
1305
  payload: "[payload]",
1221
1306
  timeTaken: "[time_taken_MS]"
1222
1307
  };
1223
- this.context = context ?? "";
1308
+ this.context = toContextLabel(context);
1224
1309
  protectSecrets(this, ["config"]);
1225
1310
  if (parent) {
1226
1311
  this.transportManager = parent.transportManager;
@@ -1767,7 +1852,8 @@ var LogixiaLogger = class LogixiaLogger {
1767
1852
  }
1768
1853
  else payload = rawPayload;
1769
1854
  }
1770
- let safeMessage = message;
1855
+ const rawMessage = message;
1856
+ let safeMessage = rawMessage !== null && typeof rawMessage === "object" ? safeToString(rawMessage) : message;
1771
1857
  if (this._hasRedact) try {
1772
1858
  safeMessage = applyRedactionToString(message, config.redact);
1773
1859
  } catch (error) {
@@ -1958,6 +2044,22 @@ function createLogger(config, context) {
1958
2044
  }
1959
2045
  // src/exceptions/exception.ts
1960
2046
  var LogixiaException = class extends Error {
2047
+ /** @readonly The machine-readable error code supplied by the caller. */
2048
+ errorCode;
2049
+ /** @readonly The error type category supplied by the caller. */
2050
+ errorType;
2051
+ /** @readonly HTTP status code to respond with. */
2052
+ httpStatus;
2053
+ /** @readonly Field pointer that caused this error (Stripe pattern). */
2054
+ param;
2055
+ /** @readonly Field-level validation errors (GitHub pattern). */
2056
+ details;
2057
+ /** @readonly Documentation URL for this error (Twilio pattern). */
2058
+ docUrl;
2059
+ /**
2060
+ * @readonly Extra context for your logger — never serialised into the HTTP response.
2061
+ */
2062
+ metadata;
1961
2063
  constructor(options) {
1962
2064
  super(options.message, { cause: options.cause });
1963
2065
  this.name = "LogixiaException";
@@ -2181,4 +2283,4 @@ var ErrorResponseBuilder = class {
2181
2283
  };
2182
2284
  export { DEFAULT_LOG_COLORS as C, DEFAULT_CONFIG as S, LogLevel as T, serializeError as _, isLogixiaException as a, globalPluginRegistry as b, _shutdownRegistrySize as c, registerForShutdown as d, resetShutdownHandlers as f, normalizeError as g, isError as h, LogixiaException as i, deregisterFromShutdown as l, redactObject as m, generateRequestId as n, LogixiaLogger as o, applyRedaction as p, generateTraceId as r, createLogger as s, ErrorResponseBuilder as t, flushOnExit as u, serializeNestedErrors as v, DEFAULT_LOG_LEVELS as w, usePlugin as x, PluginRegistry as y };
2183
2285
 
2184
- //# sourceMappingURL=builder-BlIJNIuk.mjs.map
2286
+ //# sourceMappingURL=builder-C6kKEVrU.mjs.map