midwayjs / logger Goto Github PK
View Code? Open in Web Editor NEWmidway logger
License: MIT License
midway logger
License: MIT License
This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.
These updates have all been created already. Click a checkbox below to force a retry/rebase of any.
.github/workflows/nodejs.yml
actions/checkout v4
actions/setup-node v4
codecov/codecov-action v4
package.json
dayjs ^1.10.7
safe-stable-stringify ^2.4.3
@types/jest 29
@types/node 18.14.2
benchmark ^2.1.4
cross-env 7.0.3
fs-extra 11.2.0
jest 29
mwts 1.3.0
threads 1.7.0
ts-jest 29
ts-node 10.9.2
typescript 5.3.3
node >=10
容器运行时基于标准输出 -> log driver 的日志采集方式, 由于 ansi 的格式化, 导致采集日志的 agent 解析出现预期外的结果, 当前仅支持环境变量控制, 但 k8s 等环境的配置本身对于业务方来讲, 可控性不强.
且本场景理论上来说可能会因为不同的运行环境有差异, 比如本地开发环境依然是有意义的, 所以提供显式的配置项, 可针对不同的 profile 做相应的处理.
^[[0m2022-08-01 21:57:13,543 INFO 75979 xxx^[[0m
[PARSER]
# http://rubular.com/r/tjUt3Awgg4
Name cri
Format regex
Regex ^(?<time>[^ ]+) (?<stream>stdout|stderr) (?<logtag>[^ ]*) (?<message>(.|\n)*)$
Skip_Empty_Values false
Time_Key time
Time_Format %Y-%m-%dT%H:%M:%S.%L%z
midwayLogger: {
default: {
transports: {
file: {
maxSize: '100m',
// 也可以配置数字,表示最多保留日志文件的个数。
maxFiles: '10d',
},
error: {
maxSize: '100m',
maxFiles: '10d',
},
}
},
clients: {
coreLogger: {
fileLogName: 'core.log',
},
appLogger: {
fileLogName: 'app.log',
},
// bull的日志文件名
bullLogger: {
fileLogName: 'bull.log',
},
customLogger: {
fileLogName: 'custom.log',
contextFormat: (info) => {
const ctx = info.ctx;
console.log("++++++++++++++++")
console.log(`${info.LEVEL} ${info.timestamp} ${info.message}`)
return `${info.LEVEL} ${info.timestamp} ${info.message}`;
}
},
}
},
如果 console output 设置了颜色,也会同时作用到文件中。
export interface LoggerOptions {
/**
* Output format for console and file
*/
format?: LoggerContextFormat;
}
logger.info('%s', '%Y-%m-%d')
// 应该输出
// %Y-%m-%d
// 实际输出
// %Y-%m-NaN
在@midwayjs/logger中使用util.format
对%s
部分格式化一遍,然后到了winston
里又被splat
格式化了一遍,导致日志中输出错误。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.