Created
October 29, 2012 12:16
-
-
Save wwqrd/3973218 to your computer and use it in GitHub Desktop.
Simple log shim
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create an instance of winston using our settings file determined by NODE_ENV | |
var winston = require( 'winston' ), | |
settings = ( process.env.NODE_ENV === 'production' ) | |
? require( '../settings.json' ).production.logger | |
: require( '../settings.json' ).development.logger | |
var transports = []; | |
if( settings.console ) { | |
transports.push(new (winston.transports.Console)()); | |
} | |
if( settings.file ) { | |
transports.push(new (winston.transports.File)({ filename: settings.file })); | |
} | |
var logger = new (winston.Logger)({ | |
transports: transports | |
}); | |
module.exports = logger; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment