【发布时间】:2023-03-13 02:47:01
【问题描述】:
我需要为每种传输使用不同类型的格式化程序。
例子:
logger = new (winston.Logger)({
transports: [
new (winston.transports.LogstashUDP)({
// some config here. Do noting on formatting
}),
new (winston.transports.Mail)({
// do formatting one way
}),
new (winston.transports.File)({
// write to file as json (maybe format it here)
}),
new (winston.transports.Console)({
// do another formatting
})
]
});
从winston transports docs 可以看出,只有控制台支持自定义格式化程序。
我正在使用winston-mailer 邮件模块和winston-logstash-upd
Winston 有什么方法可以解决这个问题吗?或者也许如何围绕这些模块之一创建包装器以支持格式化?
【问题讨论】:
-
我刚刚在他们的 github 上打开了 issue:github.com/winstonjs/winston/issues/1567
标签: javascript node.js logging formatting winston