Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pino

Package Overview
Dependencies
Maintainers
2
Versions
311
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pino - npm Package Compare versions

Comparing version 2.8.0 to 2.8.1

test/serializers.test.js

3

package.json
{
"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) {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc