this handles winston.error(err);
v1.18.x
Barış Soner Uşaklı 6 years ago
parent 9dd65cf772
commit e6546e6263

@ -12,9 +12,25 @@ function setupWinston() {
if (!winston.format) {
return;
}
// https://github.com/winstonjs/winston/issues/1338
// error objects are not displayed properly
const enumerateErrorFormat = winston.format((info) => {
if (info.message instanceof Error) {
info.message = Object.assign({
message: `${info.message.message}\n${info.message.stack}`,
}, info.message);
}
var formats = [];
if (info instanceof Error) {
return Object.assign({
message: `${info.message}\n${info.stack}`,
}, info);
}
return info;
});
var formats = [];
formats.push(enumerateErrorFormat());
if (nconf.get('log-colorize') !== 'false') {
formats.push(winston.format.colorize());
}

Loading…
Cancel
Save