heapsource/express-winston — pull request #32 by actionshrimp (2014-07-21 16:07:53+00:00)
Title: Use WinstonLogger.log rather than transport.log

Winston allows transports to be given a 'level' option - this allows you to prevent more noisy message levels (e.g. debug / info) from being sent to transports that only want to know about errors for example.

Previously this option was ignored as the dispatch of messages to winston transports inside expressWinston was done manually. I've changed this to use winston's own dispatching method, inside WinstonLogger.log, which obeys the level threshold rules.

As a winston logger instance is created for this purpose, I've also allowed the user to pass in a winstonLogger instance in the options. This saves the user from configuring all the transports transports twice, and also allows access to the winstonLogger's own configuration options if needed.