mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-09 15:35:47 +01:00
@@ -12,9 +12,25 @@ function setupWinston() {
|
|||||||
if (!winston.format) {
|
if (!winston.format) {
|
||||||
return;
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (info instanceof Error) {
|
||||||
|
return Object.assign({
|
||||||
|
message: `${info.message}\n${info.stack}`,
|
||||||
|
}, info);
|
||||||
|
}
|
||||||
|
|
||||||
|
return info;
|
||||||
|
});
|
||||||
var formats = [];
|
var formats = [];
|
||||||
|
formats.push(enumerateErrorFormat());
|
||||||
if (nconf.get('log-colorize') !== 'false') {
|
if (nconf.get('log-colorize') !== 'false') {
|
||||||
formats.push(winston.format.colorize());
|
formats.push(winston.format.colorize());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user