算法评测平台前端。
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

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';
}
}
module.exports.configureWinston = configureWinston;