radio/magnus/lib/log.js

19 lines
397 B
JavaScript
Raw Normal View History

2018-08-04 21:46:25 +00:00
var Winston = require("winston");
var config = require("../config");
var ENV = config.get('build');
function getLogger(module) {
var path = module.filename.split('/').slice(-2).join('/');
return Winston.createLogger({
2018-08-04 21:46:25 +00:00
transports: [
new Winston.transports.Console({
colorize: true,
level: ENV == 'debug' ? 'debug' : 'error'
})
]
});
}
module.exports = getLogger;