logixia 2.0.10 → 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.
- package/dist/{async-context-COuvmwsS.mjs → async-context-BGUCdYAa.mjs} +3 -3
- package/dist/{async-context-COuvmwsS.mjs.map → async-context-BGUCdYAa.mjs.map} +1 -1
- package/dist/{async-context-Dv0bmPC-.js → async-context-D8um9I5V.js} +3 -3
- package/dist/{async-context-Dv0bmPC-.js.map → async-context-D8um9I5V.js.map} +1 -1
- package/dist/{azure-monitor.transport-D6ryi8rA.js → azure-monitor.transport-C8KdmsSw.js} +19 -8
- package/dist/{azure-monitor.transport-D6ryi8rA.js.map → azure-monitor.transport-C8KdmsSw.js.map} +1 -1
- package/dist/{azure-monitor.transport-Coz5Gesu.mjs → azure-monitor.transport-CTnfwA0F.mjs} +19 -8
- package/dist/{azure-monitor.transport-Coz5Gesu.mjs.map → azure-monitor.transport-CTnfwA0F.mjs.map} +1 -1
- package/dist/azure.js +1 -1
- package/dist/azure.mjs +1 -1
- package/dist/{batch-buffer-CQUWDMYq.mjs → batch-buffer-BJqzpfpT.mjs} +11 -7
- package/dist/{batch-buffer-CQUWDMYq.mjs.map → batch-buffer-BJqzpfpT.mjs.map} +1 -1
- package/dist/{batch-buffer-CFzKnuNZ.js → batch-buffer-BTQdAXwC.js} +11 -7
- package/dist/{batch-buffer-CFzKnuNZ.js.map → batch-buffer-BTQdAXwC.js.map} +1 -1
- package/dist/browser.js +24 -9
- package/dist/browser.js.map +1 -1
- package/dist/browser.mjs +24 -9
- package/dist/browser.mjs.map +1 -1
- package/dist/{builder-Bj3mDeBw.mjs → builder-C6kKEVrU.mjs} +149 -51
- package/dist/builder-C6kKEVrU.mjs.map +1 -0
- package/dist/{builder-BLIStsCK.js → builder-Up4YxX7l.js} +153 -55
- package/dist/builder-Up4YxX7l.js.map +1 -0
- package/dist/cli/index.js +21 -16
- package/dist/cloudwatch.js +1 -1
- package/dist/cloudwatch.mjs +1 -1
- package/dist/{cloudwatch.transport-Cr1aeTGj.mjs → cloudwatch.transport-Bl1qzdBx.mjs} +24 -9
- package/dist/{cloudwatch.transport-Cr1aeTGj.mjs.map → cloudwatch.transport-Bl1qzdBx.mjs.map} +1 -1
- package/dist/{cloudwatch.transport-D4G5xYfG.js → cloudwatch.transport-BoCyxNKO.js} +24 -9
- package/dist/{cloudwatch.transport-D4G5xYfG.js.map → cloudwatch.transport-BoCyxNKO.js.map} +1 -1
- package/dist/correlation.js +3 -3
- package/dist/correlation.mjs +3 -3
- package/dist/{coerce.utils-C1C5sIX0.js → csv.utils-CbVHY1pd.js} +24 -1
- package/dist/csv.utils-CbVHY1pd.js.map +1 -0
- package/dist/{coerce.utils-B_rEudCn.mjs → csv.utils-ZdxSod5g.mjs} +19 -2
- package/dist/csv.utils-ZdxSod5g.mjs.map +1 -0
- package/dist/{entry-fields-CVwoQplO.js → entry-fields-CJbeaoBs.js} +2 -2
- package/dist/{entry-fields-CVwoQplO.js.map → entry-fields-CJbeaoBs.js.map} +1 -1
- package/dist/{entry-fields-DNTKQxoU.mjs → entry-fields-D_aNnjg0.mjs} +2 -2
- package/dist/{entry-fields-DNTKQxoU.mjs.map → entry-fields-D_aNnjg0.mjs.map} +1 -1
- package/dist/gcp.js +1 -1
- package/dist/gcp.mjs +1 -1
- package/dist/{gcp.transport-LLK2bw2-.mjs → gcp.transport-DOH4bpWM.mjs} +18 -9
- package/dist/{gcp.transport-LLK2bw2-.mjs.map → gcp.transport-DOH4bpWM.mjs.map} +1 -1
- package/dist/{gcp.transport-CVuRpchl.js → gcp.transport-D_NHVZrw.js} +18 -9
- package/dist/{gcp.transport-CVuRpchl.js.map → gcp.transport-D_NHVZrw.js.map} +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +35 -19
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +32 -16
- package/dist/index.mjs.map +1 -1
- package/dist/logitron-logger-DVUdgmBY.d.ts.map +1 -1
- package/dist/logitron-logger-DoWmMjYB.d.mts.map +1 -1
- package/dist/middleware.d.mts.map +1 -1
- package/dist/middleware.d.ts.map +1 -1
- package/dist/middleware.js +10 -6
- package/dist/middleware.js.map +1 -1
- package/dist/middleware.mjs +10 -6
- package/dist/middleware.mjs.map +1 -1
- package/dist/nest.d.mts +4 -3
- package/dist/nest.d.mts.map +1 -1
- package/dist/nest.d.ts +4 -3
- package/dist/nest.d.ts.map +1 -1
- package/dist/nest.js +41 -20
- package/dist/nest.js.map +1 -1
- package/dist/nest.mjs +39 -18
- package/dist/nest.mjs.map +1 -1
- package/dist/{otel-DOuwGPCd.mjs → otel-DAVxpArV.mjs} +135 -56
- package/dist/otel-DAVxpArV.mjs.map +1 -0
- package/dist/{otel-ChnVYRLA.js → otel-DH6-G6DR.js} +137 -58
- package/dist/otel-DH6-G6DR.js.map +1 -0
- package/dist/{request-trace-ByujsUZk.js → request-trace-C7kXMjx5.js} +5 -6
- package/dist/{request-trace-ByujsUZk.js.map → request-trace-C7kXMjx5.js.map} +1 -1
- package/dist/{request-trace-BgNykH9M.mjs → request-trace-Dekcnenb.mjs} +5 -6
- package/dist/{request-trace-BgNykH9M.mjs.map → request-trace-Dekcnenb.mjs.map} +1 -1
- package/dist/{safe-stringify-CN7icp8S.js → safe-stringify-CJisLyZ3.js} +2 -2
- package/dist/{safe-stringify-CN7icp8S.js.map → safe-stringify-CJisLyZ3.js.map} +1 -1
- package/dist/{safe-stringify--7gbe95n.mjs → safe-stringify-pZOnzGRJ.mjs} +2 -2
- package/dist/{safe-stringify--7gbe95n.mjs.map → safe-stringify-pZOnzGRJ.mjs.map} +1 -1
- package/dist/{search-DPwTKPve.d.ts → search-B4eEzrhM.d.ts} +3 -6
- package/dist/{search-DPwTKPve.d.ts.map → search-B4eEzrhM.d.ts.map} +1 -1
- package/dist/{search-CRjhHxe9.js → search-CJw_xoQl.js} +44 -35
- package/dist/search-CJw_xoQl.js.map +1 -0
- package/dist/{search-DAXKE-P9.mjs → search-CjYl-mo5.mjs} +41 -32
- package/dist/search-CjYl-mo5.mjs.map +1 -0
- package/dist/{search-D-8HJADE.d.mts → search-Crf2IEoA.d.mts} +3 -6
- package/dist/{search-D-8HJADE.d.mts.map → search-Crf2IEoA.d.mts.map} +1 -1
- package/dist/search.d.mts +1 -1
- package/dist/search.d.ts +1 -1
- package/dist/search.js +1 -1
- package/dist/search.mjs +1 -1
- package/dist/{secret-config-BvFl2dC8.js → secret-config-6hdODxBb.js} +2 -2
- package/dist/{secret-config-BvFl2dC8.js.map → secret-config-6hdODxBb.js.map} +1 -1
- package/dist/{secret-config-ByGq7kJd.mjs → secret-config-D1F4MW69.mjs} +2 -2
- package/dist/{secret-config-ByGq7kJd.mjs.map → secret-config-D1F4MW69.mjs.map} +1 -1
- package/dist/{sensitive-names-CHMowujD.js → sensitive-names-CNgHaqv9.js} +7 -1
- package/dist/{sensitive-names-CHMowujD.js.map → sensitive-names-CNgHaqv9.js.map} +1 -1
- package/dist/{sensitive-names-o__1PUUR.mjs → sensitive-names-wv27qBQC.mjs} +2 -2
- package/dist/{sensitive-names-o__1PUUR.mjs.map → sensitive-names-wv27qBQC.mjs.map} +1 -1
- package/dist/{slack.transport-zLQ9MGxS.js → slack.transport-CEYBVzUj.js} +46 -18
- package/dist/{slack.transport-zLQ9MGxS.js.map → slack.transport-CEYBVzUj.js.map} +1 -1
- package/dist/{slack.transport-CSj1j0_X.mjs → slack.transport-YvaLJxNv.mjs} +46 -18
- package/dist/{slack.transport-CSj1j0_X.mjs.map → slack.transport-YvaLJxNv.mjs.map} +1 -1
- package/dist/transports.d.mts.map +1 -1
- package/dist/transports.d.ts.map +1 -1
- package/dist/transports.js +6 -6
- package/dist/transports.mjs +6 -6
- package/dist/worker-entry.js +109 -41
- package/dist/worker.js +1 -1
- package/dist/worker.mjs +1 -1
- package/dist/{worker.transport-DQDv1nAJ.js → worker.transport-CwNpH98o.js} +21 -13
- package/dist/{worker.transport-DQDv1nAJ.js.map → worker.transport-CwNpH98o.js.map} +1 -1
- package/dist/{worker.transport-D78xhNhB.mjs → worker.transport-DgK_ZXlB.mjs} +21 -13
- package/dist/{worker.transport-D78xhNhB.mjs.map → worker.transport-DgK_ZXlB.mjs.map} +1 -1
- package/package.json +10 -3
- package/dist/builder-BLIStsCK.js.map +0 -1
- package/dist/builder-Bj3mDeBw.mjs.map +0 -1
- package/dist/coerce.utils-B_rEudCn.mjs.map +0 -1
- package/dist/coerce.utils-C1C5sIX0.js.map +0 -1
- package/dist/otel-ChnVYRLA.js.map +0 -1
- package/dist/otel-DOuwGPCd.mjs.map +0 -1
- package/dist/search-CRjhHxe9.js.map +0 -1
- package/dist/search-DAXKE-P9.mjs.map +0 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
const require_secret_config = require("./secret-config-
|
|
2
|
-
const require_sensitive_names = require("./sensitive-names-
|
|
3
|
-
const require_request_trace = require("./request-trace-
|
|
4
|
-
const require_async_context = require("./async-context-
|
|
1
|
+
const require_secret_config = require("./secret-config-6hdODxBb.js");
|
|
2
|
+
const require_sensitive_names = require("./sensitive-names-CNgHaqv9.js");
|
|
3
|
+
const require_request_trace = require("./request-trace-C7kXMjx5.js");
|
|
4
|
+
const require_async_context = require("./async-context-D8um9I5V.js");
|
|
5
5
|
const require_internal_log = require("./internal-log-DwqTjhpb.js");
|
|
6
|
-
const
|
|
7
|
-
const require_safe_stringify = require("./safe-stringify-
|
|
8
|
-
const require_otel = require("./otel-
|
|
6
|
+
const require_csv_utils = require("./csv.utils-CbVHY1pd.js");
|
|
7
|
+
const require_safe_stringify = require("./safe-stringify-CJisLyZ3.js");
|
|
8
|
+
const require_otel = require("./otel-DH6-G6DR.js");
|
|
9
9
|
let node_os = require("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
|
-
|
|
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 = require_sensitive_names.buildNameSet(require_sensitive_names.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 = require_sensitive_names.buildNameSet(require_sensitive_names.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("?") ? require_sensitive_names.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(require_sensitive_names.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,15 +639,28 @@ 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
|
|
653
|
+
* Apply redaction to the log message and return it as a string.
|
|
616
654
|
*
|
|
617
|
-
*
|
|
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) {
|
|
622
|
-
|
|
662
|
+
if (config && value !== null && typeof value === "object") return require_csv_utils.safeToString(redactMessageObject(value, config));
|
|
663
|
+
const text = typeof value === "string" ? value : require_csv_utils.safeToString(value);
|
|
623
664
|
if (!config) return text;
|
|
624
665
|
const resolved = resolveConfig(config);
|
|
625
666
|
if (!resolved.patterns || resolved.patterns.length === 0) return text;
|
|
@@ -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;
|
|
@@ -1079,7 +1128,7 @@ function toJsonEntry(entry) {
|
|
|
1079
1128
|
}
|
|
1080
1129
|
function toContextLabel(context) {
|
|
1081
1130
|
if (context === void 0 || context === null) return "";
|
|
1082
|
-
return typeof context === "string" ? context :
|
|
1131
|
+
return typeof context === "string" ? context : require_csv_utils.safeToString(context);
|
|
1083
1132
|
}
|
|
1084
1133
|
function namespacePatternToRegex(pattern) {
|
|
1085
1134
|
const escaped = pattern.split(".").map((s) => s === "*" ? "[^.]+" : s.replace(/[$()*+.?[\\\]^{|}]/g, "\\$&")).join("\\.");
|
|
@@ -1149,26 +1198,58 @@ function resolveInitialLevel(config) {
|
|
|
1149
1198
|
* ```
|
|
1150
1199
|
*/
|
|
1151
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 = require_request_trace.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;
|
|
1152
1252
|
constructor(config, context, parent) {
|
|
1153
|
-
this.timers = /* @__PURE__ */ new Map();
|
|
1154
|
-
this.contextData = {};
|
|
1155
|
-
this.fieldState = /* @__PURE__ */ new Map();
|
|
1156
|
-
this.fallbackTraceId = require_request_trace.TraceContext.instance.generate();
|
|
1157
|
-
this._levelValues = /* @__PURE__ */ new Map();
|
|
1158
|
-
this._minLevelValue = 2;
|
|
1159
|
-
this._warnedInvalidLevels = /* @__PURE__ */ new Set();
|
|
1160
|
-
this._colorMap = /* @__PURE__ */ new Map();
|
|
1161
|
-
this._fieldCache = /* @__PURE__ */ new Map();
|
|
1162
|
-
this._hasContextData = false;
|
|
1163
|
-
this._formattedLevels = /* @__PURE__ */ new Map();
|
|
1164
|
-
this._formattedAppName = "";
|
|
1165
|
-
this._jsonHeads = /* @__PURE__ */ new Map();
|
|
1166
|
-
this._jsonHeadsApp = "";
|
|
1167
|
-
this._jsonHeadsEnv = "";
|
|
1168
|
-
this._jsonContextKey = void 0;
|
|
1169
|
-
this._jsonContext = "";
|
|
1170
|
-
this._hasRedact = false;
|
|
1171
|
-
this._nsSeenVersion = 0;
|
|
1172
1253
|
this._parent = parent;
|
|
1173
1254
|
this._nsStore = parent ? parent._nsStore : {
|
|
1174
1255
|
levels: { ...config.namespaceLevels },
|
|
@@ -1557,7 +1638,7 @@ var LogixiaLogger = class LogixiaLogger {
|
|
|
1557
1638
|
}
|
|
1558
1639
|
/** Set the context label (e.g. a class or module name) attached to every subsequent entry. */
|
|
1559
1640
|
setContext(context) {
|
|
1560
|
-
this.context = typeof context === "string" ? context :
|
|
1641
|
+
this.context = typeof context === "string" ? context : require_csv_utils.safeToString(context);
|
|
1561
1642
|
}
|
|
1562
1643
|
/** Return the current context label, or `undefined` if none is set. */
|
|
1563
1644
|
getContext() {
|
|
@@ -1771,7 +1852,8 @@ var LogixiaLogger = class LogixiaLogger {
|
|
|
1771
1852
|
}
|
|
1772
1853
|
else payload = rawPayload;
|
|
1773
1854
|
}
|
|
1774
|
-
|
|
1855
|
+
const rawMessage = message;
|
|
1856
|
+
let safeMessage = rawMessage !== null && typeof rawMessage === "object" ? require_csv_utils.safeToString(rawMessage) : message;
|
|
1775
1857
|
if (this._hasRedact) try {
|
|
1776
1858
|
safeMessage = applyRedactionToString(message, config.redact);
|
|
1777
1859
|
} catch (error) {
|
|
@@ -1861,7 +1943,7 @@ var LogixiaLogger = class LogixiaLogger {
|
|
|
1861
1943
|
formatted += this._formattedAppName;
|
|
1862
1944
|
if (entry.traceId && this._fieldCache.get("traceId") !== false) formatted += `${cyan}[${require_otel.stripControlChars(String(entry.traceId))}]${reset} `;
|
|
1863
1945
|
if (entry.context && this._fieldCache.get("context") !== false) formatted += `${yellow}[${require_otel.stripControlChars(String(entry.context))}]${reset} `;
|
|
1864
|
-
if (this._fieldCache.get("message") !== false) formatted += require_otel.stripControlChars(
|
|
1946
|
+
if (this._fieldCache.get("message") !== false) formatted += require_otel.stripControlChars(require_csv_utils.safeToString(entry.message));
|
|
1865
1947
|
if (entry.payload !== void 0 && this._fieldCache.get("payload") !== false) formatted += ` ${require_safe_stringify.stringifyForLog(entry.payload)}`;
|
|
1866
1948
|
return formatted;
|
|
1867
1949
|
}
|
|
@@ -1962,6 +2044,22 @@ function createLogger(config, context) {
|
|
|
1962
2044
|
}
|
|
1963
2045
|
// src/exceptions/exception.ts
|
|
1964
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;
|
|
1965
2063
|
constructor(options) {
|
|
1966
2064
|
super(options.message, { cause: options.cause });
|
|
1967
2065
|
this.name = "LogixiaException";
|
|
@@ -2334,4 +2432,4 @@ Object.defineProperty(exports, "usePlugin", {
|
|
|
2334
2432
|
}
|
|
2335
2433
|
});
|
|
2336
2434
|
|
|
2337
|
-
//# sourceMappingURL=builder-
|
|
2435
|
+
//# sourceMappingURL=builder-Up4YxX7l.js.map
|