Skip to content

Instantly share code, notes, and snippets.

@jlukanta
Last active March 22, 2017 03:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jlukanta/6863823 to your computer and use it in GitHub Desktop.
Save jlukanta/6863823 to your computer and use it in GitHub Desktop.
winston logger.error(error) workaround, i.e. Issue #280
diff --git a/node_modules/winston/lib/winston/common.js b/node_modules/winston/lib/winston/common.js
index c754942..8f69901 100644
--- a/node_modules/winston/lib/winston/common.js
+++ b/node_modules/winston/lib/winston/common.js
@@ -73,6 +73,9 @@ exports.clone = function (obj) {
else if (obj instanceof Date) {
return obj;
}
+ else if (obj instanceof Error) {
+ return obj;
+ }
var copy = {};
for (var i in obj) {
diff --git a/node_modules/winston/node_modules/cycle/cycle.js b/node_modules/winston/node_modules/cycle/cycle.js
index 4382285..3df40be 100644
--- a/node_modules/winston/node_modules/cycle/cycle.js
+++ b/node_modules/winston/node_modules/cycle/cycle.js
@@ -49,6 +49,7 @@ cycle.decycle = function decycle(object) {
value instanceof Date ||
value instanceof Number ||
value instanceof RegExp ||
+ value instanceof Error ||
value instanceof String) {
return value;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment