@lark-apaas/nestjs-logger 1.0.2-alpha.1 → 1.0.2-alpha.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/index.cjs +81 -109
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -19
- package/dist/index.d.ts +3 -19
- package/dist/index.js +69 -98
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,30 +1,14 @@
|
|
|
1
1
|
import { LoggerService, LogLevel, NestMiddleware } from '@nestjs/common';
|
|
2
2
|
import { Logger } from 'pino';
|
|
3
|
+
import { RequestContextService } from '@lark-apaas/nestjs-common';
|
|
4
|
+
export { RequestContextService } from '@lark-apaas/nestjs-common';
|
|
3
5
|
import { Request, Response, NextFunction } from 'express';
|
|
4
6
|
|
|
5
|
-
interface RequestContextState {
|
|
6
|
-
requestId: string;
|
|
7
|
-
path?: string;
|
|
8
|
-
method?: string;
|
|
9
|
-
userId?: string;
|
|
10
|
-
appId?: string;
|
|
11
|
-
tenantId?: string;
|
|
12
|
-
ip?: string;
|
|
13
|
-
[key: string]: unknown;
|
|
14
|
-
}
|
|
15
|
-
declare class RequestContextService {
|
|
16
|
-
private readonly storage;
|
|
17
|
-
run<T>(context: RequestContextState, callback: () => T): T;
|
|
18
|
-
setContext(partial: Partial<RequestContextState>): void;
|
|
19
|
-
getContext(): RequestContextState | undefined;
|
|
20
|
-
get<K extends keyof RequestContextState>(key: K): RequestContextState[K] | undefined;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
7
|
declare abstract class BasePinoLogger implements LoggerService {
|
|
24
8
|
protected readonly logger: Logger;
|
|
25
9
|
protected readonly contextStore: RequestContextService;
|
|
26
10
|
private readonly levelState;
|
|
27
|
-
private readonly
|
|
11
|
+
private readonly observableService;
|
|
28
12
|
constructor(logger: Logger, contextStore: RequestContextService);
|
|
29
13
|
setLogLevels(levels: LogLevel[]): void;
|
|
30
14
|
log(message: unknown, ...optionalParams: unknown[]): void;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,30 +1,14 @@
|
|
|
1
1
|
import { LoggerService, LogLevel, NestMiddleware } from '@nestjs/common';
|
|
2
2
|
import { Logger } from 'pino';
|
|
3
|
+
import { RequestContextService } from '@lark-apaas/nestjs-common';
|
|
4
|
+
export { RequestContextService } from '@lark-apaas/nestjs-common';
|
|
3
5
|
import { Request, Response, NextFunction } from 'express';
|
|
4
6
|
|
|
5
|
-
interface RequestContextState {
|
|
6
|
-
requestId: string;
|
|
7
|
-
path?: string;
|
|
8
|
-
method?: string;
|
|
9
|
-
userId?: string;
|
|
10
|
-
appId?: string;
|
|
11
|
-
tenantId?: string;
|
|
12
|
-
ip?: string;
|
|
13
|
-
[key: string]: unknown;
|
|
14
|
-
}
|
|
15
|
-
declare class RequestContextService {
|
|
16
|
-
private readonly storage;
|
|
17
|
-
run<T>(context: RequestContextState, callback: () => T): T;
|
|
18
|
-
setContext(partial: Partial<RequestContextState>): void;
|
|
19
|
-
getContext(): RequestContextState | undefined;
|
|
20
|
-
get<K extends keyof RequestContextState>(key: K): RequestContextState[K] | undefined;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
7
|
declare abstract class BasePinoLogger implements LoggerService {
|
|
24
8
|
protected readonly logger: Logger;
|
|
25
9
|
protected readonly contextStore: RequestContextService;
|
|
26
10
|
private readonly levelState;
|
|
27
|
-
private readonly
|
|
11
|
+
private readonly observableService;
|
|
28
12
|
constructor(logger: Logger, contextStore: RequestContextService);
|
|
29
13
|
setLogLevels(levels: LogLevel[]): void;
|
|
30
14
|
log(message: unknown, ...optionalParams: unknown[]): void;
|
package/dist/index.js
CHANGED
|
@@ -452,7 +452,7 @@ var require_config_constants = __commonJS({
|
|
|
452
452
|
value: true
|
|
453
453
|
});
|
|
454
454
|
exports.AS_PROVIDER_METHOD_KEY = exports.VALIDATED_ENV_PROPNAME = exports.PARTIAL_CONFIGURATION_PROPNAME = exports.PARTIAL_CONFIGURATION_KEY = exports.VALIDATED_ENV_LOADER = exports.CONFIGURATION_LOADER = exports.CONFIGURATION_TOKEN = exports.CONFIGURATION_SERVICE_TOKEN = void 0;
|
|
455
|
-
exports.CONFIGURATION_SERVICE_TOKEN =
|
|
455
|
+
exports.CONFIGURATION_SERVICE_TOKEN = Symbol("CONFIG_SERVICE");
|
|
456
456
|
exports.CONFIGURATION_TOKEN = "CONFIGURATION_TOKEN";
|
|
457
457
|
exports.CONFIGURATION_LOADER = "CONFIGURATION_LOADER";
|
|
458
458
|
exports.VALIDATED_ENV_LOADER = "VALIDATED_ENV_LOADER";
|
|
@@ -14370,17 +14370,16 @@ var require_operators = __commonJS({
|
|
|
14370
14370
|
});
|
|
14371
14371
|
|
|
14372
14372
|
// src/service/app-logger.service.ts
|
|
14373
|
-
import { Inject, Injectable
|
|
14374
|
-
import {
|
|
14375
|
-
import { AppOTelLoggerSDK } from "@lark-apaas/observable";
|
|
14373
|
+
import { Inject, Injectable, Logger } from "@nestjs/common";
|
|
14374
|
+
import { ObservableService } from "@lark-apaas/nestjs-observable";
|
|
14376
14375
|
|
|
14377
14376
|
// src/helper/constants.ts
|
|
14378
|
-
var PINO_ROOT_LOGGER =
|
|
14379
|
-
var TRACE_LOGGER =
|
|
14377
|
+
var PINO_ROOT_LOGGER = Symbol("PINO_ROOT_LOGGER");
|
|
14378
|
+
var TRACE_LOGGER = Symbol("TRACE_LOGGER");
|
|
14379
|
+
var METRICS_LOGGER = Symbol("METRICS_LOGGER");
|
|
14380
14380
|
|
|
14381
|
-
// src/service/
|
|
14382
|
-
import {
|
|
14383
|
-
import { AsyncLocalStorage } from "async_hooks";
|
|
14381
|
+
// src/service/app-logger.service.ts
|
|
14382
|
+
import { RequestContextService } from "@lark-apaas/nestjs-common";
|
|
14384
14383
|
function _ts_decorate(decorators, target, key, desc) {
|
|
14385
14384
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
14386
14385
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -14388,43 +14387,6 @@ function _ts_decorate(decorators, target, key, desc) {
|
|
|
14388
14387
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
14389
14388
|
}
|
|
14390
14389
|
__name(_ts_decorate, "_ts_decorate");
|
|
14391
|
-
var RequestContextService = class {
|
|
14392
|
-
static {
|
|
14393
|
-
__name(this, "RequestContextService");
|
|
14394
|
-
}
|
|
14395
|
-
storage = new AsyncLocalStorage();
|
|
14396
|
-
run(context, callback) {
|
|
14397
|
-
const store = {
|
|
14398
|
-
...context
|
|
14399
|
-
};
|
|
14400
|
-
return this.storage.run(store, callback);
|
|
14401
|
-
}
|
|
14402
|
-
setContext(partial) {
|
|
14403
|
-
const store = this.storage.getStore();
|
|
14404
|
-
if (!store) {
|
|
14405
|
-
return;
|
|
14406
|
-
}
|
|
14407
|
-
Object.assign(store, partial);
|
|
14408
|
-
}
|
|
14409
|
-
getContext() {
|
|
14410
|
-
return this.storage.getStore();
|
|
14411
|
-
}
|
|
14412
|
-
get(key) {
|
|
14413
|
-
return this.storage.getStore()?.[key];
|
|
14414
|
-
}
|
|
14415
|
-
};
|
|
14416
|
-
RequestContextService = _ts_decorate([
|
|
14417
|
-
Injectable()
|
|
14418
|
-
], RequestContextService);
|
|
14419
|
-
|
|
14420
|
-
// src/service/app-logger.service.ts
|
|
14421
|
-
function _ts_decorate2(decorators, target, key, desc) {
|
|
14422
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
14423
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
14424
|
-
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;
|
|
14425
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
14426
|
-
}
|
|
14427
|
-
__name(_ts_decorate2, "_ts_decorate");
|
|
14428
14390
|
function _ts_metadata(k, v) {
|
|
14429
14391
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
14430
14392
|
}
|
|
@@ -14533,13 +14495,12 @@ var BasePinoLogger = class _BasePinoLogger {
|
|
|
14533
14495
|
logger;
|
|
14534
14496
|
contextStore;
|
|
14535
14497
|
levelState = new LogLevelState();
|
|
14536
|
-
|
|
14498
|
+
observableService = new ObservableService();
|
|
14537
14499
|
constructor(logger, contextStore) {
|
|
14538
14500
|
this.logger = logger;
|
|
14539
14501
|
this.contextStore = contextStore;
|
|
14540
14502
|
const pinoLevel = this.logger.level;
|
|
14541
14503
|
const nestLevels = LogLevelState.fromPinoLevel(pinoLevel);
|
|
14542
|
-
this.otelLogger.start();
|
|
14543
14504
|
this.levelState.set(nestLevels);
|
|
14544
14505
|
}
|
|
14545
14506
|
setLogLevels(levels) {
|
|
@@ -14601,6 +14562,26 @@ var BasePinoLogger = class _BasePinoLogger {
|
|
|
14601
14562
|
const { context, stack, extras } = this.extractOptionalParams(optionalParams, treatStack);
|
|
14602
14563
|
const requestState = this.contextStore.getContext();
|
|
14603
14564
|
const traceId = requestState?.requestId ?? null;
|
|
14565
|
+
const flatObject = /* @__PURE__ */ __name((extra) => {
|
|
14566
|
+
let res = {};
|
|
14567
|
+
try {
|
|
14568
|
+
extra.forEach((item) => {
|
|
14569
|
+
if (typeof item === "object" && item !== null) {
|
|
14570
|
+
res = {
|
|
14571
|
+
...res,
|
|
14572
|
+
...item
|
|
14573
|
+
};
|
|
14574
|
+
}
|
|
14575
|
+
});
|
|
14576
|
+
delete res.message;
|
|
14577
|
+
delete res.level;
|
|
14578
|
+
delete res.time;
|
|
14579
|
+
delete res.context;
|
|
14580
|
+
return res;
|
|
14581
|
+
} catch {
|
|
14582
|
+
}
|
|
14583
|
+
}, "flatObject");
|
|
14584
|
+
const processedExtra = flatObject(extras);
|
|
14604
14585
|
const payload = {
|
|
14605
14586
|
trace_id: traceId,
|
|
14606
14587
|
path: requestState?.path,
|
|
@@ -14608,12 +14589,13 @@ var BasePinoLogger = class _BasePinoLogger {
|
|
|
14608
14589
|
user_id: requestState?.userId ?? null,
|
|
14609
14590
|
app_id: requestState?.appId ?? null,
|
|
14610
14591
|
tenant_id: requestState?.tenantId ?? null,
|
|
14611
|
-
pid: process.pid
|
|
14592
|
+
pid: process.pid,
|
|
14593
|
+
...processedExtra
|
|
14612
14594
|
};
|
|
14613
14595
|
if (context) {
|
|
14614
14596
|
payload.context = context;
|
|
14615
14597
|
}
|
|
14616
|
-
const { messageText, stack: computedStack, data } = this.buildMessagePayload(message
|
|
14598
|
+
const { messageText, stack: computedStack, data } = this.buildMessagePayload(message);
|
|
14617
14599
|
if (stack) {
|
|
14618
14600
|
payload.stack = stack;
|
|
14619
14601
|
} else if (computedStack) {
|
|
@@ -14624,12 +14606,15 @@ var BasePinoLogger = class _BasePinoLogger {
|
|
|
14624
14606
|
}
|
|
14625
14607
|
const pinoLevel = mapLogLevelToPino(level);
|
|
14626
14608
|
const sanitizedPayload = sanitizeValue(payload);
|
|
14627
|
-
if (
|
|
14628
|
-
|
|
14609
|
+
if (process.env.NODE_ENV === "development") {
|
|
14610
|
+
if (messageText) {
|
|
14611
|
+
this.logger[pinoLevel](sanitizedPayload, messageText);
|
|
14612
|
+
} else {
|
|
14613
|
+
this.logger[pinoLevel](sanitizedPayload);
|
|
14614
|
+
}
|
|
14629
14615
|
} else {
|
|
14630
|
-
this.
|
|
14616
|
+
this.observableService.log(level, messageText ?? "", payload);
|
|
14631
14617
|
}
|
|
14632
|
-
this.otelLogger.log(level, messageText ?? "");
|
|
14633
14618
|
}
|
|
14634
14619
|
extractOptionalParams(optionalParams, treatStack) {
|
|
14635
14620
|
const params = [
|
|
@@ -14657,7 +14642,7 @@ var BasePinoLogger = class _BasePinoLogger {
|
|
|
14657
14642
|
extras: params
|
|
14658
14643
|
};
|
|
14659
14644
|
}
|
|
14660
|
-
buildMessagePayload(message
|
|
14645
|
+
buildMessagePayload(message) {
|
|
14661
14646
|
if (message instanceof Error) {
|
|
14662
14647
|
return {
|
|
14663
14648
|
messageText: message.message,
|
|
@@ -14665,17 +14650,8 @@ var BasePinoLogger = class _BasePinoLogger {
|
|
|
14665
14650
|
};
|
|
14666
14651
|
}
|
|
14667
14652
|
if (typeof message === "string") {
|
|
14668
|
-
if (extras.length === 0) {
|
|
14669
|
-
return {
|
|
14670
|
-
messageText: message
|
|
14671
|
-
};
|
|
14672
|
-
}
|
|
14673
|
-
const allMessages = [
|
|
14674
|
-
message,
|
|
14675
|
-
...extras.map((e) => stringifyParam(e))
|
|
14676
|
-
].join(" ");
|
|
14677
14653
|
return {
|
|
14678
|
-
messageText:
|
|
14654
|
+
messageText: message
|
|
14679
14655
|
};
|
|
14680
14656
|
}
|
|
14681
14657
|
if (typeof message === "object" && message !== null) {
|
|
@@ -14703,8 +14679,8 @@ var AppLogger = class extends BasePinoLogger {
|
|
|
14703
14679
|
Logger.overrideLogger(this);
|
|
14704
14680
|
}
|
|
14705
14681
|
};
|
|
14706
|
-
AppLogger =
|
|
14707
|
-
|
|
14682
|
+
AppLogger = _ts_decorate([
|
|
14683
|
+
Injectable(),
|
|
14708
14684
|
_ts_param(0, Inject(PINO_ROOT_LOGGER)),
|
|
14709
14685
|
_ts_metadata("design:type", Function),
|
|
14710
14686
|
_ts_metadata("design:paramtypes", [
|
|
@@ -14735,18 +14711,6 @@ function mapLogLevelToPino(level) {
|
|
|
14735
14711
|
}
|
|
14736
14712
|
}
|
|
14737
14713
|
__name(mapLogLevelToPino, "mapLogLevelToPino");
|
|
14738
|
-
function stringifyParam(param) {
|
|
14739
|
-
if (typeof param === "string") {
|
|
14740
|
-
return param;
|
|
14741
|
-
}
|
|
14742
|
-
const inspectOptions = {
|
|
14743
|
-
depth: 4,
|
|
14744
|
-
colors: false,
|
|
14745
|
-
compact: true
|
|
14746
|
-
};
|
|
14747
|
-
return inspect(param, inspectOptions);
|
|
14748
|
-
}
|
|
14749
|
-
__name(stringifyParam, "stringifyParam");
|
|
14750
14714
|
function sanitizeValue(value) {
|
|
14751
14715
|
if (value === null || value === void 0) {
|
|
14752
14716
|
return value;
|
|
@@ -14772,6 +14736,7 @@ __name(sanitizeValue, "sanitizeValue");
|
|
|
14772
14736
|
var import_config3 = __toESM(require_config2(), 1);
|
|
14773
14737
|
import { Global, Module } from "@nestjs/common";
|
|
14774
14738
|
import { APP_INTERCEPTOR } from "@nestjs/core";
|
|
14739
|
+
import { CommonModule, RequestContextService as RequestContextService4 } from "@lark-apaas/nestjs-common";
|
|
14775
14740
|
|
|
14776
14741
|
// src/config/logger.config.ts
|
|
14777
14742
|
var import_config = __toESM(require_config2(), 1);
|
|
@@ -14807,15 +14772,16 @@ var logger_config_default = (0, import_config.registerAs)("logger", () => {
|
|
|
14807
14772
|
// src/interceptor/logging.interceptor.ts
|
|
14808
14773
|
var import_config2 = __toESM(require_config2(), 1);
|
|
14809
14774
|
var import_operators = __toESM(require_operators(), 1);
|
|
14810
|
-
import { Inject as Inject2, Injectable as
|
|
14775
|
+
import { Inject as Inject2, Injectable as Injectable2 } from "@nestjs/common";
|
|
14811
14776
|
import { format } from "util";
|
|
14812
|
-
|
|
14777
|
+
import { RequestContextService as RequestContextService2 } from "@lark-apaas/nestjs-common";
|
|
14778
|
+
function _ts_decorate2(decorators, target, key, desc) {
|
|
14813
14779
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
14814
14780
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
14815
14781
|
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;
|
|
14816
14782
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
14817
14783
|
}
|
|
14818
|
-
__name(
|
|
14784
|
+
__name(_ts_decorate2, "_ts_decorate");
|
|
14819
14785
|
function _ts_metadata2(k, v) {
|
|
14820
14786
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
14821
14787
|
}
|
|
@@ -14964,20 +14930,21 @@ duration_ms=${durationMs}`, "HTTPTraceInterceptor");
|
|
|
14964
14930
|
return {
|
|
14965
14931
|
_error: "Failed to serialize data",
|
|
14966
14932
|
_type: typeof data,
|
|
14933
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14967
14934
|
_constructor: data?.constructor?.name
|
|
14968
14935
|
};
|
|
14969
14936
|
}
|
|
14970
14937
|
}
|
|
14971
14938
|
};
|
|
14972
|
-
LoggingInterceptor =
|
|
14973
|
-
|
|
14939
|
+
LoggingInterceptor = _ts_decorate2([
|
|
14940
|
+
Injectable2(),
|
|
14974
14941
|
_ts_param2(0, Inject2(TRACE_LOGGER)),
|
|
14975
14942
|
_ts_param2(2, Inject2(AppLogger)),
|
|
14976
14943
|
_ts_param2(3, Inject2(logger_config_default.KEY)),
|
|
14977
14944
|
_ts_metadata2("design:type", Function),
|
|
14978
14945
|
_ts_metadata2("design:paramtypes", [
|
|
14979
14946
|
typeof PinoLoggerService === "undefined" ? Object : PinoLoggerService,
|
|
14980
|
-
typeof
|
|
14947
|
+
typeof RequestContextService2 === "undefined" ? Object : RequestContextService2,
|
|
14981
14948
|
typeof AppLogger === "undefined" ? Object : AppLogger,
|
|
14982
14949
|
typeof import_config2.ConfigType === "undefined" ? Object : import_config2.ConfigType
|
|
14983
14950
|
])
|
|
@@ -15034,15 +15001,16 @@ function createFileDestination(pathname) {
|
|
|
15034
15001
|
__name(createFileDestination, "createFileDestination");
|
|
15035
15002
|
|
|
15036
15003
|
// src/middleware/logger-context.middleware.ts
|
|
15037
|
-
import { Injectable as
|
|
15004
|
+
import { Injectable as Injectable3 } from "@nestjs/common";
|
|
15038
15005
|
import { randomUUID } from "crypto";
|
|
15039
|
-
|
|
15006
|
+
import { RequestContextService as RequestContextService3 } from "@lark-apaas/nestjs-common";
|
|
15007
|
+
function _ts_decorate3(decorators, target, key, desc) {
|
|
15040
15008
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
15041
15009
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
15042
15010
|
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;
|
|
15043
15011
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
15044
15012
|
}
|
|
15045
|
-
__name(
|
|
15013
|
+
__name(_ts_decorate3, "_ts_decorate");
|
|
15046
15014
|
function _ts_metadata3(k, v) {
|
|
15047
15015
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
15048
15016
|
}
|
|
@@ -15073,35 +15041,35 @@ var LoggerContextMiddleware = class {
|
|
|
15073
15041
|
}, () => next());
|
|
15074
15042
|
}
|
|
15075
15043
|
};
|
|
15076
|
-
LoggerContextMiddleware =
|
|
15077
|
-
|
|
15044
|
+
LoggerContextMiddleware = _ts_decorate3([
|
|
15045
|
+
Injectable3(),
|
|
15078
15046
|
_ts_metadata3("design:type", Function),
|
|
15079
15047
|
_ts_metadata3("design:paramtypes", [
|
|
15080
|
-
typeof
|
|
15048
|
+
typeof RequestContextService3 === "undefined" ? Object : RequestContextService3
|
|
15081
15049
|
])
|
|
15082
15050
|
], LoggerContextMiddleware);
|
|
15083
15051
|
|
|
15084
15052
|
// src/module.ts
|
|
15085
|
-
function
|
|
15053
|
+
function _ts_decorate4(decorators, target, key, desc) {
|
|
15086
15054
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
15087
15055
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
15088
15056
|
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;
|
|
15089
15057
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
15090
15058
|
}
|
|
15091
|
-
__name(
|
|
15059
|
+
__name(_ts_decorate4, "_ts_decorate");
|
|
15092
15060
|
var LoggerModule = class {
|
|
15093
15061
|
static {
|
|
15094
15062
|
__name(this, "LoggerModule");
|
|
15095
15063
|
}
|
|
15096
15064
|
};
|
|
15097
|
-
LoggerModule =
|
|
15065
|
+
LoggerModule = _ts_decorate4([
|
|
15098
15066
|
Global(),
|
|
15099
15067
|
Module({
|
|
15100
15068
|
imports: [
|
|
15101
|
-
import_config3.ConfigModule.forFeature(logger_config_default)
|
|
15069
|
+
import_config3.ConfigModule.forFeature(logger_config_default),
|
|
15070
|
+
CommonModule
|
|
15102
15071
|
],
|
|
15103
15072
|
providers: [
|
|
15104
|
-
RequestContextService,
|
|
15105
15073
|
LoggerContextMiddleware,
|
|
15106
15074
|
{
|
|
15107
15075
|
provide: PINO_ROOT_LOGGER,
|
|
@@ -15122,7 +15090,7 @@ LoggerModule = _ts_decorate5([
|
|
|
15122
15090
|
filePath: `${config.logDir}/trace.log`
|
|
15123
15091
|
}), requestContext), "useFactory"),
|
|
15124
15092
|
inject: [
|
|
15125
|
-
|
|
15093
|
+
RequestContextService4,
|
|
15126
15094
|
logger_config_default.KEY
|
|
15127
15095
|
]
|
|
15128
15096
|
},
|
|
@@ -15136,16 +15104,19 @@ LoggerModule = _ts_decorate5([
|
|
|
15136
15104
|
exports: [
|
|
15137
15105
|
AppLogger,
|
|
15138
15106
|
TRACE_LOGGER,
|
|
15139
|
-
RequestContextService,
|
|
15140
15107
|
LoggerContextMiddleware
|
|
15141
15108
|
]
|
|
15142
15109
|
})
|
|
15143
15110
|
], LoggerModule);
|
|
15111
|
+
|
|
15112
|
+
// src/index.ts
|
|
15113
|
+
import { RequestContextService as RequestContextService5 } from "@lark-apaas/nestjs-common";
|
|
15144
15114
|
export {
|
|
15145
15115
|
AppLogger,
|
|
15146
15116
|
LoggerContextMiddleware,
|
|
15147
15117
|
LoggerModule,
|
|
15148
15118
|
PinoLoggerService,
|
|
15119
|
+
RequestContextService5 as RequestContextService,
|
|
15149
15120
|
TRACE_LOGGER
|
|
15150
15121
|
};
|
|
15151
15122
|
//# sourceMappingURL=index.js.map
|