Skip to content

Instantly share code, notes, and snippets.

@wwqrd
Created October 29, 2012 12:16
Show Gist options
  • Save wwqrd/3973218 to your computer and use it in GitHub Desktop.
Save wwqrd/3973218 to your computer and use it in GitHub Desktop.
Simple log shim
// 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