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 2.4.0 to 2.5.0

5

index.js

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

const jmespath = require('jmespath')
const stringifySafe = require('fast-safe-stringify')

@@ -228,3 +229,3 @@ const CONSTANTS = require('./lib/constants')

if (errorLikeObjectKeys.indexOf(keys[i]) !== -1 && value[keys[i]] !== undefined) {
const lines = JSON.stringify(value[keys[i]], null, 2)
const lines = stringifySafe(value[keys[i]], null, 2)
if (lines === undefined) continue

@@ -259,3 +260,3 @@ const arrayOfLines = (

if (value[keys[i]] !== undefined) {
const lines = JSON.stringify(value[keys[i]], null, 2)
const lines = stringifySafe(value[keys[i]], null, 2)
if (lines !== undefined) {

@@ -262,0 +263,0 @@ result += IDENT + keys[i] + ': ' + joinLinesWithIndentation(lines) + EOL

3

package.json
{
"name": "pino-pretty",
"version": "2.4.0",
"version": "2.5.0",
"description": "Prettifier for Pino log lines",

@@ -37,2 +37,3 @@ "main": "index.js",

"fast-json-parse": "^1.0.3",
"fast-safe-stringify": "^2.0.6",
"jmespath": "^0.15.0",

@@ -39,0 +40,0 @@ "pump": "^3.0.0",

@@ -488,2 +488,31 @@ 'use strict'

t.test('prettifies msg object with circular references', (t) => {
t.plan(7)
const expectedLines = [
' msg: {',
' "b": {',
' "c": "d"',
' },',
' "a": "[Circular]"',
' }'
]
const pretty = prettyFactory()
const log = pino({}, new Writable({
write (chunk, enc, cb) {
const formatted = pretty(chunk.toString())
const lines = formatted.split('\n')
t.is(lines.length, expectedLines.length + 2)
lines.shift(); lines.pop()
for (var i = 0; i < lines.length; i += 1) {
t.is(lines[i], expectedLines[i])
}
cb()
}
}))
const msg = { b: { c: 'd' } }
msg.a = msg
log.info({ msg })
})
t.test('prettifies object with some undefined values', (t) => {

@@ -490,0 +519,0 @@ t.plan(1)

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