bunyan: Potentially fix logging error properties
All checks were successful
continuous-integration/appveyor/branch AppVeyor build succeeded
All checks were successful
continuous-integration/appveyor/branch AppVeyor build succeeded
This commit is contained in:
parent
e28bfc0d1c
commit
035af486a2
2 changed files with 9 additions and 3 deletions
|
@ -771,13 +771,19 @@ Logger.prototype._emit = function (rec, noemit) {
|
|||
function mkRecord(log, minLevel, args) {
|
||||
var excludeFields, fields, msgArgs;
|
||||
if (args[0] instanceof Error) {
|
||||
var err = args[0];
|
||||
// `log.<level>(err, ...)`
|
||||
fields = {
|
||||
// Use this Logger's err serializer, if defined.
|
||||
err: (log.serializers && log.serializers.err
|
||||
? log.serializers.err(args[0])
|
||||
: Logger.stdSerializers.err(args[0]))
|
||||
? log.serializers.err(err)
|
||||
: Logger.stdSerializers.err(err))
|
||||
};
|
||||
for (const key in err) {
|
||||
if (Object.prototype.hasOwnProperty.call(err, key)) {
|
||||
fields[key] = err[key];
|
||||
}
|
||||
}
|
||||
excludeFields = {err: true};
|
||||
if (args.length === 1) {
|
||||
msgArgs = [fields.err.message];
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "bunyan-lite",
|
||||
"version": "1.2.0",
|
||||
"version": "1.2.1",
|
||||
"description": "a lite version of bunyan, a JSON logging library for node.js services with zero dependency",
|
||||
"author": "Jonatan Nilsson <jonatan@nilsson.is> (https://nfp.is)",
|
||||
"main": "./lib/bunyan.mjs",
|
||||
|
|
Loading…
Reference in a new issue