Created
July 17, 2016 06:16
-
-
Save Vladmel1234/2438d3da2af11b72338eccedd3f68e2c to your computer and use it in GitHub Desktop.
logger factory for printing sourcepath
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
var logger = require('logger')(module); | |
logger.info('My log statement'); | |
Inside your logger module: | |
var winston = require('winston'); | |
module.exports = function (module) { | |
var filename = module.id; | |
return { | |
info : function (msg, vars) { | |
winston.info(filename + ': ' + msg, vars); | |
} | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment