As far as I understood has Winston a hierarchy in its logging levels. You can set the level with winston.level = 'error' and all levels below should not be shown. Unfortunately I still get the logs of info and debug shown in my console.
Question 1):
How to really set winston to show me only the log level
Question 2)
Why is Debug anyways shown in the console, I configured it to show up in a log file (what it additionally does)
winston = require('winston')
winston.emitErrs = true
logger = new winston.Logger({
transports: [
new winston.transports.File({
level: 'info'
filename: 'logs/log.log'
handleExceptions: true
json: true
maxsize: 5242880 #5MB
maxFiles: 5
colorize: false
timestamp: true
}),
new winston.transports.Console({
level: 'debug'
handleExceptions: true
json: false
colorize: true
})
],
exitOnError: false
})
winston.level = 'error'
module.exports = logger
module.exports.stream = {
write: (message, encoding) ->
logger.info(message)
}
The code is basically from this tut: http://tostring.it/2014/06/23/advanced-logging-with-nodejs/