Created
January 15, 2016 12:58
-
-
Save thameera/37609e9946799308f3fc to your computer and use it in GitHub Desktop.
winston singleton
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
'use strict'; | |
const logger = require('./logger'); | |
const util = require('./util'); | |
util.doStuff(); | |
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
'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; |
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
'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