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
|
const require_chunk = require('./chunk-BTgCAUrQ.js');
|
|
2
|
-
const require_transport_manager = require('./transport.manager-
|
|
2
|
+
const require_transport_manager = require('./transport.manager-CqPyddCV.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");
|
|
@@ -854,8 +854,19 @@ var TraceContext = class TraceContext {
|
|
|
854
854
|
/**
|
|
855
855
|
* Mutate the CURRENT async context in-place.
|
|
856
856
|
*
|
|
857
|
-
* ⚠️
|
|
858
|
-
*
|
|
857
|
+
* ⚠️ DEPRECATED — unsafe for concurrent requests.
|
|
858
|
+
*
|
|
859
|
+
* Uses `AsyncLocalStorage.enterWith()`, which mutates the current async
|
|
860
|
+
* execution context and every Promise chain spawned from it. In a server
|
|
861
|
+
* processing overlapping requests this can cause a trace ID set for one
|
|
862
|
+
* request to bleed into *other* in-flight requests that share the same
|
|
863
|
+
* async parent (e.g. a module-level setup function or a cached handler).
|
|
864
|
+
*
|
|
865
|
+
* Use {@link run} instead — it scopes the context to a callback so there
|
|
866
|
+
* is no risk of cross-request leakage.
|
|
867
|
+
*
|
|
868
|
+
* @deprecated Use `TraceContext.instance.run(traceId, fn)` — do not call
|
|
869
|
+
* `setTraceId` from request-handling code.
|
|
859
870
|
*/
|
|
860
871
|
setTraceId(traceId, data) {
|
|
861
872
|
const current = this.storage.getStore() ?? {};
|
|
@@ -900,9 +911,23 @@ function getCurrentTraceId() {
|
|
|
900
911
|
/**
|
|
901
912
|
* Set trace ID in the CURRENT async context without starting a new one.
|
|
902
913
|
*
|
|
903
|
-
* ⚠️
|
|
904
|
-
*
|
|
905
|
-
*
|
|
914
|
+
* ⚠️ DEPRECATED — unsafe for concurrent requests.
|
|
915
|
+
*
|
|
916
|
+
* Uses `AsyncLocalStorage.enterWith()`, which mutates the current async
|
|
917
|
+
* execution context and every Promise chain spawned from it. Under load this
|
|
918
|
+
* can cause a trace ID from one request to bleed into others sharing the same
|
|
919
|
+
* async parent.
|
|
920
|
+
*
|
|
921
|
+
* Use {@link runWithTraceId} instead:
|
|
922
|
+
*
|
|
923
|
+
* ```ts
|
|
924
|
+
* await runWithTraceId(traceId, async () => {
|
|
925
|
+
* // everything here is scoped to this traceId only
|
|
926
|
+
* });
|
|
927
|
+
* ```
|
|
928
|
+
*
|
|
929
|
+
* @deprecated Use `runWithTraceId(traceId, fn)` — do not call `setTraceId`
|
|
930
|
+
* from request-handling code.
|
|
906
931
|
*/
|
|
907
932
|
function setTraceId(traceId, data) {
|
|
908
933
|
TraceContext.instance.setTraceId(traceId, data);
|
|
@@ -911,6 +936,16 @@ function setTraceId(traceId, data) {
|
|
|
911
936
|
function runWithTraceId(traceId, fn, data) {
|
|
912
937
|
return TraceContext.instance.run(traceId, fn, data);
|
|
913
938
|
}
|
|
939
|
+
/**
|
|
940
|
+
* Coerce an arbitrary value to a non-empty trace ID string, or `undefined`.
|
|
941
|
+
* Rejects empty/whitespace-only strings, non-strings, and non-first array elements.
|
|
942
|
+
*/
|
|
943
|
+
function toValidTraceId(value) {
|
|
944
|
+
const first$1 = Array.isArray(value) ? value[0] : value;
|
|
945
|
+
if (typeof first$1 !== "string") return void 0;
|
|
946
|
+
const trimmed = first$1.trim();
|
|
947
|
+
return trimmed.length > 0 ? trimmed : void 0;
|
|
948
|
+
}
|
|
914
949
|
/** Extract trace ID from request using configuration (header → query → body → params). */
|
|
915
950
|
function extractTraceId(request, config) {
|
|
916
951
|
const req = request;
|
|
@@ -918,23 +953,23 @@ function extractTraceId(request, config) {
|
|
|
918
953
|
const headers = Array.isArray(config.header) ? config.header : [config.header];
|
|
919
954
|
for (const header of headers) {
|
|
920
955
|
var _req$headers;
|
|
921
|
-
const value = (_req$headers = req.headers) === null || _req$headers === void 0 ? void 0 : _req$headers[header.toLowerCase()];
|
|
922
|
-
if (value) return
|
|
956
|
+
const value = toValidTraceId((_req$headers = req.headers) === null || _req$headers === void 0 ? void 0 : _req$headers[header.toLowerCase()]);
|
|
957
|
+
if (value) return value;
|
|
923
958
|
}
|
|
924
959
|
}
|
|
925
960
|
if (config.query) {
|
|
926
961
|
const queries = Array.isArray(config.query) ? config.query : [config.query];
|
|
927
962
|
for (const query of queries) {
|
|
928
963
|
var _req$query;
|
|
929
|
-
const value = (_req$query = req.query) === null || _req$query === void 0 ? void 0 : _req$query[query];
|
|
930
|
-
if (value) return
|
|
964
|
+
const value = toValidTraceId((_req$query = req.query) === null || _req$query === void 0 ? void 0 : _req$query[query]);
|
|
965
|
+
if (value) return value;
|
|
931
966
|
}
|
|
932
967
|
}
|
|
933
968
|
if (config.body) {
|
|
934
969
|
const bodyFields = Array.isArray(config.body) ? config.body : [config.body];
|
|
935
970
|
for (const field of bodyFields) {
|
|
936
971
|
var _req$body;
|
|
937
|
-
const value = (_req$body = req.body) === null || _req$body === void 0 ? void 0 : _req$body[field];
|
|
972
|
+
const value = toValidTraceId((_req$body = req.body) === null || _req$body === void 0 ? void 0 : _req$body[field]);
|
|
938
973
|
if (value) return value;
|
|
939
974
|
}
|
|
940
975
|
}
|
|
@@ -942,7 +977,7 @@ function extractTraceId(request, config) {
|
|
|
942
977
|
const paramFields = Array.isArray(config.params) ? config.params : [config.params];
|
|
943
978
|
for (const param of paramFields) {
|
|
944
979
|
var _req$params;
|
|
945
|
-
const value = (_req$params = req.params) === null || _req$params === void 0 ? void 0 : _req$params[param];
|
|
980
|
+
const value = toValidTraceId((_req$params = req.params) === null || _req$params === void 0 ? void 0 : _req$params[param]);
|
|
946
981
|
if (value) return value;
|
|
947
982
|
}
|
|
948
983
|
}
|
|
@@ -1010,6 +1045,13 @@ function namespacePatternToRegex(pattern) {
|
|
|
1010
1045
|
/** Max compiled patterns to keep in memory. Oldest entry is evicted when full. */
|
|
1011
1046
|
const _NS_CACHE_MAX = 1e3;
|
|
1012
1047
|
const _nsPatternCache = /* @__PURE__ */ new Map();
|
|
1048
|
+
/**
|
|
1049
|
+
* One-shot warning so operators notice runaway pattern growth.
|
|
1050
|
+
* If the cache is being thrashed (>N evictions) the namespace level config is
|
|
1051
|
+
* almost certainly wrong — likely dynamic/unique patterns being registered.
|
|
1052
|
+
*/
|
|
1053
|
+
let _nsCacheEvictionWarned = false;
|
|
1054
|
+
let _nsCacheEvictionCount = 0;
|
|
1013
1055
|
function matchesNamespacePattern(ns, pattern) {
|
|
1014
1056
|
let re = _nsPatternCache.get(pattern);
|
|
1015
1057
|
if (!re) {
|
|
@@ -1017,6 +1059,11 @@ function matchesNamespacePattern(ns, pattern) {
|
|
|
1017
1059
|
if (_nsPatternCache.size >= _NS_CACHE_MAX) {
|
|
1018
1060
|
const firstKey = _nsPatternCache.keys().next().value;
|
|
1019
1061
|
if (firstKey !== void 0) _nsPatternCache.delete(firstKey);
|
|
1062
|
+
_nsCacheEvictionCount++;
|
|
1063
|
+
if (!_nsCacheEvictionWarned) {
|
|
1064
|
+
_nsCacheEvictionWarned = true;
|
|
1065
|
+
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`);
|
|
1066
|
+
}
|
|
1020
1067
|
}
|
|
1021
1068
|
_nsPatternCache.set(pattern, re);
|
|
1022
1069
|
}
|
|
@@ -1692,7 +1739,7 @@ let LogixiaLoggerService = _LogixiaLoggerService = class LogixiaLoggerService$1
|
|
|
1692
1739
|
return this.logger.getLevel();
|
|
1693
1740
|
}
|
|
1694
1741
|
child(context$1, data) {
|
|
1695
|
-
const childService = new _LogixiaLoggerService();
|
|
1742
|
+
const childService = new _LogixiaLoggerService(this._mergedConfig);
|
|
1696
1743
|
childService.logger = this.logger.child(context$1, data);
|
|
1697
1744
|
childService.context = context$1;
|
|
1698
1745
|
return childService;
|
|
@@ -10583,9 +10630,33 @@ var require_cjs = /* @__PURE__ */ require_chunk.__commonJS({ "node_modules/rxjs/
|
|
|
10583
10630
|
//#endregion
|
|
10584
10631
|
//#region src/core/kafka-trace.interceptor.ts
|
|
10585
10632
|
var import_cjs$1 = /* @__PURE__ */ require_chunk.__toESM(require_cjs());
|
|
10633
|
+
var _KafkaTraceInterceptor;
|
|
10586
10634
|
let KafkaTraceInterceptor = class KafkaTraceInterceptor$1 {
|
|
10587
|
-
|
|
10635
|
+
static {
|
|
10636
|
+
_KafkaTraceInterceptor = this;
|
|
10637
|
+
}
|
|
10638
|
+
static #_ = this.metrics = {
|
|
10639
|
+
accepted: 0,
|
|
10640
|
+
acceptedWithoutTrace: 0,
|
|
10641
|
+
dropped: 0
|
|
10642
|
+
};
|
|
10643
|
+
/** Reset counters (tests). */
|
|
10644
|
+
static resetMetrics() {
|
|
10645
|
+
_KafkaTraceInterceptor.metrics.accepted = 0;
|
|
10646
|
+
_KafkaTraceInterceptor.metrics.acceptedWithoutTrace = 0;
|
|
10647
|
+
_KafkaTraceInterceptor.metrics.dropped = 0;
|
|
10648
|
+
}
|
|
10649
|
+
/**
|
|
10650
|
+
* @param config - TraceIdConfig options (extractor keys, contextKey, etc.)
|
|
10651
|
+
* @param requireTraceId - When true, messages with no traceId are silently skipped
|
|
10652
|
+
* (EMPTY Observable — message is ack'd, consumer stays alive).
|
|
10653
|
+
* A WARN is logged AND `KafkaTraceInterceptor.metrics.dropped`
|
|
10654
|
+
* increments so the missing traceId is observable end-to-end.
|
|
10655
|
+
* Default: false (handler runs without trace context).
|
|
10656
|
+
*/
|
|
10657
|
+
constructor(config, requireTraceId = false) {
|
|
10588
10658
|
this.config = config;
|
|
10659
|
+
this.requireTraceId = requireTraceId;
|
|
10589
10660
|
this.ctx = TraceContext.instance;
|
|
10590
10661
|
this.config = {
|
|
10591
10662
|
enabled: true,
|
|
@@ -10610,12 +10681,22 @@ let KafkaTraceInterceptor = class KafkaTraceInterceptor$1 {
|
|
|
10610
10681
|
let traceId;
|
|
10611
10682
|
if (this.config.extractor) traceId = extractTraceId({
|
|
10612
10683
|
body: data,
|
|
10613
|
-
headers: (rpcData === null || rpcData === void 0 ? void 0 : rpcData.headers)
|
|
10684
|
+
headers: (rpcData === null || rpcData === void 0 ? void 0 : rpcData.headers) ?? {},
|
|
10614
10685
|
query: {},
|
|
10615
10686
|
params: {}
|
|
10616
10687
|
}, this.config.extractor);
|
|
10617
10688
|
if (!traceId) traceId = this.ctx.getCurrentTraceId();
|
|
10618
|
-
if (!traceId)
|
|
10689
|
+
if (!traceId) {
|
|
10690
|
+
if (this.requireTraceId) {
|
|
10691
|
+
var _LogixiaLoggerModule$;
|
|
10692
|
+
_KafkaTraceInterceptor.metrics.dropped++;
|
|
10693
|
+
(_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.`);
|
|
10694
|
+
return import_cjs$1.EMPTY;
|
|
10695
|
+
}
|
|
10696
|
+
_KafkaTraceInterceptor.metrics.acceptedWithoutTrace++;
|
|
10697
|
+
return next.handle();
|
|
10698
|
+
}
|
|
10699
|
+
_KafkaTraceInterceptor.metrics.accepted++;
|
|
10619
10700
|
const kafkaContext = {
|
|
10620
10701
|
messageType: "kafka",
|
|
10621
10702
|
topic: rpcData === null || rpcData === void 0 ? void 0 : rpcData.topic,
|
|
@@ -10635,7 +10716,7 @@ let KafkaTraceInterceptor = class KafkaTraceInterceptor$1 {
|
|
|
10635
10716
|
});
|
|
10636
10717
|
}
|
|
10637
10718
|
};
|
|
10638
|
-
KafkaTraceInterceptor = __decorate([(0, __nestjs_common.Injectable)(), __decorateMetadata("design:paramtypes", [Object])], KafkaTraceInterceptor);
|
|
10719
|
+
KafkaTraceInterceptor = _KafkaTraceInterceptor = __decorate([(0, __nestjs_common.Injectable)(), __decorateMetadata("design:paramtypes", [Object, Boolean])], KafkaTraceInterceptor);
|
|
10639
10720
|
|
|
10640
10721
|
//#endregion
|
|
10641
10722
|
//#region \0@oxc-project+runtime@0.95.0/helpers/decorateParam.js
|
|
@@ -10647,6 +10728,18 @@ function __decorateParam(paramIndex, decorator) {
|
|
|
10647
10728
|
|
|
10648
10729
|
//#endregion
|
|
10649
10730
|
//#region src/core/trace.middleware.ts
|
|
10731
|
+
/** Default response header used to echo the resolved traceId back to the caller. */
|
|
10732
|
+
const DEFAULT_TRACE_RESPONSE_HEADER = "X-Trace-Id";
|
|
10733
|
+
/**
|
|
10734
|
+
* Resolve the response header name from config.
|
|
10735
|
+
* - `undefined` → default `'X-Trace-Id'`
|
|
10736
|
+
* - `string` → user's custom header
|
|
10737
|
+
* - `false` → `null` (suppress entirely)
|
|
10738
|
+
*/
|
|
10739
|
+
function resolveResponseHeader(config) {
|
|
10740
|
+
if ((config === null || config === void 0 ? void 0 : config.responseHeader) === false) return null;
|
|
10741
|
+
return (config === null || config === void 0 ? void 0 : config.responseHeader) ?? DEFAULT_TRACE_RESPONSE_HEADER;
|
|
10742
|
+
}
|
|
10650
10743
|
let TraceMiddleware = class TraceMiddleware$1 {
|
|
10651
10744
|
constructor(config) {
|
|
10652
10745
|
this.config = config;
|
|
@@ -10665,16 +10758,22 @@ let TraceMiddleware = class TraceMiddleware$1 {
|
|
|
10665
10758
|
...config.extractor
|
|
10666
10759
|
} : defaultExtractor
|
|
10667
10760
|
};
|
|
10668
|
-
this.ctx.setContextKey(this.config.contextKey ?? "traceId");
|
|
10761
|
+
if (this.config.enabled) this.ctx.setContextKey(this.config.contextKey ?? "traceId");
|
|
10669
10762
|
}
|
|
10670
10763
|
use(req, res, next) {
|
|
10671
10764
|
var _this$config;
|
|
10672
10765
|
if (!((_this$config = this.config) === null || _this$config === void 0 ? void 0 : _this$config.enabled)) return next();
|
|
10673
10766
|
let traceId;
|
|
10674
10767
|
if (this.config.extractor) traceId = extractTraceId(req, this.config.extractor);
|
|
10675
|
-
if (!traceId
|
|
10768
|
+
if (!traceId && this.config.generator) {
|
|
10769
|
+
const candidate = this.config.generator();
|
|
10770
|
+
if (typeof candidate === "string" && candidate.trim().length > 0) traceId = candidate;
|
|
10771
|
+
else process.stderr.write("[logixia] TraceIdConfig.generator returned a non-string/empty value — using built-in generator.\n");
|
|
10772
|
+
}
|
|
10773
|
+
if (!traceId) traceId = this.ctx.generate();
|
|
10676
10774
|
req.traceId = traceId;
|
|
10677
|
-
|
|
10775
|
+
const header = resolveResponseHeader(this.config);
|
|
10776
|
+
if (header) res.setHeader(header, traceId);
|
|
10678
10777
|
this.ctx.run(traceId, () => next(), {
|
|
10679
10778
|
method: req.method,
|
|
10680
10779
|
url: req.url,
|
|
@@ -10768,6 +10867,29 @@ let LogixiaLoggerModule = class LogixiaLoggerModule$1 {
|
|
|
10768
10867
|
static #_ = this.loggerConfig = {};
|
|
10769
10868
|
static #_2 = this._globalLogger = null;
|
|
10770
10869
|
/**
|
|
10870
|
+
* @internal Set the global logger exactly once.
|
|
10871
|
+
*
|
|
10872
|
+
* Called from the module's forRoot / forRootAsync factory. If the module is
|
|
10873
|
+
* initialised more than once in the same process (nested DI context, test
|
|
10874
|
+
* harness creating multiple apps, hot reload, etc.) a warning is written to
|
|
10875
|
+
* stderr and the first logger wins — silently overwriting would allow the
|
|
10876
|
+
* newer instance's transport config to replace the live one while the old
|
|
10877
|
+
* one is still being used by registered shutdown hooks, decorators, etc.
|
|
10878
|
+
*
|
|
10879
|
+
* Use {@link _resetGlobalLogger} in tests to reset between runs.
|
|
10880
|
+
*/
|
|
10881
|
+
static _setGlobalLogger(service) {
|
|
10882
|
+
if (_LogixiaLoggerModule._globalLogger !== null) {
|
|
10883
|
+
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");
|
|
10884
|
+
return;
|
|
10885
|
+
}
|
|
10886
|
+
_LogixiaLoggerModule._globalLogger = service;
|
|
10887
|
+
}
|
|
10888
|
+
/** @internal Clear the global logger. Tests only. */
|
|
10889
|
+
static _resetGlobalLogger() {
|
|
10890
|
+
_LogixiaLoggerModule._globalLogger = null;
|
|
10891
|
+
}
|
|
10892
|
+
/**
|
|
10771
10893
|
* Returns the global LogixiaLoggerService instance that was created when the
|
|
10772
10894
|
* module booted. Useful for logging outside of NestJS DI — utility functions,
|
|
10773
10895
|
* plain scripts, decorators — without injecting the service everywhere.
|
|
@@ -10790,17 +10912,15 @@ let LogixiaLoggerModule = class LogixiaLoggerModule$1 {
|
|
|
10790
10912
|
}
|
|
10791
10913
|
configure(consumer) {
|
|
10792
10914
|
const { forRoutes = DEFAULT_ROUTES, exclude } = this.config;
|
|
10793
|
-
|
|
10794
|
-
|
|
10795
|
-
|
|
10796
|
-
|
|
10797
|
-
|
|
10798
|
-
|
|
10799
|
-
generator: () => TraceContext.instance.generate()
|
|
10800
|
-
};
|
|
10801
|
-
else traceConfig = void 0;
|
|
10802
|
-
return new TraceMiddleware(traceConfig).use(req, res, next);
|
|
10915
|
+
let resolvedTraceConfig;
|
|
10916
|
+
if (typeof _LogixiaLoggerModule.loggerConfig.traceId === "object") resolvedTraceConfig = _LogixiaLoggerModule.loggerConfig.traceId;
|
|
10917
|
+
else if (_LogixiaLoggerModule.loggerConfig.traceId === true) resolvedTraceConfig = {
|
|
10918
|
+
enabled: true,
|
|
10919
|
+
contextKey: "traceId",
|
|
10920
|
+
generator: () => TraceContext.instance.generate()
|
|
10803
10921
|
};
|
|
10922
|
+
const middleware = new TraceMiddleware(resolvedTraceConfig);
|
|
10923
|
+
const middlewareConfig = (req, res, next) => middleware.use(req, res, next);
|
|
10804
10924
|
if (exclude) consumer.apply(middlewareConfig).exclude(...exclude).forRoutes(...forRoutes);
|
|
10805
10925
|
else consumer.apply(middlewareConfig).forRoutes(...forRoutes);
|
|
10806
10926
|
}
|
|
@@ -10850,7 +10970,7 @@ let LogixiaLoggerModule = class LogixiaLoggerModule$1 {
|
|
|
10850
10970
|
},
|
|
10851
10971
|
...loggerConfig
|
|
10852
10972
|
});
|
|
10853
|
-
_LogixiaLoggerModule.
|
|
10973
|
+
_LogixiaLoggerModule._setGlobalLogger(service);
|
|
10854
10974
|
return service;
|
|
10855
10975
|
},
|
|
10856
10976
|
inject: [LOGIXIA_LOGGER_CONFIG]
|
|
@@ -10922,7 +11042,7 @@ let LogixiaLoggerModule = class LogixiaLoggerModule$1 {
|
|
|
10922
11042
|
};
|
|
10923
11043
|
_LogixiaLoggerModule.loggerConfig = defaultConfig;
|
|
10924
11044
|
const service = new LogixiaLoggerService(defaultConfig);
|
|
10925
|
-
_LogixiaLoggerModule.
|
|
11045
|
+
_LogixiaLoggerModule._setGlobalLogger(service);
|
|
10926
11046
|
return service;
|
|
10927
11047
|
},
|
|
10928
11048
|
inject: [LOGIXIA_LOGGER_CONFIG]
|
|
@@ -11227,6 +11347,12 @@ Object.defineProperty(exports, 'resetShutdownHandlers', {
|
|
|
11227
11347
|
return resetShutdownHandlers;
|
|
11228
11348
|
}
|
|
11229
11349
|
});
|
|
11350
|
+
Object.defineProperty(exports, 'resolveResponseHeader', {
|
|
11351
|
+
enumerable: true,
|
|
11352
|
+
get: function () {
|
|
11353
|
+
return resolveResponseHeader;
|
|
11354
|
+
}
|
|
11355
|
+
});
|
|
11230
11356
|
Object.defineProperty(exports, 'runWithTraceId', {
|
|
11231
11357
|
enumerable: true,
|
|
11232
11358
|
get: function () {
|
|
@@ -11257,4 +11383,4 @@ Object.defineProperty(exports, 'usePlugin', {
|
|
|
11257
11383
|
return usePlugin;
|
|
11258
11384
|
}
|
|
11259
11385
|
});
|
|
11260
|
-
//# sourceMappingURL=logitron-logger.module-
|
|
11386
|
+
//# sourceMappingURL=logitron-logger.module-B-sUxEiz.js.map
|