@lark-apaas/nestjs-logger 1.0.9-alpha.1 → 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 CHANGED
@@ -9286,11 +9286,10 @@ var BasePinoLogger = class _BasePinoLogger {
9286
9286
  }
9287
9287
  const pinoLevel = mapLogLevelToPino(level);
9288
9288
  const sanitizedPayload = sanitizeValue(payload);
9289
- const isTriggerLog = firstParam?.module === "trigger";
9290
- const platformModule = isTriggerLog ? "trigger" : firstParam?.paas_attributes_module;
9289
+ const platformModule = firstParam?.paas_attributes_module;
9291
9290
  const parentSpan = firstParam?.paas_parent_span_context;
9292
9291
  if (process.env.NODE_ENV === "development") {
9293
- if (platformModule && !isTriggerLog) {
9292
+ if (platformModule && platformModule !== "trigger") {
9294
9293
  return;
9295
9294
  }
9296
9295
  if (messageText) {
@@ -9493,6 +9492,16 @@ var import_config2 = require("@nestjs/config");
9493
9492
  var import_operators = __toESM(require_operators(), 1);
9494
9493
  var import_util = require("util");
9495
9494
  var import_nestjs_common2 = require("@lark-apaas/nestjs-common");
9495
+
9496
+ // src/utils/formatDuration.ts
9497
+ var formatDuration = /* @__PURE__ */ __name((ms) => {
9498
+ if (ms < 0.01) {
9499
+ return Number(ms.toPrecision(1));
9500
+ }
9501
+ return Number(ms.toFixed(2));
9502
+ }, "formatDuration");
9503
+
9504
+ // src/interceptor/logging.interceptor.ts
9496
9505
  function _ts_decorate2(decorators, target, key, desc) {
9497
9506
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
9498
9507
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -9588,7 +9597,7 @@ url=${req.url}`, "HTTPTraceInterceptor");
9588
9597
  const responseMeta = {
9589
9598
  ...baseMeta,
9590
9599
  status_code: statusCode,
9591
- duration_ms: durationMs
9600
+ duration_ms: formatDuration(durationMs)
9592
9601
  };
9593
9602
  const finalResponseBody = res.__finalResponseBody;
9594
9603
  const contentType = res.getHeader("content-type");
@@ -9638,7 +9647,7 @@ duration_ms=${durationMs}`, "HTTPTraceInterceptor");
9638
9647
  method,
9639
9648
  path,
9640
9649
  url: fullUrl,
9641
- duration_ms: durationMs,
9650
+ duration_ms: formatDuration(durationMs),
9642
9651
  error_message: isError ? data?.message ?? "" : ""
9643
9652
  };
9644
9653
  if (req.body) responseData.request_body = req.body;