logixia 1.8.2 → 1.8.3
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/.tsbuildinfo +1 -1
- package/dist/{index-CthBT3t8.d.mts → index-BFUPvkkQ.d.mts} +12 -1
- package/dist/index-BFUPvkkQ.d.mts.map +1 -0
- package/dist/{index-ClPZrfIU.d.ts → index-DknhKCCg.d.ts} +12 -1
- package/dist/index-DknhKCCg.d.ts.map +1 -0
- package/dist/index.d.mts +54 -15
- package/dist/index.d.mts.map +1 -1
- package/dist/index.d.ts +54 -15
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +54 -24
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +54 -23
- package/dist/index.mjs.map +1 -1
- package/dist/{logitron-logger.module-Fof9Er2E.js → logitron-logger.module-B-sUxEiz.js} +159 -33
- package/dist/logitron-logger.module-B-sUxEiz.js.map +1 -0
- package/dist/{logitron-logger.module-DucvDnxZ.mjs → logitron-logger.module-B0A-mnc7.mjs} +154 -34
- package/dist/logitron-logger.module-B0A-mnc7.mjs.map +1 -0
- package/dist/{logitron-logger.module-Dx2mUz-g.d.ts → logitron-logger.module-BcxoyFoO.d.ts} +99 -7
- package/dist/logitron-logger.module-BcxoyFoO.d.ts.map +1 -0
- package/dist/{logitron-logger.module-KU_L04y1.d.mts → logitron-logger.module-HaMh8Nh7.d.mts} +99 -7
- package/dist/logitron-logger.module-HaMh8Nh7.d.mts.map +1 -0
- package/dist/middleware.d.mts +1 -1
- package/dist/middleware.d.ts +1 -1
- package/dist/nest.d.mts +4 -44
- package/dist/nest.d.mts.map +1 -1
- package/dist/nest.d.ts +4 -44
- package/dist/nest.d.ts.map +1 -1
- package/dist/nest.js +3 -93
- package/dist/nest.mjs +3 -92
- package/dist/{promise-BrZcjavs.mjs → promise-B4HzEg1I.mjs} +413 -261
- package/dist/promise-B4HzEg1I.mjs.map +1 -0
- package/dist/{promise-BI-3eI4n.js → promise-FtXoEiT6.js} +413 -261
- package/dist/promise-FtXoEiT6.js.map +1 -0
- package/dist/testing.d.mts +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/{transport.manager-DU1W0wV3.js → transport.manager-CqPyddCV.js} +2 -2
- package/dist/{transport.manager-DU1W0wV3.js.map → transport.manager-CqPyddCV.js.map} +1 -1
- package/dist/{transport.manager-BCnLEmOy.mjs → transport.manager-DMdotLoQ.mjs} +2 -2
- package/dist/{transport.manager-BCnLEmOy.mjs.map → transport.manager-DMdotLoQ.mjs.map} +1 -1
- package/dist/transports.d.mts +1 -1
- package/dist/transports.d.ts +1 -1
- package/dist/transports.js +1 -1
- package/dist/transports.mjs +1 -1
- package/package.json +2 -1
- package/dist/index-ClPZrfIU.d.ts.map +0 -1
- package/dist/index-CthBT3t8.d.mts.map +0 -1
- package/dist/logitron-logger.module-DucvDnxZ.mjs.map +0 -1
- package/dist/logitron-logger.module-Dx2mUz-g.d.ts.map +0 -1
- package/dist/logitron-logger.module-Fof9Er2E.js.map +0 -1
- package/dist/logitron-logger.module-KU_L04y1.d.mts.map +0 -1
- package/dist/nest.js.map +0 -1
- package/dist/nest.mjs.map +0 -1
- package/dist/promise-BI-3eI4n.js.map +0 -1
- package/dist/promise-BrZcjavs.mjs.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as __toESM, r as __require, t as __commonJS } from "./chunk-uEZWKkIX.mjs";
|
|
2
|
-
import { d as internalLog, f as internalWarn, t as TransportManager, u as internalError } from "./transport.manager-
|
|
2
|
+
import { d as internalLog, f as internalWarn, t as TransportManager, u as internalError } from "./transport.manager-DMdotLoQ.mjs";
|
|
3
3
|
import buildFastStringify from "fast-json-stringify";
|
|
4
4
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
5
5
|
import { randomUUID } from "node:crypto";
|
|
@@ -849,8 +849,19 @@ var TraceContext = class TraceContext {
|
|
|
849
849
|
/**
|
|
850
850
|
* Mutate the CURRENT async context in-place.
|
|
851
851
|
*
|
|
852
|
-
* ⚠️
|
|
853
|
-
*
|
|
852
|
+
* ⚠️ DEPRECATED — unsafe for concurrent requests.
|
|
853
|
+
*
|
|
854
|
+
* Uses `AsyncLocalStorage.enterWith()`, which mutates the current async
|
|
855
|
+
* execution context and every Promise chain spawned from it. In a server
|
|
856
|
+
* processing overlapping requests this can cause a trace ID set for one
|
|
857
|
+
* request to bleed into *other* in-flight requests that share the same
|
|
858
|
+
* async parent (e.g. a module-level setup function or a cached handler).
|
|
859
|
+
*
|
|
860
|
+
* Use {@link run} instead — it scopes the context to a callback so there
|
|
861
|
+
* is no risk of cross-request leakage.
|
|
862
|
+
*
|
|
863
|
+
* @deprecated Use `TraceContext.instance.run(traceId, fn)` — do not call
|
|
864
|
+
* `setTraceId` from request-handling code.
|
|
854
865
|
*/
|
|
855
866
|
setTraceId(traceId, data) {
|
|
856
867
|
const current = this.storage.getStore() ?? {};
|
|
@@ -895,9 +906,23 @@ function getCurrentTraceId() {
|
|
|
895
906
|
/**
|
|
896
907
|
* Set trace ID in the CURRENT async context without starting a new one.
|
|
897
908
|
*
|
|
898
|
-
* ⚠️
|
|
899
|
-
*
|
|
900
|
-
*
|
|
909
|
+
* ⚠️ DEPRECATED — unsafe for concurrent requests.
|
|
910
|
+
*
|
|
911
|
+
* Uses `AsyncLocalStorage.enterWith()`, which mutates the current async
|
|
912
|
+
* execution context and every Promise chain spawned from it. Under load this
|
|
913
|
+
* can cause a trace ID from one request to bleed into others sharing the same
|
|
914
|
+
* async parent.
|
|
915
|
+
*
|
|
916
|
+
* Use {@link runWithTraceId} instead:
|
|
917
|
+
*
|
|
918
|
+
* ```ts
|
|
919
|
+
* await runWithTraceId(traceId, async () => {
|
|
920
|
+
* // everything here is scoped to this traceId only
|
|
921
|
+
* });
|
|
922
|
+
* ```
|
|
923
|
+
*
|
|
924
|
+
* @deprecated Use `runWithTraceId(traceId, fn)` — do not call `setTraceId`
|
|
925
|
+
* from request-handling code.
|
|
901
926
|
*/
|
|
902
927
|
function setTraceId(traceId, data) {
|
|
903
928
|
TraceContext.instance.setTraceId(traceId, data);
|
|
@@ -906,6 +931,16 @@ function setTraceId(traceId, data) {
|
|
|
906
931
|
function runWithTraceId(traceId, fn, data) {
|
|
907
932
|
return TraceContext.instance.run(traceId, fn, data);
|
|
908
933
|
}
|
|
934
|
+
/**
|
|
935
|
+
* Coerce an arbitrary value to a non-empty trace ID string, or `undefined`.
|
|
936
|
+
* Rejects empty/whitespace-only strings, non-strings, and non-first array elements.
|
|
937
|
+
*/
|
|
938
|
+
function toValidTraceId(value) {
|
|
939
|
+
const first$1 = Array.isArray(value) ? value[0] : value;
|
|
940
|
+
if (typeof first$1 !== "string") return void 0;
|
|
941
|
+
const trimmed = first$1.trim();
|
|
942
|
+
return trimmed.length > 0 ? trimmed : void 0;
|
|
943
|
+
}
|
|
909
944
|
/** Extract trace ID from request using configuration (header → query → body → params). */
|
|
910
945
|
function extractTraceId(request, config) {
|
|
911
946
|
const req = request;
|
|
@@ -913,23 +948,23 @@ function extractTraceId(request, config) {
|
|
|
913
948
|
const headers = Array.isArray(config.header) ? config.header : [config.header];
|
|
914
949
|
for (const header of headers) {
|
|
915
950
|
var _req$headers;
|
|
916
|
-
const value = (_req$headers = req.headers) === null || _req$headers === void 0 ? void 0 : _req$headers[header.toLowerCase()];
|
|
917
|
-
if (value) return
|
|
951
|
+
const value = toValidTraceId((_req$headers = req.headers) === null || _req$headers === void 0 ? void 0 : _req$headers[header.toLowerCase()]);
|
|
952
|
+
if (value) return value;
|
|
918
953
|
}
|
|
919
954
|
}
|
|
920
955
|
if (config.query) {
|
|
921
956
|
const queries = Array.isArray(config.query) ? config.query : [config.query];
|
|
922
957
|
for (const query of queries) {
|
|
923
958
|
var _req$query;
|
|
924
|
-
const value = (_req$query = req.query) === null || _req$query === void 0 ? void 0 : _req$query[query];
|
|
925
|
-
if (value) return
|
|
959
|
+
const value = toValidTraceId((_req$query = req.query) === null || _req$query === void 0 ? void 0 : _req$query[query]);
|
|
960
|
+
if (value) return value;
|
|
926
961
|
}
|
|
927
962
|
}
|
|
928
963
|
if (config.body) {
|
|
929
964
|
const bodyFields = Array.isArray(config.body) ? config.body : [config.body];
|
|
930
965
|
for (const field of bodyFields) {
|
|
931
966
|
var _req$body;
|
|
932
|
-
const value = (_req$body = req.body) === null || _req$body === void 0 ? void 0 : _req$body[field];
|
|
967
|
+
const value = toValidTraceId((_req$body = req.body) === null || _req$body === void 0 ? void 0 : _req$body[field]);
|
|
933
968
|
if (value) return value;
|
|
934
969
|
}
|
|
935
970
|
}
|
|
@@ -937,7 +972,7 @@ function extractTraceId(request, config) {
|
|
|
937
972
|
const paramFields = Array.isArray(config.params) ? config.params : [config.params];
|
|
938
973
|
for (const param of paramFields) {
|
|
939
974
|
var _req$params;
|
|
940
|
-
const value = (_req$params = req.params) === null || _req$params === void 0 ? void 0 : _req$params[param];
|
|
975
|
+
const value = toValidTraceId((_req$params = req.params) === null || _req$params === void 0 ? void 0 : _req$params[param]);
|
|
941
976
|
if (value) return value;
|
|
942
977
|
}
|
|
943
978
|
}
|
|
@@ -1005,6 +1040,13 @@ function namespacePatternToRegex(pattern) {
|
|
|
1005
1040
|
/** Max compiled patterns to keep in memory. Oldest entry is evicted when full. */
|
|
1006
1041
|
const _NS_CACHE_MAX = 1e3;
|
|
1007
1042
|
const _nsPatternCache = /* @__PURE__ */ new Map();
|
|
1043
|
+
/**
|
|
1044
|
+
* One-shot warning so operators notice runaway pattern growth.
|
|
1045
|
+
* If the cache is being thrashed (>N evictions) the namespace level config is
|
|
1046
|
+
* almost certainly wrong — likely dynamic/unique patterns being registered.
|
|
1047
|
+
*/
|
|
1048
|
+
let _nsCacheEvictionWarned = false;
|
|
1049
|
+
let _nsCacheEvictionCount = 0;
|
|
1008
1050
|
function matchesNamespacePattern(ns, pattern) {
|
|
1009
1051
|
let re = _nsPatternCache.get(pattern);
|
|
1010
1052
|
if (!re) {
|
|
@@ -1012,6 +1054,11 @@ function matchesNamespacePattern(ns, pattern) {
|
|
|
1012
1054
|
if (_nsPatternCache.size >= _NS_CACHE_MAX) {
|
|
1013
1055
|
const firstKey = _nsPatternCache.keys().next().value;
|
|
1014
1056
|
if (firstKey !== void 0) _nsPatternCache.delete(firstKey);
|
|
1057
|
+
_nsCacheEvictionCount++;
|
|
1058
|
+
if (!_nsCacheEvictionWarned) {
|
|
1059
|
+
_nsCacheEvictionWarned = true;
|
|
1060
|
+
process.stderr.write(`[logixia] namespace pattern cache hit ${_NS_CACHE_MAX} entries — evicting. This usually means dynamic/unique patterns are being registered at runtime; review your levelOptions.namespaces configuration.\n`);
|
|
1061
|
+
}
|
|
1015
1062
|
}
|
|
1016
1063
|
_nsPatternCache.set(pattern, re);
|
|
1017
1064
|
}
|
|
@@ -1687,7 +1734,7 @@ let LogixiaLoggerService = _LogixiaLoggerService = class LogixiaLoggerService$1
|
|
|
1687
1734
|
return this.logger.getLevel();
|
|
1688
1735
|
}
|
|
1689
1736
|
child(context$1, data) {
|
|
1690
|
-
const childService = new _LogixiaLoggerService();
|
|
1737
|
+
const childService = new _LogixiaLoggerService(this._mergedConfig);
|
|
1691
1738
|
childService.logger = this.logger.child(context$1, data);
|
|
1692
1739
|
childService.context = context$1;
|
|
1693
1740
|
return childService;
|
|
@@ -10578,9 +10625,33 @@ var require_cjs = /* @__PURE__ */ __commonJS({ "node_modules/rxjs/dist/cjs/index
|
|
|
10578
10625
|
//#endregion
|
|
10579
10626
|
//#region src/core/kafka-trace.interceptor.ts
|
|
10580
10627
|
var import_cjs$1 = /* @__PURE__ */ __toESM(require_cjs());
|
|
10628
|
+
var _KafkaTraceInterceptor;
|
|
10581
10629
|
let KafkaTraceInterceptor = class KafkaTraceInterceptor$1 {
|
|
10582
|
-
|
|
10630
|
+
static {
|
|
10631
|
+
_KafkaTraceInterceptor = this;
|
|
10632
|
+
}
|
|
10633
|
+
static #_ = this.metrics = {
|
|
10634
|
+
accepted: 0,
|
|
10635
|
+
acceptedWithoutTrace: 0,
|
|
10636
|
+
dropped: 0
|
|
10637
|
+
};
|
|
10638
|
+
/** Reset counters (tests). */
|
|
10639
|
+
static resetMetrics() {
|
|
10640
|
+
_KafkaTraceInterceptor.metrics.accepted = 0;
|
|
10641
|
+
_KafkaTraceInterceptor.metrics.acceptedWithoutTrace = 0;
|
|
10642
|
+
_KafkaTraceInterceptor.metrics.dropped = 0;
|
|
10643
|
+
}
|
|
10644
|
+
/**
|
|
10645
|
+
* @param config - TraceIdConfig options (extractor keys, contextKey, etc.)
|
|
10646
|
+
* @param requireTraceId - When true, messages with no traceId are silently skipped
|
|
10647
|
+
* (EMPTY Observable — message is ack'd, consumer stays alive).
|
|
10648
|
+
* A WARN is logged AND `KafkaTraceInterceptor.metrics.dropped`
|
|
10649
|
+
* increments so the missing traceId is observable end-to-end.
|
|
10650
|
+
* Default: false (handler runs without trace context).
|
|
10651
|
+
*/
|
|
10652
|
+
constructor(config, requireTraceId = false) {
|
|
10583
10653
|
this.config = config;
|
|
10654
|
+
this.requireTraceId = requireTraceId;
|
|
10584
10655
|
this.ctx = TraceContext.instance;
|
|
10585
10656
|
this.config = {
|
|
10586
10657
|
enabled: true,
|
|
@@ -10605,12 +10676,22 @@ let KafkaTraceInterceptor = class KafkaTraceInterceptor$1 {
|
|
|
10605
10676
|
let traceId;
|
|
10606
10677
|
if (this.config.extractor) traceId = extractTraceId({
|
|
10607
10678
|
body: data,
|
|
10608
|
-
headers: (rpcData === null || rpcData === void 0 ? void 0 : rpcData.headers)
|
|
10679
|
+
headers: (rpcData === null || rpcData === void 0 ? void 0 : rpcData.headers) ?? {},
|
|
10609
10680
|
query: {},
|
|
10610
10681
|
params: {}
|
|
10611
10682
|
}, this.config.extractor);
|
|
10612
10683
|
if (!traceId) traceId = this.ctx.getCurrentTraceId();
|
|
10613
|
-
if (!traceId)
|
|
10684
|
+
if (!traceId) {
|
|
10685
|
+
if (this.requireTraceId) {
|
|
10686
|
+
var _LogixiaLoggerModule$;
|
|
10687
|
+
_KafkaTraceInterceptor.metrics.dropped++;
|
|
10688
|
+
(_LogixiaLoggerModule$ = LogixiaLoggerModule.getGlobalLogger()) === null || _LogixiaLoggerModule$ === void 0 || _LogixiaLoggerModule$.warn(`[KafkaTraceInterceptor] Missing traceId on topic "${rpcData === null || rpcData === void 0 ? void 0 : rpcData.topic}" — message skipped.`);
|
|
10689
|
+
return import_cjs$1.EMPTY;
|
|
10690
|
+
}
|
|
10691
|
+
_KafkaTraceInterceptor.metrics.acceptedWithoutTrace++;
|
|
10692
|
+
return next.handle();
|
|
10693
|
+
}
|
|
10694
|
+
_KafkaTraceInterceptor.metrics.accepted++;
|
|
10614
10695
|
const kafkaContext = {
|
|
10615
10696
|
messageType: "kafka",
|
|
10616
10697
|
topic: rpcData === null || rpcData === void 0 ? void 0 : rpcData.topic,
|
|
@@ -10630,7 +10711,7 @@ let KafkaTraceInterceptor = class KafkaTraceInterceptor$1 {
|
|
|
10630
10711
|
});
|
|
10631
10712
|
}
|
|
10632
10713
|
};
|
|
10633
|
-
KafkaTraceInterceptor = __decorate([Injectable(), __decorateMetadata("design:paramtypes", [Object])], KafkaTraceInterceptor);
|
|
10714
|
+
KafkaTraceInterceptor = _KafkaTraceInterceptor = __decorate([Injectable(), __decorateMetadata("design:paramtypes", [Object, Boolean])], KafkaTraceInterceptor);
|
|
10634
10715
|
|
|
10635
10716
|
//#endregion
|
|
10636
10717
|
//#region \0@oxc-project+runtime@0.95.0/helpers/decorateParam.js
|
|
@@ -10642,6 +10723,18 @@ function __decorateParam(paramIndex, decorator) {
|
|
|
10642
10723
|
|
|
10643
10724
|
//#endregion
|
|
10644
10725
|
//#region src/core/trace.middleware.ts
|
|
10726
|
+
/** Default response header used to echo the resolved traceId back to the caller. */
|
|
10727
|
+
const DEFAULT_TRACE_RESPONSE_HEADER = "X-Trace-Id";
|
|
10728
|
+
/**
|
|
10729
|
+
* Resolve the response header name from config.
|
|
10730
|
+
* - `undefined` → default `'X-Trace-Id'`
|
|
10731
|
+
* - `string` → user's custom header
|
|
10732
|
+
* - `false` → `null` (suppress entirely)
|
|
10733
|
+
*/
|
|
10734
|
+
function resolveResponseHeader(config) {
|
|
10735
|
+
if ((config === null || config === void 0 ? void 0 : config.responseHeader) === false) return null;
|
|
10736
|
+
return (config === null || config === void 0 ? void 0 : config.responseHeader) ?? DEFAULT_TRACE_RESPONSE_HEADER;
|
|
10737
|
+
}
|
|
10645
10738
|
let TraceMiddleware = class TraceMiddleware$1 {
|
|
10646
10739
|
constructor(config) {
|
|
10647
10740
|
this.config = config;
|
|
@@ -10660,16 +10753,22 @@ let TraceMiddleware = class TraceMiddleware$1 {
|
|
|
10660
10753
|
...config.extractor
|
|
10661
10754
|
} : defaultExtractor
|
|
10662
10755
|
};
|
|
10663
|
-
this.ctx.setContextKey(this.config.contextKey ?? "traceId");
|
|
10756
|
+
if (this.config.enabled) this.ctx.setContextKey(this.config.contextKey ?? "traceId");
|
|
10664
10757
|
}
|
|
10665
10758
|
use(req, res, next) {
|
|
10666
10759
|
var _this$config;
|
|
10667
10760
|
if (!((_this$config = this.config) === null || _this$config === void 0 ? void 0 : _this$config.enabled)) return next();
|
|
10668
10761
|
let traceId;
|
|
10669
10762
|
if (this.config.extractor) traceId = extractTraceId(req, this.config.extractor);
|
|
10670
|
-
if (!traceId
|
|
10763
|
+
if (!traceId && this.config.generator) {
|
|
10764
|
+
const candidate = this.config.generator();
|
|
10765
|
+
if (typeof candidate === "string" && candidate.trim().length > 0) traceId = candidate;
|
|
10766
|
+
else process.stderr.write("[logixia] TraceIdConfig.generator returned a non-string/empty value — using built-in generator.\n");
|
|
10767
|
+
}
|
|
10768
|
+
if (!traceId) traceId = this.ctx.generate();
|
|
10671
10769
|
req.traceId = traceId;
|
|
10672
|
-
|
|
10770
|
+
const header = resolveResponseHeader(this.config);
|
|
10771
|
+
if (header) res.setHeader(header, traceId);
|
|
10673
10772
|
this.ctx.run(traceId, () => next(), {
|
|
10674
10773
|
method: req.method,
|
|
10675
10774
|
url: req.url,
|
|
@@ -10763,6 +10862,29 @@ let LogixiaLoggerModule = class LogixiaLoggerModule$1 {
|
|
|
10763
10862
|
static #_ = this.loggerConfig = {};
|
|
10764
10863
|
static #_2 = this._globalLogger = null;
|
|
10765
10864
|
/**
|
|
10865
|
+
* @internal Set the global logger exactly once.
|
|
10866
|
+
*
|
|
10867
|
+
* Called from the module's forRoot / forRootAsync factory. If the module is
|
|
10868
|
+
* initialised more than once in the same process (nested DI context, test
|
|
10869
|
+
* harness creating multiple apps, hot reload, etc.) a warning is written to
|
|
10870
|
+
* stderr and the first logger wins — silently overwriting would allow the
|
|
10871
|
+
* newer instance's transport config to replace the live one while the old
|
|
10872
|
+
* one is still being used by registered shutdown hooks, decorators, etc.
|
|
10873
|
+
*
|
|
10874
|
+
* Use {@link _resetGlobalLogger} in tests to reset between runs.
|
|
10875
|
+
*/
|
|
10876
|
+
static _setGlobalLogger(service) {
|
|
10877
|
+
if (_LogixiaLoggerModule._globalLogger !== null) {
|
|
10878
|
+
process.stderr.write("[logixia] LogixiaLoggerModule.forRoot() was called more than once — ignoring the second init. If this is intentional (e.g. in tests), call LogixiaLoggerModule._resetGlobalLogger() first.\n");
|
|
10879
|
+
return;
|
|
10880
|
+
}
|
|
10881
|
+
_LogixiaLoggerModule._globalLogger = service;
|
|
10882
|
+
}
|
|
10883
|
+
/** @internal Clear the global logger. Tests only. */
|
|
10884
|
+
static _resetGlobalLogger() {
|
|
10885
|
+
_LogixiaLoggerModule._globalLogger = null;
|
|
10886
|
+
}
|
|
10887
|
+
/**
|
|
10766
10888
|
* Returns the global LogixiaLoggerService instance that was created when the
|
|
10767
10889
|
* module booted. Useful for logging outside of NestJS DI — utility functions,
|
|
10768
10890
|
* plain scripts, decorators — without injecting the service everywhere.
|
|
@@ -10785,17 +10907,15 @@ let LogixiaLoggerModule = class LogixiaLoggerModule$1 {
|
|
|
10785
10907
|
}
|
|
10786
10908
|
configure(consumer) {
|
|
10787
10909
|
const { forRoutes = DEFAULT_ROUTES, exclude } = this.config;
|
|
10788
|
-
|
|
10789
|
-
|
|
10790
|
-
|
|
10791
|
-
|
|
10792
|
-
|
|
10793
|
-
|
|
10794
|
-
generator: () => TraceContext.instance.generate()
|
|
10795
|
-
};
|
|
10796
|
-
else traceConfig = void 0;
|
|
10797
|
-
return new TraceMiddleware(traceConfig).use(req, res, next);
|
|
10910
|
+
let resolvedTraceConfig;
|
|
10911
|
+
if (typeof _LogixiaLoggerModule.loggerConfig.traceId === "object") resolvedTraceConfig = _LogixiaLoggerModule.loggerConfig.traceId;
|
|
10912
|
+
else if (_LogixiaLoggerModule.loggerConfig.traceId === true) resolvedTraceConfig = {
|
|
10913
|
+
enabled: true,
|
|
10914
|
+
contextKey: "traceId",
|
|
10915
|
+
generator: () => TraceContext.instance.generate()
|
|
10798
10916
|
};
|
|
10917
|
+
const middleware = new TraceMiddleware(resolvedTraceConfig);
|
|
10918
|
+
const middlewareConfig = (req, res, next) => middleware.use(req, res, next);
|
|
10799
10919
|
if (exclude) consumer.apply(middlewareConfig).exclude(...exclude).forRoutes(...forRoutes);
|
|
10800
10920
|
else consumer.apply(middlewareConfig).forRoutes(...forRoutes);
|
|
10801
10921
|
}
|
|
@@ -10845,7 +10965,7 @@ let LogixiaLoggerModule = class LogixiaLoggerModule$1 {
|
|
|
10845
10965
|
},
|
|
10846
10966
|
...loggerConfig
|
|
10847
10967
|
});
|
|
10848
|
-
_LogixiaLoggerModule.
|
|
10968
|
+
_LogixiaLoggerModule._setGlobalLogger(service);
|
|
10849
10969
|
return service;
|
|
10850
10970
|
},
|
|
10851
10971
|
inject: [LOGIXIA_LOGGER_CONFIG]
|
|
@@ -10917,7 +11037,7 @@ let LogixiaLoggerModule = class LogixiaLoggerModule$1 {
|
|
|
10917
11037
|
};
|
|
10918
11038
|
_LogixiaLoggerModule.loggerConfig = defaultConfig;
|
|
10919
11039
|
const service = new LogixiaLoggerService(defaultConfig);
|
|
10920
|
-
_LogixiaLoggerModule.
|
|
11040
|
+
_LogixiaLoggerModule._setGlobalLogger(service);
|
|
10921
11041
|
return service;
|
|
10922
11042
|
},
|
|
10923
11043
|
inject: [LOGIXIA_LOGGER_CONFIG]
|
|
@@ -10982,5 +11102,5 @@ let LogixiaLoggerModule = class LogixiaLoggerModule$1 {
|
|
|
10982
11102
|
LogixiaLoggerModule = _LogixiaLoggerModule = __decorate([Module({})], LogixiaLoggerModule);
|
|
10983
11103
|
|
|
10984
11104
|
//#endregion
|
|
10985
|
-
export {
|
|
10986
|
-
//# sourceMappingURL=logitron-logger.module-
|
|
11105
|
+
export { redactObject as A, LogLevel as B, setTraceId as C, registerForShutdown as D, flushOnExit as E, isError as F, createExpressContextMiddleware as G, globalPluginRegistry as H, normalizeError as I, createFastifyContextHook as K, serializeError as L, getActiveOtelContext as M, getOtelMetaFields as N, resetShutdownHandlers as O, initOtelBridge as P, DEFAULT_LOG_COLORS as R, runWithTraceId as S, deregisterFromShutdown as T, usePlugin as U, PluginRegistry as V, LogixiaContext as W, _setActiveContextKey as _, TraceMiddleware as a, getCurrentTraceId as b, KafkaTraceInterceptor as c, __decorateMetadata as d, LogixiaLogger as f, TraceContext as g, TRACE_CONTEXT_KEY as h, WebSocketTraceInterceptor as i, disableOtelBridge as j, applyRedaction as k, LogixiaLoggerService as l, DEFAULT_TRACE_HEADERS as m, LOGIXIA_LOGGER_PREFIX as n, resolveResponseHeader as o, createLogger as p, LogixiaLoggerModule as r, __decorateParam as s, LOGIXIA_LOGGER_CONFIG as t, __decorate as u, createTraceMiddleware as v, traceStorage as w, getTraceContextKey as x, extractTraceId as y, DEFAULT_LOG_LEVELS as z };
|
|
11106
|
+
//# sourceMappingURL=logitron-logger.module-B0A-mnc7.mjs.map
|