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 7.6.1 to 8.0.0

6

lib/utils.js
'use strict'
const clone = require('rfdc')({ circles: true })
const fastCopy = require('fast-copy')
const dateformat = require('dateformat')

@@ -576,3 +576,3 @@ const SonicBoom = require('sonic-boom')

* @param {object} log The log object to be modified.
* @param {string} ignoreKeys An array of strings identifying the properties to be removed.
* @param {Set<string> | Array<string>} ignoreKeys An array of strings identifying the properties to be removed.
*

@@ -582,3 +582,3 @@ * @returns {object} A new `log` object instance that does not include the ignored keys.

function filterLog (log, ignoreKeys) {
const logCopy = clone(log)
const logCopy = fastCopy(log)
ignoreKeys.forEach((ignoreKey) => {

@@ -585,0 +585,0 @@ deleteLogProperty(logCopy, ignoreKey)

{
"name": "pino-pretty",
"version": "7.6.1",
"version": "8.0.0",
"description": "Prettifier for Pino log lines",

@@ -35,5 +35,6 @@ "type": "commonjs",

"dependencies": {
"args": "^5.0.1",
"args": "5.0.1",
"colorette": "^2.0.7",
"dateformat": "^4.6.3",
"fast-copy": "^2.1.1",
"fast-safe-stringify": "^2.0.7",

@@ -45,3 +46,2 @@ "joycon": "^3.1.1",

"readable-stream": "^3.6.0",
"rfdc": "^1.3.0",
"secure-json-parse": "^2.4.0",

@@ -48,0 +48,0 @@ "sonic-boom": "^2.2.0",

@@ -85,8 +85,6 @@ 'use strict'

t.plan(1)
const pretty = prettyFactory({ levelFirst: true })
const log = pino({}, new Writable({
write (chunk, enc, cb) {
const formatted = pretty(chunk.toString())
const destination = new Writable({
write (formatted, enc, cb) {
t.equal(
formatted,
formatted.toString(),
`INFO [${epoch}] (${pid} on ${hostname}): foo\n`

@@ -96,3 +94,9 @@ )

}
}))
})
const pretty = pinoPretty({
destination,
levelFirst: true,
colorize: false
})
const log = pino({}, pretty)
log.info('foo')

@@ -558,42 +562,2 @@ })

t.test('supports pino metadata API', (t) => {
t.plan(1)
const dest = new Writable({
write (chunk, enc, cb) {
t.equal(
chunk.toString(),
`[${epoch}] INFO (${pid} on ${hostname}): foo\n`
)
cb()
}
})
const log = pino({
prettifier: prettyFactory,
prettyPrint: true
}, dest)
log.info('foo')
})
t.test('can swap date and level position through meta stream', (t) => {
t.plan(1)
const dest = new Writable({
objectMode: true,
write (formatted, enc, cb) {
t.equal(
formatted,
`INFO [${epoch}] (${pid} on ${hostname}): foo\n`
)
cb()
}
})
const log = pino({
prettifier: prettyFactory,
prettyPrint: {
levelFirst: true
}
}, dest)
log.info('foo')
})
t.test('filter some lines based on minimumLevel', (t) => {

@@ -756,3 +720,3 @@ t.plan(3)

t.plan(1)
const dest = new Writable({
const destination = new Writable({
write (chunk, _, cb) {

@@ -766,6 +730,7 @@ t.equal(

})
const log = pino({
prettifier: prettyFactory,
prettyPrint: true
}, dest)
const pretty = pinoPretty({
destination,
colorize: false
})
const log = pino({}, pretty)
log.info({

@@ -772,0 +737,0 @@ a: { b: 'c' },

'use strict'
const tap = require('tap')
const clone = require('rfdc')()
const fastCopy = require('fast-copy')
const stringifySafe = require('fast-safe-stringify')

@@ -143,3 +143,3 @@ const { internals } = require('../../lib/utils')

t.test('deleteLogProperty deletes property of depth 1', async t => {
const log = clone(logData)
const log = fastCopy(logData)
internals.deleteLogProperty(log, 'data1')

@@ -150,3 +150,3 @@ t.same(log, { level: 30 })

t.test('deleteLogProperty deletes property of depth 2', async t => {
const log = clone(logData)
const log = fastCopy(logData)
internals.deleteLogProperty(log, 'data1.data2')

@@ -157,3 +157,3 @@ t.same(log, { level: 30, data1: { } })

t.test('deleteLogProperty deletes property of depth 3', async t => {
const log = clone(logData)
const log = fastCopy(logData)
internals.deleteLogProperty(log, 'data1.data2.data-3')

@@ -160,0 +160,0 @@ t.same(log, { level: 30, data1: { data2: { } } })

@@ -394,3 +394,4 @@ 'use strict'

data1: {
data2: { 'data-3': 'bar' }
data2: { 'data-3': 'bar' },
error: new Error('test')
}

@@ -401,3 +402,3 @@ }

const result = filterLog(logData, ['data1.data2.data-3'])
t.same(result, { level: 30, time: 1522431328992, data1: { data2: { } } })
t.same(result, { level: 30, time: 1522431328992, data1: { data2: { }, error: new Error('test') } })
})

@@ -410,2 +411,7 @@

t.test('filterLog keeps error instance', async t => {
const result = filterLog(logData, [])
t.equals(logData.data1.error, result.data1.error)
})
const logData2 = Object.assign({

@@ -412,0 +418,0 @@ 'logging.domain.corp/operation': {

Sorry, the diff of this file is not supported yet

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