Skip to content

Instantly share code, notes, and snippets.

@thameera
Created January 15, 2016 12:58
Show Gist options
  • Save thameera/37609e9946799308f3fc to your computer and use it in GitHub Desktop.
Save thameera/37609e9946799308f3fc to your computer and use it in GitHub Desktop.
winston singleton
'use strict';
const logger = require('./logger');
const util = require('./util');
util.doStuff();
'use strict';
const winston = require('winston');
winston.remove(winston.transports.Console);
winston.add(winston.transports.Console, {
colorize: true,
json: false,
level: 'debug'
});
winston.add(winston.transports.File, {
name: 'file-log',
filename: 'debug.log',
json: false,
level: 'debug'
});
module.exports = winston;
'use strict';
const logger = require('winston');
module.exports = {
doStuff() {
logger.info('oh hi');
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment