@lark-apaas/nestjs-logger 1.0.2-alpha.38 → 1.0.2-alpha.39
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 +34 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +34 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -9241,6 +9241,7 @@ var BasePinoLogger = class _BasePinoLogger {
|
|
|
9241
9241
|
const { context, stack, extras } = this.extractOptionalParams(optionalParams, treatStack);
|
|
9242
9242
|
const requestState = this.contextStore.getContext();
|
|
9243
9243
|
const traceId = requestState?.requestId ?? null;
|
|
9244
|
+
const firstParam = optionalParams[0];
|
|
9244
9245
|
const flatObject = /* @__PURE__ */ __name((extra) => {
|
|
9245
9246
|
let res = {};
|
|
9246
9247
|
try {
|
|
@@ -9285,8 +9286,10 @@ var BasePinoLogger = class _BasePinoLogger {
|
|
|
9285
9286
|
}
|
|
9286
9287
|
const pinoLevel = mapLogLevelToPino(level);
|
|
9287
9288
|
const sanitizedPayload = sanitizeValue(payload);
|
|
9289
|
+
const isTriggerLog = firstParam?.module === "trigger";
|
|
9290
|
+
const platformModule = isTriggerLog ? "trigger" : firstParam?.paas_attributes_module;
|
|
9288
9291
|
if (process.env.NODE_ENV === "development") {
|
|
9289
|
-
if (
|
|
9292
|
+
if (platformModule) {
|
|
9290
9293
|
return;
|
|
9291
9294
|
}
|
|
9292
9295
|
if (messageText) {
|
|
@@ -9296,12 +9299,37 @@ var BasePinoLogger = class _BasePinoLogger {
|
|
|
9296
9299
|
}
|
|
9297
9300
|
} else {
|
|
9298
9301
|
let finalMessage = messageText;
|
|
9299
|
-
if (
|
|
9300
|
-
|
|
9302
|
+
if (platformModule) {
|
|
9303
|
+
if (typeof message !== "string") {
|
|
9304
|
+
finalMessage = safeStringify(message);
|
|
9305
|
+
}
|
|
9306
|
+
this.observableService.log(level, finalMessage ?? "", {
|
|
9307
|
+
...payload,
|
|
9308
|
+
module: platformModule
|
|
9309
|
+
});
|
|
9310
|
+
} else {
|
|
9311
|
+
const reportMessage = this.processLogParams([
|
|
9312
|
+
message,
|
|
9313
|
+
...optionalParams
|
|
9314
|
+
]);
|
|
9315
|
+
this.observableService.log(level, reportMessage, {});
|
|
9301
9316
|
}
|
|
9302
|
-
this.observableService.log(level, finalMessage ?? "", payload);
|
|
9303
9317
|
}
|
|
9304
9318
|
}
|
|
9319
|
+
processLogParams(args) {
|
|
9320
|
+
if (args.length === 1) {
|
|
9321
|
+
const firstParam = args[0];
|
|
9322
|
+
if (typeof firstParam !== "string") {
|
|
9323
|
+
return safeStringify(firstParam);
|
|
9324
|
+
}
|
|
9325
|
+
return firstParam;
|
|
9326
|
+
}
|
|
9327
|
+
const obj = {};
|
|
9328
|
+
for (let i = 0; i < args.length; i++) {
|
|
9329
|
+
obj[i.toString()] = args[i];
|
|
9330
|
+
}
|
|
9331
|
+
return safeStringify(obj);
|
|
9332
|
+
}
|
|
9305
9333
|
extractOptionalParams(optionalParams, treatStack) {
|
|
9306
9334
|
const params = [
|
|
9307
9335
|
...optionalParams
|
|
@@ -9584,6 +9612,7 @@ url=${req.url}`, "HTTPTraceInterceptor");
|
|
|
9584
9612
|
const reportData = JSON.stringify(responseData);
|
|
9585
9613
|
if (!isDev) {
|
|
9586
9614
|
this.appLogger.log(reportData, {
|
|
9615
|
+
paas_attributes_module: "app_server",
|
|
9587
9616
|
source_type: "platform"
|
|
9588
9617
|
}, "HTTPTraceInterceptor");
|
|
9589
9618
|
}
|
|
@@ -9619,6 +9648,7 @@ duration_ms=${durationMs}`, "HTTPTraceInterceptor");
|
|
|
9619
9648
|
});
|
|
9620
9649
|
return next.handle().pipe((0, import_operators.catchError)((error) => {
|
|
9621
9650
|
this.appLogger.error((0, import_util.format)("HTTP request exception\nmethod=%s url=%s\nerror=%o", req.method, req.url, error), {
|
|
9651
|
+
paas_attributes_module: "app_server",
|
|
9622
9652
|
source_type: "platform"
|
|
9623
9653
|
}, "HTTPTraceInterceptor");
|
|
9624
9654
|
throw error;
|