var logger = winston.createLogger({
format: combine(
label({ label: 'abc' }),
prettyPrint()
),
transports: [ new winston.transports.Console() ]
});
exports.logger = logger;
如果不是标签:“ abc”,我想传递“ pqr”,“ xyz”,怎么办?
答案 0 :(得分:0)
您可以通过将动态值分配给如下所示的变量来实现:
var dynamicValue = "abc"; // value can change
var logger = winston.createLogger({
format: combine(
label({ label: dynamicValue }),
prettyPrint()
),
transports: [ new winston.transports.Console() ]
});
exports.logger = logger;