Compare commits
2 Commits
@egg/logge
...
@egg/logge
Author | SHA1 | Date | |
---|---|---|---|
a1f9b5048a | |||
329087504d |
6
package-lock.json
generated
6
package-lock.json
generated
@ -12263,7 +12263,7 @@
|
||||
},
|
||||
"packages/logger": {
|
||||
"name": "@egg/logger",
|
||||
"version": "1.4.0",
|
||||
"version": "1.4.1",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"winston": "*",
|
||||
@ -12272,10 +12272,10 @@
|
||||
},
|
||||
"packages/net-tool": {
|
||||
"name": "@egg/net-tool",
|
||||
"version": "1.6.1",
|
||||
"version": "1.6.2",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@egg/logger": "^1.4.0",
|
||||
"@egg/logger": "^1.4.1",
|
||||
"winston": "*"
|
||||
}
|
||||
},
|
||||
|
@ -3,6 +3,12 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [1.4.1](http://yingbo.im:3000/zhaoyingbo/egg_tools/compare/@egg/logger@1.4.0...@egg/logger@1.4.1) (2024-09-23)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- **logger:** 修复正式环境下也输出彩色日志的问题 ([3290875](http://yingbo.im:3000/zhaoyingbo/egg_tools/commits/329087504de42b31adb35998b911fa509e1d8fd9))
|
||||
|
||||
# 1.4.0 (2024-09-23)
|
||||
|
||||
### Bug Fixes
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@egg/logger",
|
||||
"version": "1.4.0",
|
||||
"version": "1.4.1",
|
||||
"description": "Logger for Egg projects",
|
||||
"type": "module",
|
||||
"main": "src/index.ts",
|
||||
|
@ -37,21 +37,25 @@ if (isProd) {
|
||||
)
|
||||
}
|
||||
|
||||
const formatList = [
|
||||
format.simple(), // 简单文本格式化
|
||||
format.timestamp({ format: "YYYY-MM-DD HH:mm:ss" }),
|
||||
format.printf(({ level, message, timestamp, requestId }) => {
|
||||
const singleLineMessage = isProd
|
||||
? message.replace(/\n/g, " ") // 将换行符替换为空格
|
||||
: message
|
||||
return `${timestamp} [${level}]${requestId ? ` [RequestId: ${requestId}]` : ""}: ${singleLineMessage}`
|
||||
}),
|
||||
]
|
||||
|
||||
// 开发环境下输出彩色日志
|
||||
if (!isProd) {
|
||||
formatList.push(format.colorize())
|
||||
}
|
||||
|
||||
const logger = winston.createLogger({
|
||||
level: "silly",
|
||||
format: format.combine(
|
||||
format.colorize({
|
||||
level: !isProd,
|
||||
}), // 开发环境下输出彩色日志
|
||||
format.simple(), // 简单文本格式化
|
||||
format.timestamp({ format: "YYYY-MM-DD HH:mm:ss" }),
|
||||
format.printf(({ level, message, timestamp, requestId }) => {
|
||||
const singleLineMessage = isProd
|
||||
? message.replace(/\n/g, " ") // 将换行符替换为空格
|
||||
: message
|
||||
return `${timestamp} [${level}]${requestId ? ` [RequestId: ${requestId}]` : ""}: ${singleLineMessage}`
|
||||
})
|
||||
),
|
||||
format: format.combine.apply(null, formatList),
|
||||
transports,
|
||||
})
|
||||
|
||||
|
@ -3,6 +3,10 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [1.6.2](http://yingbo.im:3000/zhaoyingbo/egg_tools/compare/@egg/net-tool@1.6.1...@egg/net-tool@1.6.2) (2024-09-23)
|
||||
|
||||
**Note:** Version bump only for package @egg/net-tool
|
||||
|
||||
## [1.6.1](http://yingbo.im:3000/zhaoyingbo/egg_tools/compare/@egg/net-tool@1.6.0...@egg/net-tool@1.6.1) (2024-09-23)
|
||||
|
||||
**Note:** Version bump only for package @egg/net-tool
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@egg/net-tool",
|
||||
"version": "1.6.1",
|
||||
"version": "1.6.2",
|
||||
"description": "Net Tools for Egg projects",
|
||||
"type": "module",
|
||||
"main": "src/index.ts",
|
||||
@ -17,7 +17,7 @@
|
||||
"author": "RainSun <zhaoyingbo@live.cn>",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@egg/logger": "^1.4.0",
|
||||
"@egg/logger": "^1.4.1",
|
||||
"winston": "*"
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user