parent
bd149b924b
commit
4455189b77
2 changed files with 16 additions and 2 deletions
|
@ -8,7 +8,11 @@ Known issues:
|
|||
|
||||
## bunyan 1.1.3 (not yet released)
|
||||
|
||||
(nothing yet)
|
||||
- [issue #165] Include extra `err` fields in `bunyan` CLI output. Before
|
||||
this change only the fields part of the typical node.js error stack
|
||||
(err.stack, err.message, err.name) would be emitted, even though
|
||||
the Bunyan *library* would typically include err.code and err.signal
|
||||
in the raw JSON log record.
|
||||
|
||||
|
||||
## bunyan 1.1.2
|
||||
|
|
12
bin/bunyan
12
bin/bunyan
|
@ -938,7 +938,17 @@ function emitRecord(rec, line, opts, stylize) {
|
|||
}
|
||||
|
||||
if (rec.err && rec.err.stack) {
|
||||
details.push(indent(rec.err.stack));
|
||||
var err = rec.err
|
||||
details.push(indent(err.stack));
|
||||
delete err.message;
|
||||
delete err.name;
|
||||
delete err.stack;
|
||||
// E.g. for extra 'foo' field on 'err', add 'err.foo' at
|
||||
// top-level. This *does* have the potential to stomp on a
|
||||
// literal 'err.foo' key.
|
||||
Object.keys(err).forEach(function (k) {
|
||||
rec['err.' + k] = err[k];
|
||||
})
|
||||
delete rec.err;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue