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.
20 lines
541 B
20 lines
541 B
import winston = require('winston'); |
|
import _ = require('lodash'); |
|
|
|
function formatter(args) { |
|
var msg = args.level + ' - ' + args.message + (_.isEmpty(args.meta) ? '' : (' - ' + JSON.stringify(args.meta))); |
|
return msg; |
|
} |
|
|
|
export function configureWinston(verbose: boolean) { |
|
winston.configure({ |
|
transports: [ |
|
new (winston.transports.Console)({ formatter: formatter }) |
|
] |
|
}); |
|
if (verbose) { |
|
(winston as any).level = 'debug'; |
|
} else { |
|
(winston as any).level = 'warn'; |
|
} |
|
} |