pino-pretty
Advanced tools
Comparing version 2.2.0 to 2.2.1
10
index.js
@@ -156,3 +156,3 @@ 'use strict' | ||
if (log[messageKey]) { | ||
if (log[messageKey] && typeof log[messageKey] === 'string') { | ||
line += color.message(log[messageKey]) | ||
@@ -194,3 +194,3 @@ } | ||
} else { | ||
line += filterObjects(log, messageKey, errorLikeObjectKeys) | ||
line += filterObjects(log, typeof log[messageKey] === 'string' ? messageKey : undefined, errorLikeObjectKeys) | ||
} | ||
@@ -212,4 +212,8 @@ | ||
const keys = Object.keys(value) | ||
const filteredKeys = [messageKey] | ||
const filteredKeys = [] | ||
if (messageKey) { | ||
filteredKeys.push(messageKey) | ||
} | ||
if (excludeStandardKeys !== false) { | ||
@@ -216,0 +220,0 @@ Array.prototype.push.apply(filteredKeys, standardKeys) |
{ | ||
"name": "pino-pretty", | ||
"version": "2.2.0", | ||
"version": "2.2.1", | ||
"description": "Prettifier for Pino log lines", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -8,4 +8,13 @@ 'use strict' | ||
const dateformat = require('dateformat') | ||
const prettyFactory = require('../') | ||
const _prettyFactory = require('../') | ||
function prettyFactory (opts) { | ||
if (!opts) { | ||
opts = { colorize: false } | ||
} else if (!opts.hasOwnProperty('colorize')) { | ||
opts.colorize = false | ||
} | ||
return _prettyFactory(opts) | ||
} | ||
// All dates are computed from 'Fri, 30 Mar 2018 17:35:28 GMT' | ||
@@ -455,3 +464,28 @@ const epoch = 1522431328992 | ||
t.test('prettifies msg object', (t) => { | ||
t.plan(6) | ||
const expectedLines = [ | ||
' msg: {', | ||
' "b": {', | ||
' "c": "d"', | ||
' }', | ||
' }' | ||
] | ||
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() | ||
} | ||
})) | ||
log.info({ msg: { b: { c: 'd' } } }) | ||
}) | ||
t.end() | ||
}) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
217405
965