diff --git a/collector/utils/logger/index.js b/collector/utils/logger/index.js index 95c4764f28..87913c2449 100644 --- a/collector/utils/logger/index.js +++ b/collector/utils/logger/index.js @@ -34,6 +34,9 @@ class Logger { return logger.info.apply(logger, arguments); }; console.error = function () { + if (arguments.length > 0 && arguments[0] instanceof Error) { + return logger.error(arguments[0].stack); + } return logger.error.apply(logger, arguments); }; console.info = function () { diff --git a/server/utils/logger/index.js b/server/utils/logger/index.js index 66d20a2a55..b96cedefe9 100644 --- a/server/utils/logger/index.js +++ b/server/utils/logger/index.js @@ -32,6 +32,9 @@ class Logger { return logger.info.apply(logger, arguments); }; console.error = function () { + if (arguments.length > 0 && arguments[0] instanceof Error) { + return logger.error(arguments[0].stack); + } return logger.error.apply(logger, arguments); }; console.info = function () {