Test case:
var logger = require('winston');
logger.remove(logger.transports.Console);
logger.add(logger.transports.Console, {'timestamp': true, 'showLevel': false, 'level': 'debug'});
logger.info('info');
logger.debug('debug');
logger.error('error');
Output:
$ node test-winston.js 2>/dev/stdout 1>/dev/null
2015-02-22T11:37:59.072Z - debug: debug
2015-02-22T11:37:59.203Z - error: error
$ node test-winston.js 1>/dev/stdout 2>/dev/null
2015-02-22T11:40:56.820Z - info: info
Expected result (disregarding the timestamp copy/paste) would be:
$ node test-winston.js 2>/dev/stdout 1>/dev/null
2015-02-22T11:37:59.203Z - error: error
$ node test-winston.js 1>/dev/stdout 2>/dev/null
2015-02-22T11:40:56.820Z - info: info
2015-02-22T11:37:59.072Z - debug: debug
Winston version: 0.9.0,
Node.js version: 0.10.18.
Interesting. Nothing in the code looks wrong. Could you add a javascript-based test to our suite?
It's a feature, not a bug :+1:
Although an undocumented feature :-1:
The pull request contains the README update.
How can this be avoided ? It confuses some test runners such as cucumber-js
why is it a feature to spam my error logs with debug logs?
This behaviour is also very confusing on Cloud Foundry based platforms (e.g. IBM Bluemix). The standard debug log messages are all classified as errors :-(
Took me a while to find https://github.com/winstonjs/winston/issues/927 ... which explains that it can be configured via the stderrLevels parameter (which I've now done). Still a bit unexpected, that the default behavior is for INFO level messages to route to stdout
Most helpful comment
why is it a feature to spam my error logs with debug logs?