Socket
Socket
Sign inDemoInstall

pino-pretty

Package Overview
Dependencies
Maintainers
4
Versions
88
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pino-pretty - npm Package Compare versions

Comparing version 3.6.0 to 3.6.1

17

lib/utils.js

@@ -218,3 +218,3 @@ 'use strict'

* Prettifies metadata that is usually present in a Pino log line. It looks for
* fields `name`, `pid`, and `hostname` and returns a formatted string using
* fields `name`, `pid`, `hostname`, and `caller` and returns a formatted string using
* the fields it finds.

@@ -230,4 +230,6 @@ *

function prettifyMetadata ({ log }) {
let line = ''
if (log.name || log.pid || log.hostname) {
let line = '('
line += '('

@@ -251,10 +253,13 @@ if (log.name) {

line += ')'
}
if (log.caller) {
line += ` <${log.caller}>`
}
if (log.caller) {
line += `${line === '' ? '' : ' '}<${log.caller}>`
}
if (line === '') {
return undefined
} else {
return line
}
return undefined
}

@@ -261,0 +266,0 @@

{
"name": "pino-pretty",
"version": "3.6.0",
"version": "3.6.1",
"description": "Prettifier for Pino log lines",

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

@@ -145,3 +145,3 @@ 'use strict'

t.test('works with all three present', async t => {
t.test('works with only `name`, `pid`, & `hostname` present', async t => {
const str = prettifyMetadata({ log: { name: 'foo', pid: '1234', hostname: 'bar' } })

@@ -151,2 +151,37 @@ t.is(str, '(foo/1234 on bar)')

t.test('works with only `name` & `caller` present', async t => {
const str = prettifyMetadata({ log: { name: 'foo', caller: 'baz' } })
t.is(str, '(foo) <baz>')
})
t.test('works with only `pid` & `caller` present', async t => {
const str = prettifyMetadata({ log: { pid: '1234', caller: 'baz' } })
t.is(str, '(1234) <baz>')
})
t.test('works with only `hostname` & `caller` present', async t => {
const str = prettifyMetadata({ log: { hostname: 'bar', caller: 'baz' } })
t.is(str, '(on bar) <baz>')
})
t.test('works with only `name`, `pid`, & `caller` present', async t => {
const str = prettifyMetadata({ log: { name: 'foo', pid: '1234', caller: 'baz' } })
t.is(str, '(foo/1234) <baz>')
})
t.test('works with only `name`, `hostname`, & `caller` present', async t => {
const str = prettifyMetadata({ log: { name: 'foo', hostname: 'bar', caller: 'baz' } })
t.is(str, '(foo on bar) <baz>')
})
t.test('works with only `pid`, `hostname`, & `caller` present', async t => {
const str = prettifyMetadata({ log: { pid: '1234', hostname: 'bar', caller: 'baz' } })
t.is(str, '(1234 on bar) <baz>')
})
t.test('works with all four present', async t => {
const str = prettifyMetadata({ log: { name: 'foo', pid: '1234', hostname: 'bar', caller: 'baz' } })
t.is(str, '(foo/1234 on bar) <baz>')
})
t.end()

@@ -153,0 +188,0 @@ })

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