WebStorm和Winston日志记录问题

时间:2016-01-17 04:06:28

标签: webstorm winston

一旦我使用Winston,我就会丢失所有WebStorm控制台日志 即:

winston.log('test') // this is never logged to the webstorm console
console.log('test') // this is logged to the webstorm console

有没有办法在WebStorm控制台中显示Winston日志?

2 个答案:

答案 0 :(得分:1)

winston.log('test'); // doesn't works

但是

winston.log('<log level>','test'); // works

或者

wiston.<log level ie:error, warn, info, verbose, debug, silly>('test');

我的问题是,没有&#34; log&#34;等级,但有一个命令&#34; log&#34;期望一个日志级别......

答案 1 :(得分:0)

对我来说很好:

var winston = require('winston');

console.log(' console test');
winston.log('info', 'Hello winston log!');
winston.info('Hello winston info!');

winston.level = 'debug';
winston.log('debug', 'Now my winston debug messages are written to console!');

enter image description here

如果它不适合你,你必须做一些非常特别的事情