我在輸出中看到如下所示的空白行 我正在使用摩根和溫斯頓結合在這裏登錄到文件 如何避免這些空行?如何從摩根記錄器中刪除日誌文件中正在生成的空行?
//logger
const logger = new winston.Logger({
transports: [
new winston.transports.File({
filename: './logs/dca_ui.log',
handleExceptions: true,
json: false,
maxsize: MAX_SIZE_LOG,
maxFiles: MAX_LOG_FILES,
colorize: false,
}),
],
exitOnError: false,
});
//writestream
const stream = {
write: (message, encoding) => {
logger.info(message);
},
};
app.use((morgan(':date :status :method :url :response-time', { stream: stream })));
輸出:
5 2016-11-15T04:21:18.981Z - 信息:週二,2016年11月15日4時21分十八秒GMT 200 GET /index.js 4.539
7 2016-11-15T04:21:19.786Z - info:Tue,2016年11月15日04:21:19 GMT 200 GET/urest/v1/template?start = 0 & count = 20 & sort = templateName:asc 106.379
9 2016-11-15T04:21:22.835Z - 信息:Tue,2016年11月15日04:21 ?:22 GMT 200 GET/urest/V1 /模板/ 7b4ca205-7b75-459c-81f1-a61fc8b6be69視圖=凝結122.692