Socket
Socket
Sign inDemoInstall

pino-pretty

Package Overview
Dependencies
Maintainers
3
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 10.0.0 to 10.0.1

4

index.js

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

if (prettifiedMessage) {
if (prettifiedMessage !== undefined) {
if (line.length > 0) {

@@ -190,3 +190,3 @@ line = `${line} ${prettifiedMessage}`

} else if (!hideObject) {
const skipKeys = [messageKey, levelKey, timestampKey].filter(key => typeof log[key] === 'string' || typeof log[key] === 'number')
const skipKeys = [messageKey, levelKey, timestampKey].filter(key => typeof log[key] === 'string' || typeof log[key] === 'number' || typeof log[key] === 'boolean')
const prettifiedObject = prettifyObject({

@@ -193,0 +193,0 @@ input: log,

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

if (messageKey in log === false) return undefined
if (typeof log[messageKey] !== 'string') return undefined
if (typeof log[messageKey] !== 'string' && typeof log[messageKey] !== 'number' && typeof log[messageKey] !== 'boolean') return undefined
return colorizer.message(log[messageKey])

@@ -286,0 +286,0 @@ }

{
"name": "pino-pretty",
"version": "10.0.0",
"version": "10.0.1",
"description": "Prettifier for Pino log lines",

@@ -51,3 +51,3 @@ "type": "commonjs",

"devDependencies": {
"@types/node": "^18.0.0",
"@types/node": "^20.1.0",
"pino": "^8.0.0",

@@ -59,4 +59,4 @@ "pre-commit": "^1.2.2",

"tap": "^16.0.0",
"tsd": "^0.27.0",
"typescript": "^4.4.3"
"tsd": "^0.28.0",
"typescript": "^5.0.2"
},

@@ -63,0 +63,0 @@ "tsd": {

@@ -121,2 +121,66 @@ 'use strict'

t.test('can print message key value when its a string', (t) => {
t.plan(1)
const pretty = prettyFactory()
const log = pino({}, new Writable({
write (chunk, enc, cb) {
const formatted = pretty(chunk.toString())
t.equal(
formatted,
`[${formattedEpoch}] INFO (${pid}): baz\n`
)
cb()
}
}))
log.info('baz')
})
t.test('can print message key value when its a number', (t) => {
t.plan(1)
const pretty = prettyFactory()
const log = pino({}, new Writable({
write (chunk, enc, cb) {
const formatted = pretty(chunk.toString())
t.equal(
formatted,
`[${formattedEpoch}] INFO (${pid}): 42\n`
)
cb()
}
}))
log.info(42)
})
t.test('can print message key value when its a Number(0)', (t) => {
t.plan(1)
const pretty = prettyFactory()
const log = pino({}, new Writable({
write (chunk, enc, cb) {
const formatted = pretty(chunk.toString())
t.equal(
formatted,
`[${formattedEpoch}] INFO (${pid}): 0\n`
)
cb()
}
}))
log.info(0)
})
t.test('can print message key value when its a boolean', (t) => {
t.plan(1)
const pretty = prettyFactory()
const log = pino({}, new Writable({
write (chunk, enc, cb) {
const formatted = pretty(chunk.toString())
t.equal(
formatted,
`[${formattedEpoch}] INFO (${pid}): true\n`
)
cb()
}
}))
log.info(true)
})
t.test('can use different message keys', (t) => {

@@ -123,0 +187,0 @@ t.plan(1)

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