温斯顿记录器未在新行上打印
Winston logger not being printed on new line
这是我的温斯顿记录器 -
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
这是我的温斯顿记录器 -
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