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

pino

Package Overview
Dependencies
Maintainers
4
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 4.2.0 to 4.2.1

15

browser.js

@@ -48,2 +48,3 @@ 'use strict'

function Child (parent) {
this._childLevel = (parent._childLevel | 0) + 1
this.error = bind(parent, bindings, 'error')

@@ -73,6 +74,12 @@ this.fatal = bind(parent, bindings, 'fatal')

var o = { time: Date.now(), level: pino.levels.values[k] }
var lvl = (this._childLevel | 0) + 1
if (lvl < 1) lvl = 1
// deliberate, catching objects, arrays
if (msg !== null && typeof msg === 'object') Object.assign(o, msg)
if (typeof msg === 'string') msg = format(args)
o.msg = msg
if (msg !== null && typeof msg === 'object') {
while (lvl-- && typeof args[0] === 'object') {
Object.assign(o, args.shift())
}
msg = args.length ? format(args) : undefined
} else if (typeof msg === 'string') msg = format(args)
if (msg !== undefined) o.msg = msg
write.call(logger, o)

@@ -119,3 +126,3 @@ }

}
return parent[level].apply(null, args)
return parent[level].apply(this, args)
}

@@ -122,0 +129,0 @@ }

{
"name": "pino",
"version": "4.2.0",
"version": "4.2.1",
"description": "super fast, all natural json logger",

@@ -5,0 +5,0 @@ "main": "pino.js",

@@ -237,2 +237,58 @@ 'use strict'

test('opts.browser.asObject/write supports child loggers', function (t) {
var instance = pino({
browser: {write: function (o) {
t.is(o.level, 30)
t.is(o.test, 'test')
t.is(o.msg, 'msg-test')
t.ok(o.time)
}}
})
var child = instance.child({test: 'test'})
child.info('msg-test')
t.end()
})
test('opts.browser.asObject/write supports child child loggers', function (t) {
var instance = pino({
browser: {write: function (o) {
t.is(o.level, 30)
t.is(o.test, 'test')
t.is(o.foo, 'bar')
t.is(o.msg, 'msg-test')
t.ok(o.time)
}}
})
var child = instance.child({test: 'test'}).child({foo: 'bar'})
child.info('msg-test')
t.end()
})
test('opts.browser.asObject/write supports child child child loggers', function (t) {
var instance = pino({
browser: {write: function (o) {
t.is(o.level, 30)
t.is(o.test, 'test')
t.is(o.foo, 'bar')
t.is(o.baz, 'bop')
t.is(o.msg, 'msg-test')
t.ok(o.time)
}}
})
var child = instance.child({test: 'test'}).child({foo: 'bar'}).child({baz: 'bop'})
child.info('msg-test')
t.end()
})
test('opts.browser.asObject defensively mitigates naughty numbers', function (t) {
var instance = pino({
browser: {asObject: true}
})
var child = instance.child({test: 'test'})
child._childLevel = -10
child.info('test')
t.pass() // if we reached here, there was no infinite loop, so, .. pass.
t.end()
})
test('opts.browser.write obj falls back to console where a method is not supplied', function (t) {

@@ -239,0 +295,0 @@ t.plan(6)

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