You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
587 B
24 lines
587 B
7 years ago
|
const winston = require('winston');
|
||
|
const _ = require('lodash');
|
||
|
const util = require('util');
|
||
|
|
||
|
function formatter(args) {
|
||
|
var msg = args.level + ' - ' + args.message + (_.isEmpty(args.meta) ? '' : (' - ' + util.inspect(args.meta)));
|
||
|
return msg;
|
||
|
}
|
||
|
|
||
|
function configureWinston(verbose) {
|
||
|
winston.configure({
|
||
|
transports: [
|
||
|
new (winston.transports.Console)({ formatter: formatter })
|
||
|
]
|
||
|
});
|
||
|
if (verbose) {
|
||
|
winston.level = 'debug';
|
||
|
} else {
|
||
|
winston.level = 'info';
|
||
|
}
|
||
|
}
|
||
|
|
||
7 years ago
|
module.exports.configureWinston = configureWinston;
|