Winston 记录器 cli 方法不起作用
Winston logger cli method is not working
我正在我的记录器实例上尝试使用 CLI 方法进行漂亮的打印,但它似乎不起作用。
var logger = new winston.Logger({
transports: [
new winston.transports.File({
level: info
filename: 'filename',
json: true,
name: 'all-log-file',
colorize: true,
prettyPrint: true
})
]
});
logger.cli();
但这不适用于 me.Expected 输出格式如下:
info: Found existing dependencies
data: {
data: colors: '0.x.x',
data: eyes: '0.1.x',
data: findit: '0.0.x',
data: npm: '1.0.x',
data: optimist: '0.2.x',
data: semver: '1.0.x',
data: winston: '0.2.x'
data: }
info: Analyzing dependencies...
info: Done analyzing raw dependencies
info: Retrieved packages from npm
warn: No additional dependencies found
我想要漂亮的彩色输出,有什么帮助吗?
您尝试过控制台传输吗?
var winston = require('winston');
var logger = new winston.Logger({
transports: [
new winston.transports.File({
level: 'debug',
filename: 'prettylog.txt',
handleExceptions: true,
json: false,
colorize: true,
timestamp: true,
prettyPrint: true
})
],
exitOnError: false
});
现在,您必须使用标准的 Unix 实用程序显示内容:
猫prettylog.txt
我正在我的记录器实例上尝试使用 CLI 方法进行漂亮的打印,但它似乎不起作用。
var logger = new winston.Logger({
transports: [
new winston.transports.File({
level: info
filename: 'filename',
json: true,
name: 'all-log-file',
colorize: true,
prettyPrint: true
})
]
});
logger.cli();
但这不适用于 me.Expected 输出格式如下:
info: Found existing dependencies
data: {
data: colors: '0.x.x',
data: eyes: '0.1.x',
data: findit: '0.0.x',
data: npm: '1.0.x',
data: optimist: '0.2.x',
data: semver: '1.0.x',
data: winston: '0.2.x'
data: }
info: Analyzing dependencies...
info: Done analyzing raw dependencies
info: Retrieved packages from npm
warn: No additional dependencies found
我想要漂亮的彩色输出,有什么帮助吗?
您尝试过控制台传输吗?
var winston = require('winston');
var logger = new winston.Logger({
transports: [
new winston.transports.File({
level: 'debug',
filename: 'prettylog.txt',
handleExceptions: true,
json: false,
colorize: true,
timestamp: true,
prettyPrint: true
})
],
exitOnError: false
});
现在,您必须使用标准的 Unix 实用程序显示内容: 猫prettylog.txt