Search code examples
node.jsloggingflatiron.jswinston

Multiple log files with Winston?


We'd like to use Winston for our logging in Node.js. But, we can't figure out how to have two log files: one for just errors, and one for everything else.

Doing this the naive way doesn't work, however: adding multiple winston.transports.File transports gives an error.

Others have run into this problem, with vague hints of a solution, but no real answer.

Any ideas?


Solution

  • I just sent a pull request that allows using multiple File transports in one logger. https://github.com/flatiron/winston/pull/149

    It is already merged into flatiron/winston.

    You can also use my forked repo: https://github.com/pdobrev/winston