Winston logging to multiple file logs without duplicating log messages

405 views Asked by At

Here is my Winston config:

winston = require 'winston'
logger = new winston.Logger 
   transports: [
    new winston.transports.File
       name: 'file#debug'
       level: 'debug'
        filename: '/tmp/debug.log'
    new winston.transports.File
       name: 'file#error'
       level: 'error'
       filename: '/tmp/error.log'
 ]

Currently when I log:

logger.error 'error' # both logs
logger.debug 'debug' # on debug log

What I want is the errors to only go to error.log, and debug messages to only go to debug.log. How can i do that? Searched the File transport options but didnt find anything like that.

0

There are 0 answers