pino-pretty
Advanced tools
Comparing version 3.4.0 to 3.5.0
@@ -39,4 +39,5 @@ 'use strict' | ||
'timestamp', | ||
'v' | ||
'v', | ||
'caller' | ||
] | ||
} |
@@ -247,2 +247,7 @@ 'use strict' | ||
line += ')' | ||
if (log.caller) { | ||
line += ` <${log.caller}>` | ||
} | ||
return line | ||
@@ -249,0 +254,0 @@ } |
{ | ||
"name": "pino-pretty", | ||
"version": "3.4.0", | ||
"version": "3.5.0", | ||
"description": "Prettifier for Pino log lines", | ||
@@ -46,3 +46,3 @@ "main": "index.js", | ||
"devDependencies": { | ||
"pino": "^5.13.4", | ||
"pino": "^5.14.0", | ||
"pre-commit": "^1.2.2", | ||
@@ -52,4 +52,4 @@ "rimraf": "^3.0.0", | ||
"standard": "^14.0.0", | ||
"tap": "^14.9.1" | ||
"tap": "^14.10.2" | ||
} | ||
} |
@@ -601,3 +601,32 @@ 'use strict' | ||
t.test('prettifies trace caller', (t) => { | ||
t.plan(1) | ||
const traceCaller = (instance) => { | ||
const { symbols: { asJsonSym } } = pino | ||
const get = (target, name) => name === asJsonSym ? asJson : target[name] | ||
function asJson (...args) { | ||
args[0] = args[0] || {} | ||
args[0].caller = '/tmp/script.js' | ||
return instance[asJsonSym].apply(this, args) | ||
} | ||
return new Proxy(instance, { get }) | ||
} | ||
const pretty = prettyFactory() | ||
const log = traceCaller(pino({}, new Writable({ | ||
write (chunk, enc, cb) { | ||
const formatted = pretty(chunk.toString()) | ||
t.is( | ||
formatted, | ||
`[${epoch}] INFO (${pid} on ${hostname}) </tmp/script.js>: foo\n` | ||
) | ||
cb() | ||
} | ||
}))) | ||
log.info('foo') | ||
}) | ||
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
260798
2067