Ensure log.info({err: err})
results in a "msg" value, just like log.info(err)
Fixes #426
This commit is contained in:
parent
876d3584b4
commit
09742317fd
2 changed files with 9 additions and 2 deletions
|
@ -8,7 +8,8 @@ Known issues:
|
|||
|
||||
## 1.8.2 (not yet released)
|
||||
|
||||
(nothing yet)
|
||||
- [issue #426] Ensure `log.info({err: err})` results in a "msg" value, just
|
||||
like `log.info(err)`.
|
||||
|
||||
|
||||
## 1.8.1
|
||||
|
|
|
@ -980,8 +980,14 @@ function mkLogEmitter(minLevel) {
|
|||
msgArgs[0] = util.inspect(msgArgs[0]);
|
||||
} else { // `log.<level>(fields, msg, ...)`
|
||||
fields = args[0];
|
||||
if (args.length === 1 && fields.err
|
||||
&& fields.err instanceof Error)
|
||||
{
|
||||
msgArgs = [fields.err.message];
|
||||
} else {
|
||||
msgArgs = Array.prototype.slice.call(args, 1);
|
||||
}
|
||||
}
|
||||
|
||||
// Build up the record object.
|
||||
var rec = objCopy(log.fields);
|
||||
|
|
Loading…
Reference in a new issue