Skip to content

Commit

Permalink
nice Error objects logs
Browse files Browse the repository at this point in the history
  • Loading branch information
Tully committed Nov 18, 2012
1 parent 3cae317 commit 4f680ea
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/winston/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand Down

0 comments on commit 4f680ea

Please sign in to comment.