Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Vladmel1234/2438d3da2af11b72338eccedd3f68e2c to your computer and use it in GitHub Desktop.
Save Vladmel1234/2438d3da2af11b72338eccedd3f68e2c to your computer and use it in GitHub Desktop.
logger factory for printing sourcepath
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