Comparing version 2.8.0 to 2.8.1
{ | ||
"name": "pino", | ||
"version": "2.8.0", | ||
"version": "2.8.1", | ||
"description": "fast and simple logger", | ||
@@ -53,2 +53,3 @@ "main": "pino.js", | ||
"flatstr": "^1.0.0", | ||
"object.assign": "^4.0.4", | ||
"once": "^1.3.3", | ||
@@ -55,0 +56,0 @@ "quick-format": "^2.0.4", |
@@ -12,2 +12,3 @@ 'use strict' | ||
var baseLog = flatstr('{"pid":' + pid + ',"hostname":"' + hostname + '",') | ||
var extend = require('object.assign').getPolyfill() | ||
@@ -226,3 +227,5 @@ var LOG_VERSION = 1 | ||
value = this.serializers[key] ? this.serializers[key](value) : value | ||
data += ',"' + key + '":' + this.stringify(value) | ||
if (value !== undefined) { | ||
data += ',"' + key + '":' + this.stringify(value) | ||
} | ||
} | ||
@@ -253,3 +256,3 @@ } | ||
value = bindings[key] | ||
if (key !== 'level' && bindings.hasOwnProperty(key) && value !== undefined) { | ||
if (key !== 'level' && key !== 'serializers' && bindings.hasOwnProperty(key) && value !== undefined) { | ||
value = this.serializers[key] ? this.serializers[key](value) : value | ||
@@ -264,3 +267,3 @@ data += '"' + key + '":' + this.stringify(value) + ',' | ||
this.stream, | ||
this.serializers, | ||
bindings.hasOwnProperty('serializers') ? extend(this.serializers, bindings.serializers) : this.serializers, | ||
this.stringify, | ||
@@ -267,0 +270,0 @@ this.end, |
@@ -263,2 +263,26 @@ ![banner](pino-banner.png) | ||
Child loggers inherit the serializers from the parent logger but it is | ||
possible to override them. | ||
For example | ||
``` | ||
var pino = require('./pino') | ||
var customSerializers = { | ||
test: function () { | ||
return 'this is my serializer' | ||
} | ||
} | ||
var child = pino().child({serializers: customSerializers}) | ||
child.info({test: 'should not show up'}) | ||
``` | ||
Will produce the following output: | ||
``` | ||
{"pid":7971,"hostname":"mycomputer.local","level":30,"time":1469488147985,"test":"this is my serializer","v":1} | ||
``` | ||
Also from version 2.x.x we can spawn child loggers from child loggers, for instance | ||
@@ -265,0 +289,0 @@ |
@@ -150,2 +150,16 @@ 'use strict' | ||
test('serializers can return undefined to strip field', function (t) { | ||
t.plan(1) | ||
var instance = pino({ | ||
serializers: { | ||
test: function (o) { return undefined } | ||
} | ||
}, sink(function (obj, enc, cb) { | ||
t.notOk('test' in obj) | ||
cb() | ||
})) | ||
instance.info({ test: 'sensitive info' }) | ||
}) | ||
test('does not explode with a circular ref', function (t) { | ||
@@ -152,0 +166,0 @@ var instance = pino(sink(function (chunk, enc, cb) { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
582411
28
2116
961
9
+ Addedobject.assign@^4.0.4
+ Addedcall-bind@1.0.7(transitive)
+ Addeddefine-data-property@1.1.4(transitive)
+ Addeddefine-properties@1.2.1(transitive)
+ Addedes-define-property@1.0.0(transitive)
+ Addedes-errors@1.3.0(transitive)
+ Addedfunction-bind@1.1.2(transitive)
+ Addedget-intrinsic@1.2.4(transitive)
+ Addedgopd@1.0.1(transitive)
+ Addedhas-property-descriptors@1.0.2(transitive)
+ Addedhas-proto@1.0.3(transitive)
+ Addedhas-symbols@1.0.3(transitive)
+ Addedhasown@2.0.2(transitive)
+ Addedobject-keys@1.1.1(transitive)
+ Addedobject.assign@4.1.5(transitive)
+ Addedset-function-length@1.2.2(transitive)