temp fix for #6848

v1.18.x
Baris Usakli 6 years ago
parent 48aff2584a
commit a6c70412db

@ -151,7 +151,7 @@ function resetPlugin(pluginId, callback) {
}, },
], function (err) { ], function (err) {
if (err) { if (err) {
winston.error('[reset] Could not disable plugin: %s encountered error %s', pluginId, err); winston.error('[reset] Could not disable plugin: ' + pluginId + ' encountered error %s', err);
} else if (active) { } else if (active) {
winston.info('[reset] Plugin `%s` disabled', pluginId); winston.info('[reset] Plugin `%s` disabled', pluginId);
} else { } else {

@ -12,6 +12,22 @@ function setupWinston() {
if (!winston.format) { if (!winston.format) {
return; return;
} }
// allow winton.error to log error objects properly
// https://github.com/NodeBB/NodeBB/issues/6848
const winstonError = winston.error;
winston.error = function (msg, error) {
if (msg instanceof Error) {
winstonError(msg);
} else if (error instanceof Error) {
msg = msg + '\n' + error.stack;
winstonError(msg);
} else {
winstonError.apply(null, arguments);
}
};
// https://github.com/winstonjs/winston/issues/1338 // https://github.com/winstonjs/winston/issues/1338
// error objects are not displayed properly // error objects are not displayed properly
const enumerateErrorFormat = winston.format((info) => { const enumerateErrorFormat = winston.format((info) => {

Loading…
Cancel
Save