@lark-apaas/nestjs-logger 1.0.2 → 1.0.3-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +13 -0
- package/dist/index.cjs +86 -121
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -20
- package/dist/index.d.ts +4 -20
- package/dist/index.js +75 -110
- package/dist/index.js.map +1 -1
- package/package.json +4 -2
package/LICENSE
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Lark Technologies Pte. Ltd. and/or its affiliates
|
|
4
|
+
|
|
5
|
+
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted,provided that the above copyright notice and this permission notice appear in all copies.
|
|
6
|
+
|
|
7
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
|
8
|
+
IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE
|
|
9
|
+
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO
|
|
10
|
+
EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
|
|
11
|
+
CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
|
12
|
+
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
|
13
|
+
ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
package/dist/index.cjs
CHANGED
|
@@ -452,7 +452,7 @@ var require_config_constants = __commonJS({
|
|
|
452
452
|
value: true
|
|
453
453
|
});
|
|
454
454
|
exports2.AS_PROVIDER_METHOD_KEY = exports2.VALIDATED_ENV_PROPNAME = exports2.PARTIAL_CONFIGURATION_PROPNAME = exports2.PARTIAL_CONFIGURATION_KEY = exports2.VALIDATED_ENV_LOADER = exports2.CONFIGURATION_LOADER = exports2.CONFIGURATION_TOKEN = exports2.CONFIGURATION_SERVICE_TOKEN = void 0;
|
|
455
|
-
exports2.CONFIGURATION_SERVICE_TOKEN = Symbol("CONFIG_SERVICE");
|
|
455
|
+
exports2.CONFIGURATION_SERVICE_TOKEN = /* @__PURE__ */ Symbol("CONFIG_SERVICE");
|
|
456
456
|
exports2.CONFIGURATION_TOKEN = "CONFIGURATION_TOKEN";
|
|
457
457
|
exports2.CONFIGURATION_LOADER = "CONFIGURATION_LOADER";
|
|
458
458
|
exports2.VALIDATED_ENV_LOADER = "VALIDATED_ENV_LOADER";
|
|
@@ -14381,17 +14381,14 @@ __export(index_exports, {
|
|
|
14381
14381
|
module.exports = __toCommonJS(index_exports);
|
|
14382
14382
|
|
|
14383
14383
|
// src/service/app-logger.service.ts
|
|
14384
|
-
var
|
|
14385
|
-
var import_util = require("util");
|
|
14384
|
+
var import_common = require("@nestjs/common");
|
|
14386
14385
|
|
|
14387
14386
|
// src/helper/constants.ts
|
|
14388
|
-
var PINO_ROOT_LOGGER = Symbol("PINO_ROOT_LOGGER");
|
|
14389
|
-
var TRACE_LOGGER = Symbol("TRACE_LOGGER");
|
|
14390
|
-
var METRICS_LOGGER = Symbol("METRICS_LOGGER");
|
|
14387
|
+
var PINO_ROOT_LOGGER = /* @__PURE__ */ Symbol("PINO_ROOT_LOGGER");
|
|
14388
|
+
var TRACE_LOGGER = /* @__PURE__ */ Symbol("TRACE_LOGGER");
|
|
14391
14389
|
|
|
14392
|
-
// src/service/
|
|
14393
|
-
var
|
|
14394
|
-
var import_async_hooks = require("async_hooks");
|
|
14390
|
+
// src/service/app-logger.service.ts
|
|
14391
|
+
var import_nestjs_common = require("@lark-apaas/nestjs-common");
|
|
14395
14392
|
function _ts_decorate(decorators, target, key, desc) {
|
|
14396
14393
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
14397
14394
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -14399,43 +14396,6 @@ function _ts_decorate(decorators, target, key, desc) {
|
|
|
14399
14396
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
14400
14397
|
}
|
|
14401
14398
|
__name(_ts_decorate, "_ts_decorate");
|
|
14402
|
-
var RequestContextService = class {
|
|
14403
|
-
static {
|
|
14404
|
-
__name(this, "RequestContextService");
|
|
14405
|
-
}
|
|
14406
|
-
storage = new import_async_hooks.AsyncLocalStorage();
|
|
14407
|
-
run(context, callback) {
|
|
14408
|
-
const store = {
|
|
14409
|
-
...context
|
|
14410
|
-
};
|
|
14411
|
-
return this.storage.run(store, callback);
|
|
14412
|
-
}
|
|
14413
|
-
setContext(partial) {
|
|
14414
|
-
const store = this.storage.getStore();
|
|
14415
|
-
if (!store) {
|
|
14416
|
-
return;
|
|
14417
|
-
}
|
|
14418
|
-
Object.assign(store, partial);
|
|
14419
|
-
}
|
|
14420
|
-
getContext() {
|
|
14421
|
-
return this.storage.getStore();
|
|
14422
|
-
}
|
|
14423
|
-
get(key) {
|
|
14424
|
-
return this.storage.getStore()?.[key];
|
|
14425
|
-
}
|
|
14426
|
-
};
|
|
14427
|
-
RequestContextService = _ts_decorate([
|
|
14428
|
-
(0, import_common.Injectable)()
|
|
14429
|
-
], RequestContextService);
|
|
14430
|
-
|
|
14431
|
-
// src/service/app-logger.service.ts
|
|
14432
|
-
function _ts_decorate2(decorators, target, key, desc) {
|
|
14433
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
14434
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
14435
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
14436
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
14437
|
-
}
|
|
14438
|
-
__name(_ts_decorate2, "_ts_decorate");
|
|
14439
14399
|
function _ts_metadata(k, v) {
|
|
14440
14400
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
14441
14401
|
}
|
|
@@ -14543,10 +14503,12 @@ var BasePinoLogger = class _BasePinoLogger {
|
|
|
14543
14503
|
}
|
|
14544
14504
|
logger;
|
|
14545
14505
|
contextStore;
|
|
14506
|
+
observableService;
|
|
14546
14507
|
levelState = new LogLevelState();
|
|
14547
|
-
constructor(logger, contextStore) {
|
|
14508
|
+
constructor(logger, contextStore, observableService) {
|
|
14548
14509
|
this.logger = logger;
|
|
14549
14510
|
this.contextStore = contextStore;
|
|
14511
|
+
this.observableService = observableService;
|
|
14550
14512
|
const pinoLevel = this.logger.level;
|
|
14551
14513
|
const nestLevels = LogLevelState.fromPinoLevel(pinoLevel);
|
|
14552
14514
|
this.levelState.set(nestLevels);
|
|
@@ -14610,6 +14572,26 @@ var BasePinoLogger = class _BasePinoLogger {
|
|
|
14610
14572
|
const { context, stack, extras } = this.extractOptionalParams(optionalParams, treatStack);
|
|
14611
14573
|
const requestState = this.contextStore.getContext();
|
|
14612
14574
|
const traceId = requestState?.requestId ?? null;
|
|
14575
|
+
const flatObject = /* @__PURE__ */ __name((extra) => {
|
|
14576
|
+
let res = {};
|
|
14577
|
+
try {
|
|
14578
|
+
extra.forEach((item) => {
|
|
14579
|
+
if (typeof item === "object" && item !== null) {
|
|
14580
|
+
res = {
|
|
14581
|
+
...res,
|
|
14582
|
+
...item
|
|
14583
|
+
};
|
|
14584
|
+
}
|
|
14585
|
+
});
|
|
14586
|
+
delete res.message;
|
|
14587
|
+
delete res.level;
|
|
14588
|
+
delete res.time;
|
|
14589
|
+
delete res.context;
|
|
14590
|
+
return res;
|
|
14591
|
+
} catch {
|
|
14592
|
+
}
|
|
14593
|
+
}, "flatObject");
|
|
14594
|
+
const processedExtra = flatObject(extras);
|
|
14613
14595
|
const payload = {
|
|
14614
14596
|
trace_id: traceId,
|
|
14615
14597
|
path: requestState?.path,
|
|
@@ -14617,12 +14599,13 @@ var BasePinoLogger = class _BasePinoLogger {
|
|
|
14617
14599
|
user_id: requestState?.userId ?? null,
|
|
14618
14600
|
app_id: requestState?.appId ?? null,
|
|
14619
14601
|
tenant_id: requestState?.tenantId ?? null,
|
|
14620
|
-
pid: process.pid
|
|
14602
|
+
pid: process.pid,
|
|
14603
|
+
...processedExtra
|
|
14621
14604
|
};
|
|
14622
14605
|
if (context) {
|
|
14623
14606
|
payload.context = context;
|
|
14624
14607
|
}
|
|
14625
|
-
const { messageText, stack: computedStack, data } = this.buildMessagePayload(message
|
|
14608
|
+
const { messageText, stack: computedStack, data } = this.buildMessagePayload(message);
|
|
14626
14609
|
if (stack) {
|
|
14627
14610
|
payload.stack = stack;
|
|
14628
14611
|
} else if (computedStack) {
|
|
@@ -14633,10 +14616,14 @@ var BasePinoLogger = class _BasePinoLogger {
|
|
|
14633
14616
|
}
|
|
14634
14617
|
const pinoLevel = mapLogLevelToPino(level);
|
|
14635
14618
|
const sanitizedPayload = sanitizeValue(payload);
|
|
14636
|
-
if (
|
|
14637
|
-
|
|
14619
|
+
if (process.env.NODE_ENV === "development") {
|
|
14620
|
+
if (messageText) {
|
|
14621
|
+
this.logger[pinoLevel](sanitizedPayload, messageText);
|
|
14622
|
+
} else {
|
|
14623
|
+
this.logger[pinoLevel](sanitizedPayload);
|
|
14624
|
+
}
|
|
14638
14625
|
} else {
|
|
14639
|
-
this.
|
|
14626
|
+
this.observableService.log(level, messageText ?? "", payload);
|
|
14640
14627
|
}
|
|
14641
14628
|
}
|
|
14642
14629
|
extractOptionalParams(optionalParams, treatStack) {
|
|
@@ -14665,7 +14652,7 @@ var BasePinoLogger = class _BasePinoLogger {
|
|
|
14665
14652
|
extras: params
|
|
14666
14653
|
};
|
|
14667
14654
|
}
|
|
14668
|
-
buildMessagePayload(message
|
|
14655
|
+
buildMessagePayload(message) {
|
|
14669
14656
|
if (message instanceof Error) {
|
|
14670
14657
|
return {
|
|
14671
14658
|
messageText: message.message,
|
|
@@ -14673,17 +14660,8 @@ var BasePinoLogger = class _BasePinoLogger {
|
|
|
14673
14660
|
};
|
|
14674
14661
|
}
|
|
14675
14662
|
if (typeof message === "string") {
|
|
14676
|
-
if (extras.length === 0) {
|
|
14677
|
-
return {
|
|
14678
|
-
messageText: message
|
|
14679
|
-
};
|
|
14680
|
-
}
|
|
14681
|
-
const allMessages = [
|
|
14682
|
-
message,
|
|
14683
|
-
...extras.map((e) => stringifyParam(e))
|
|
14684
|
-
].join(" ");
|
|
14685
14663
|
return {
|
|
14686
|
-
messageText:
|
|
14664
|
+
messageText: message
|
|
14687
14665
|
};
|
|
14688
14666
|
}
|
|
14689
14667
|
if (typeof message === "object" && message !== null) {
|
|
@@ -14706,18 +14684,20 @@ var AppLogger = class extends BasePinoLogger {
|
|
|
14706
14684
|
static {
|
|
14707
14685
|
__name(this, "AppLogger");
|
|
14708
14686
|
}
|
|
14709
|
-
constructor(logger, requestContext) {
|
|
14710
|
-
super(logger, requestContext);
|
|
14711
|
-
|
|
14687
|
+
constructor(logger, observableService, requestContext) {
|
|
14688
|
+
super(logger, requestContext, observableService);
|
|
14689
|
+
import_common.Logger.overrideLogger(this);
|
|
14712
14690
|
}
|
|
14713
14691
|
};
|
|
14714
|
-
AppLogger =
|
|
14715
|
-
(0,
|
|
14716
|
-
_ts_param(0, (0,
|
|
14692
|
+
AppLogger = _ts_decorate([
|
|
14693
|
+
(0, import_common.Injectable)(),
|
|
14694
|
+
_ts_param(0, (0, import_common.Inject)(PINO_ROOT_LOGGER)),
|
|
14695
|
+
_ts_param(1, (0, import_common.Inject)(import_nestjs_common.OBSERVABLE_SERVICE)),
|
|
14717
14696
|
_ts_metadata("design:type", Function),
|
|
14718
14697
|
_ts_metadata("design:paramtypes", [
|
|
14719
14698
|
typeof PinoLogger === "undefined" ? Object : PinoLogger,
|
|
14720
|
-
typeof
|
|
14699
|
+
typeof import_nestjs_common.ObservableService === "undefined" ? Object : import_nestjs_common.ObservableService,
|
|
14700
|
+
typeof import_nestjs_common.RequestContextService === "undefined" ? Object : import_nestjs_common.RequestContextService
|
|
14721
14701
|
])
|
|
14722
14702
|
], AppLogger);
|
|
14723
14703
|
var PinoLoggerService = class extends BasePinoLogger {
|
|
@@ -14743,18 +14723,6 @@ function mapLogLevelToPino(level) {
|
|
|
14743
14723
|
}
|
|
14744
14724
|
}
|
|
14745
14725
|
__name(mapLogLevelToPino, "mapLogLevelToPino");
|
|
14746
|
-
function stringifyParam(param) {
|
|
14747
|
-
if (typeof param === "string") {
|
|
14748
|
-
return param;
|
|
14749
|
-
}
|
|
14750
|
-
const inspectOptions = {
|
|
14751
|
-
depth: 4,
|
|
14752
|
-
colors: false,
|
|
14753
|
-
compact: true
|
|
14754
|
-
};
|
|
14755
|
-
return (0, import_util.inspect)(param, inspectOptions);
|
|
14756
|
-
}
|
|
14757
|
-
__name(stringifyParam, "stringifyParam");
|
|
14758
14726
|
function sanitizeValue(value) {
|
|
14759
14727
|
if (value === null || value === void 0) {
|
|
14760
14728
|
return value;
|
|
@@ -14777,9 +14745,10 @@ function sanitizeValue(value) {
|
|
|
14777
14745
|
__name(sanitizeValue, "sanitizeValue");
|
|
14778
14746
|
|
|
14779
14747
|
// src/module.ts
|
|
14780
|
-
var
|
|
14748
|
+
var import_common4 = require("@nestjs/common");
|
|
14781
14749
|
var import_core = require("@nestjs/core");
|
|
14782
14750
|
var import_config3 = __toESM(require_config2(), 1);
|
|
14751
|
+
var import_nestjs_common4 = require("@lark-apaas/nestjs-common");
|
|
14783
14752
|
|
|
14784
14753
|
// src/config/logger.config.ts
|
|
14785
14754
|
var import_config = __toESM(require_config2(), 1);
|
|
@@ -14813,17 +14782,18 @@ var logger_config_default = (0, import_config.registerAs)("logger", () => {
|
|
|
14813
14782
|
});
|
|
14814
14783
|
|
|
14815
14784
|
// src/interceptor/logging.interceptor.ts
|
|
14816
|
-
var
|
|
14785
|
+
var import_common2 = require("@nestjs/common");
|
|
14817
14786
|
var import_config2 = __toESM(require_config2(), 1);
|
|
14818
14787
|
var import_operators = __toESM(require_operators(), 1);
|
|
14819
|
-
var
|
|
14820
|
-
|
|
14788
|
+
var import_util = require("util");
|
|
14789
|
+
var import_nestjs_common2 = require("@lark-apaas/nestjs-common");
|
|
14790
|
+
function _ts_decorate2(decorators, target, key, desc) {
|
|
14821
14791
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
14822
14792
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
14823
14793
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
14824
14794
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
14825
14795
|
}
|
|
14826
|
-
__name(
|
|
14796
|
+
__name(_ts_decorate2, "_ts_decorate");
|
|
14827
14797
|
function _ts_metadata2(k, v) {
|
|
14828
14798
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
14829
14799
|
}
|
|
@@ -14947,7 +14917,7 @@ duration_ms=${durationMs}`, "HTTPTraceInterceptor");
|
|
|
14947
14917
|
this.traceLogger.logStructured(traceLevel, isError ? "HTTP request failed" : "HTTP request completed", responseMeta, "HTTPTraceInterceptor");
|
|
14948
14918
|
});
|
|
14949
14919
|
return next.handle().pipe((0, import_operators.catchError)((error) => {
|
|
14950
|
-
this.appLogger.error((0,
|
|
14920
|
+
this.appLogger.error((0, import_util.format)("HTTP request exception\nmethod=%s url=%s\nerror=%o", req.method, req.url, error), "HTTPTraceInterceptor");
|
|
14951
14921
|
throw error;
|
|
14952
14922
|
}));
|
|
14953
14923
|
}
|
|
@@ -14972,20 +14942,21 @@ duration_ms=${durationMs}`, "HTTPTraceInterceptor");
|
|
|
14972
14942
|
return {
|
|
14973
14943
|
_error: "Failed to serialize data",
|
|
14974
14944
|
_type: typeof data,
|
|
14945
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14975
14946
|
_constructor: data?.constructor?.name
|
|
14976
14947
|
};
|
|
14977
14948
|
}
|
|
14978
14949
|
}
|
|
14979
14950
|
};
|
|
14980
|
-
LoggingInterceptor =
|
|
14981
|
-
(0,
|
|
14982
|
-
_ts_param2(0, (0,
|
|
14983
|
-
_ts_param2(2, (0,
|
|
14984
|
-
_ts_param2(3, (0,
|
|
14951
|
+
LoggingInterceptor = _ts_decorate2([
|
|
14952
|
+
(0, import_common2.Injectable)(),
|
|
14953
|
+
_ts_param2(0, (0, import_common2.Inject)(TRACE_LOGGER)),
|
|
14954
|
+
_ts_param2(2, (0, import_common2.Inject)(AppLogger)),
|
|
14955
|
+
_ts_param2(3, (0, import_common2.Inject)(logger_config_default.KEY)),
|
|
14985
14956
|
_ts_metadata2("design:type", Function),
|
|
14986
14957
|
_ts_metadata2("design:paramtypes", [
|
|
14987
14958
|
typeof PinoLoggerService === "undefined" ? Object : PinoLoggerService,
|
|
14988
|
-
typeof RequestContextService === "undefined" ? Object : RequestContextService,
|
|
14959
|
+
typeof import_nestjs_common2.RequestContextService === "undefined" ? Object : import_nestjs_common2.RequestContextService,
|
|
14989
14960
|
typeof AppLogger === "undefined" ? Object : AppLogger,
|
|
14990
14961
|
typeof import_config2.ConfigType === "undefined" ? Object : import_config2.ConfigType
|
|
14991
14962
|
])
|
|
@@ -15042,15 +15013,16 @@ function createFileDestination(pathname) {
|
|
|
15042
15013
|
__name(createFileDestination, "createFileDestination");
|
|
15043
15014
|
|
|
15044
15015
|
// src/middleware/logger-context.middleware.ts
|
|
15045
|
-
var
|
|
15016
|
+
var import_common3 = require("@nestjs/common");
|
|
15046
15017
|
var import_crypto = require("crypto");
|
|
15047
|
-
|
|
15018
|
+
var import_nestjs_common3 = require("@lark-apaas/nestjs-common");
|
|
15019
|
+
function _ts_decorate3(decorators, target, key, desc) {
|
|
15048
15020
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
15049
15021
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
15050
15022
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
15051
15023
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
15052
15024
|
}
|
|
15053
|
-
__name(
|
|
15025
|
+
__name(_ts_decorate3, "_ts_decorate");
|
|
15054
15026
|
function _ts_metadata3(k, v) {
|
|
15055
15027
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
15056
15028
|
}
|
|
@@ -15065,51 +15037,44 @@ var LoggerContextMiddleware = class {
|
|
|
15065
15037
|
}
|
|
15066
15038
|
use(req, res, next) {
|
|
15067
15039
|
const requestId = req.headers["x-tt-log-id"] ?? (0, import_crypto.randomUUID)();
|
|
15068
|
-
const path = req.originalUrl ?? req.url;
|
|
15069
|
-
const userContext = req.userContext ?? {};
|
|
15070
15040
|
const mutableReq = req;
|
|
15071
15041
|
mutableReq.requestId = requestId;
|
|
15072
15042
|
mutableReq.id = requestId;
|
|
15073
15043
|
res.setHeader("x-log-trace-id", requestId);
|
|
15074
|
-
this.requestContext.
|
|
15075
|
-
requestId
|
|
15076
|
-
|
|
15077
|
-
|
|
15078
|
-
userId: userContext.userId,
|
|
15079
|
-
tenantId: userContext.tenantId,
|
|
15080
|
-
appId: userContext.appId
|
|
15081
|
-
}, () => next());
|
|
15044
|
+
this.requestContext.setContext({
|
|
15045
|
+
requestId
|
|
15046
|
+
});
|
|
15047
|
+
next();
|
|
15082
15048
|
}
|
|
15083
15049
|
};
|
|
15084
|
-
LoggerContextMiddleware =
|
|
15085
|
-
(0,
|
|
15050
|
+
LoggerContextMiddleware = _ts_decorate3([
|
|
15051
|
+
(0, import_common3.Injectable)(),
|
|
15086
15052
|
_ts_metadata3("design:type", Function),
|
|
15087
15053
|
_ts_metadata3("design:paramtypes", [
|
|
15088
|
-
typeof RequestContextService === "undefined" ? Object : RequestContextService
|
|
15054
|
+
typeof import_nestjs_common3.RequestContextService === "undefined" ? Object : import_nestjs_common3.RequestContextService
|
|
15089
15055
|
])
|
|
15090
15056
|
], LoggerContextMiddleware);
|
|
15091
15057
|
|
|
15092
15058
|
// src/module.ts
|
|
15093
|
-
function
|
|
15059
|
+
function _ts_decorate4(decorators, target, key, desc) {
|
|
15094
15060
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
15095
15061
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
15096
15062
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
15097
15063
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
15098
15064
|
}
|
|
15099
|
-
__name(
|
|
15065
|
+
__name(_ts_decorate4, "_ts_decorate");
|
|
15100
15066
|
var LoggerModule = class {
|
|
15101
15067
|
static {
|
|
15102
15068
|
__name(this, "LoggerModule");
|
|
15103
15069
|
}
|
|
15104
15070
|
};
|
|
15105
|
-
LoggerModule =
|
|
15106
|
-
(0,
|
|
15107
|
-
(0,
|
|
15071
|
+
LoggerModule = _ts_decorate4([
|
|
15072
|
+
(0, import_common4.Global)(),
|
|
15073
|
+
(0, import_common4.Module)({
|
|
15108
15074
|
imports: [
|
|
15109
15075
|
import_config3.ConfigModule.forFeature(logger_config_default)
|
|
15110
15076
|
],
|
|
15111
15077
|
providers: [
|
|
15112
|
-
RequestContextService,
|
|
15113
15078
|
LoggerContextMiddleware,
|
|
15114
15079
|
{
|
|
15115
15080
|
provide: PINO_ROOT_LOGGER,
|
|
@@ -15125,13 +15090,14 @@ LoggerModule = _ts_decorate5([
|
|
|
15125
15090
|
},
|
|
15126
15091
|
{
|
|
15127
15092
|
provide: TRACE_LOGGER,
|
|
15128
|
-
useFactory: /* @__PURE__ */ __name((requestContext, config) => new PinoLoggerService(createPinoLogger({
|
|
15093
|
+
useFactory: /* @__PURE__ */ __name((requestContext, config, observableService) => new PinoLoggerService(createPinoLogger({
|
|
15129
15094
|
level: config.level,
|
|
15130
15095
|
filePath: `${config.logDir}/trace.log`
|
|
15131
|
-
}), requestContext), "useFactory"),
|
|
15096
|
+
}), requestContext, observableService), "useFactory"),
|
|
15132
15097
|
inject: [
|
|
15133
|
-
RequestContextService,
|
|
15134
|
-
logger_config_default.KEY
|
|
15098
|
+
import_nestjs_common4.RequestContextService,
|
|
15099
|
+
logger_config_default.KEY,
|
|
15100
|
+
import_nestjs_common4.OBSERVABLE_SERVICE
|
|
15135
15101
|
]
|
|
15136
15102
|
},
|
|
15137
15103
|
AppLogger,
|
|
@@ -15144,7 +15110,6 @@ LoggerModule = _ts_decorate5([
|
|
|
15144
15110
|
exports: [
|
|
15145
15111
|
AppLogger,
|
|
15146
15112
|
TRACE_LOGGER,
|
|
15147
|
-
RequestContextService,
|
|
15148
15113
|
LoggerContextMiddleware
|
|
15149
15114
|
]
|
|
15150
15115
|
})
|