@lark-apaas/nestjs-logger 1.0.1-alpha.2 → 1.0.1-alpha.3
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/README.md +2 -2
- package/dist/index.cjs +14 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +14 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -125,7 +125,7 @@ export class MyService {
|
|
|
125
125
|
|------|----------------|-------------------|
|
|
126
126
|
| **用途** | 常规日志,兼容 NestJS 官方 | 结构化日志,将 meta 合并到字段 |
|
|
127
127
|
| **Context** | 最后一个参数自动识别 | 显式传递第4个参数 |
|
|
128
|
-
| **消息格式** |
|
|
128
|
+
| **消息格式** | 使用模板字符串拼接 | 纯文本消息 |
|
|
129
129
|
| **元数据** | 需要手动拼接到消息中 | 作为独立字段存储,便于查询 |
|
|
130
130
|
| **使用场景** | 日常日志、错误日志 | 需要结构化查询的业务日志 |
|
|
131
131
|
|
|
@@ -315,7 +315,7 @@ NestJS LoggerService 级别到 Pino 级别的映射:
|
|
|
315
315
|
|
|
316
316
|
日志会写入以下文件(默认在 `logs/` 目录):
|
|
317
317
|
|
|
318
|
-
- `
|
|
318
|
+
- `server.log` - 应用日志
|
|
319
319
|
- `trace.log` - HTTP 请求追踪日志
|
|
320
320
|
|
|
321
321
|
## 注意事项
|
package/dist/index.cjs
CHANGED
|
@@ -14382,6 +14382,7 @@ module.exports = __toCommonJS(index_exports);
|
|
|
14382
14382
|
|
|
14383
14383
|
// src/service/app-logger.service.ts
|
|
14384
14384
|
var import_common2 = require("@nestjs/common");
|
|
14385
|
+
var import_util = require("util");
|
|
14385
14386
|
|
|
14386
14387
|
// src/helper/constants.ts
|
|
14387
14388
|
var PINO_ROOT_LOGGER = Symbol("PINO_ROOT_LOGGER");
|
|
@@ -14679,7 +14680,7 @@ var BasePinoLogger = class _BasePinoLogger {
|
|
|
14679
14680
|
}
|
|
14680
14681
|
const allMessages = [
|
|
14681
14682
|
message,
|
|
14682
|
-
...extras.map((e) =>
|
|
14683
|
+
...extras.map((e) => stringifyParam(e))
|
|
14683
14684
|
].join(" ");
|
|
14684
14685
|
return {
|
|
14685
14686
|
messageText: allMessages
|
|
@@ -14742,6 +14743,18 @@ function mapLogLevelToPino(level) {
|
|
|
14742
14743
|
}
|
|
14743
14744
|
}
|
|
14744
14745
|
__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");
|
|
14745
14758
|
function sanitizeValue(value) {
|
|
14746
14759
|
if (value === null || value === void 0) {
|
|
14747
14760
|
return value;
|