gpt4 book ai didi

javascript - winston 记录器未在新行上打印

转载 作者:搜寻专家 更新时间:2023-10-31 23:59:49 26 4
gpt4 key购买 nike

这是我的 winston 记录器 -

var winston = require('winston')

var logger = new (winston.Logger)({
transports: [
new (winston.transports.File)({
// log which takes care of all the MAS scoring - node clusters and servers
filename: './test.log',
level: 'info',
json: true,
eol: 'rn'
})
]
})

当我运行实际的记录器时:

logger.info('hi', 'it meeeeee')
logger.info('hi', 'it youuuuuu')

它在 test.log 文件中打印出来是这样的 -

{"level":"info","message":"hi it meeeeee","timestamp":"2016-08-18T08:42:01.768Z"}rn{"level":"info","message":"hi it youuuuuu","timestamp":"2016-08-18T08:42:01.770Z"}rn

我希望它是这样的:

{"level":"info","message":"hi it meeeeee","timestamp":"2016-08-18T08:42:01.768Z"}
{"level":"info","message":"hi it youuuuuu","timestamp":"2016-08-18T08:42:01.770Z"}

这怎么可能?我读过这个问题Node.js winston logger; How to start from a newline when insert log into log file? - 但是它并没有解决我的问题。

即如果我在 Notepad++、命令行或 Sublime 文本中打开,我仍然会遇到同样的问题。

最佳答案

试试这个 eol:\r\n

official documentation

关于javascript - winston 记录器未在新行上打印,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39013673/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com