@lark-apaas/nestjs-logger 1.0.9-alpha.0 → 1.0.9-alpha.10
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 +14 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +14 -5
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -9269,11 +9269,10 @@ var BasePinoLogger = class _BasePinoLogger {
|
|
|
9269
9269
|
}
|
|
9270
9270
|
const pinoLevel = mapLogLevelToPino(level);
|
|
9271
9271
|
const sanitizedPayload = sanitizeValue(payload);
|
|
9272
|
-
const
|
|
9273
|
-
const platformModule = isTriggerLog ? "trigger" : firstParam?.paas_attributes_module;
|
|
9272
|
+
const platformModule = firstParam?.paas_attributes_module;
|
|
9274
9273
|
const parentSpan = firstParam?.paas_parent_span_context;
|
|
9275
9274
|
if (process.env.NODE_ENV === "development") {
|
|
9276
|
-
if (platformModule &&
|
|
9275
|
+
if (platformModule && platformModule !== "trigger") {
|
|
9277
9276
|
return;
|
|
9278
9277
|
}
|
|
9279
9278
|
if (messageText) {
|
|
@@ -9476,6 +9475,16 @@ import { Inject as Inject2, Injectable as Injectable2 } from "@nestjs/common";
|
|
|
9476
9475
|
import { ConfigType } from "@nestjs/config";
|
|
9477
9476
|
import { format } from "util";
|
|
9478
9477
|
import { RequestContextService as RequestContextService2 } from "@lark-apaas/nestjs-common";
|
|
9478
|
+
|
|
9479
|
+
// src/utils/formatDuration.ts
|
|
9480
|
+
var formatDuration = /* @__PURE__ */ __name((ms) => {
|
|
9481
|
+
if (ms < 0.01) {
|
|
9482
|
+
return Number(ms.toPrecision(1));
|
|
9483
|
+
}
|
|
9484
|
+
return Number(ms.toFixed(2));
|
|
9485
|
+
}, "formatDuration");
|
|
9486
|
+
|
|
9487
|
+
// src/interceptor/logging.interceptor.ts
|
|
9479
9488
|
function _ts_decorate2(decorators, target, key, desc) {
|
|
9480
9489
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
9481
9490
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -9571,7 +9580,7 @@ url=${req.url}`, "HTTPTraceInterceptor");
|
|
|
9571
9580
|
const responseMeta = {
|
|
9572
9581
|
...baseMeta,
|
|
9573
9582
|
status_code: statusCode,
|
|
9574
|
-
duration_ms: durationMs
|
|
9583
|
+
duration_ms: formatDuration(durationMs)
|
|
9575
9584
|
};
|
|
9576
9585
|
const finalResponseBody = res.__finalResponseBody;
|
|
9577
9586
|
const contentType = res.getHeader("content-type");
|
|
@@ -9621,7 +9630,7 @@ duration_ms=${durationMs}`, "HTTPTraceInterceptor");
|
|
|
9621
9630
|
method,
|
|
9622
9631
|
path,
|
|
9623
9632
|
url: fullUrl,
|
|
9624
|
-
duration_ms: durationMs,
|
|
9633
|
+
duration_ms: formatDuration(durationMs),
|
|
9625
9634
|
error_message: isError ? data?.message ?? "" : ""
|
|
9626
9635
|
};
|
|
9627
9636
|
if (req.body) responseData.request_body = req.body;
|