Permalink
Browse files

Merge pull request #1 from tu1ly/master

fix for Error objects
  • Loading branch information...
2 parents 3cae317 + 4f680ea commit e21b4056e864665fcb8ac7df1092170d60d7e2e5 @Almad Almad committed Nov 19, 2012
Showing with 4 additions and 0 deletions.
  1. +4 −0 lib/winston/common.js
View
@@ -159,9 +159,13 @@ exports.log = function (options) {
output += (': ' + options.message);
if (meta) {
+ var stack;
if (typeof meta !== 'object') {
output += ' ' + meta;
}
+ else if (meta && (meta instanceof Error) && (stack = meta.stack) ){
+ meta = stack;
+ }
else if (Object.keys(meta).length > 0) {
output += ' ' + (options.prettyPrint ? ('\n' + util.inspect(meta, false, null, options.colorize)) : exports.serialize(meta));
}

0 comments on commit e21b405

Please sign in to comment.