Skip to content

Instantly share code, notes, and snippets.

@deepakshrma
Created July 27, 2016 15:37
Show Gist options
  • Save deepakshrma/552ed30a20b2d32af09bb3301be5c1ca to your computer and use it in GitHub Desktop.
Save deepakshrma/552ed30a20b2d32af09bb3301be5c1ca to your computer and use it in GitHub Desktop.
Singleton logger
use strict';
var winston = require('winston');
var config = require('./winston.config');
winston.emitErrs = true;
var logger = new winston.Logger({
level: 'debug',
levels: config.defaults.levels,
handleExceptions: true,
transports: [
new winston.transports.Console(config.env[process.env.NODE_ENV] || config.env.development)
],
exitOnError: false
});
winston.addColors(config.defaults.colors)
module.exports = logger;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment