API Reference
pino-pretty
Log prettifier for pino that formats structured JSON logs into readable, colorized console output.
Official Documentation ↗CompatibilityThis documentation covers version
v13.2.0. Check the official docs for the latest API surface.Installation
npm
npm install --save-dev pino-prettypnpm
pnpm add -D pino-prettyMethods
No methods match this filter.
Overview
pino-pretty formats pino structured JSON logs into readable, colorized console output for local development. This reference lists the most frequently used APIs with accurate signatures and runnable snippets.
Core APIs
pino transport— Pipes pino output through pino-pretty as a worker transport in development.pino-pretty CLI— Formats NDJSON piped from an application into human-readable lines.options— Controls formatting such as colors, timestamp translation, and hidden fields.
Example
const pino = require('pino');
const logger = pino({
transport: { target: 'pino-pretty', options: { colorize: true } },
});
logger.info({ port: 3000 }, 'server started');
Notes
It should stay out of production paths because formatting adds cost and hides machine-readable structure. Use it as a dev transport or pipe.
Verification
Log an object with a message and confirm the prettified line shows the message plus formatted fields rather than raw JSON.
FAQ
- Should I use pino-pretty in production?
- No. It adds formatting overhead and can obscure fields; keep structured JSON in production and use pino-pretty mainly in development.
- How do I hide noisy fields?
- List them in the ignore option, such as keep pid and hostname out of every line for a cleaner local view.
- How do I see human timestamps?
- Set translateTime to SYS:standard or a format string so epoch values render as readable local times.
Report a problem with this API docOpens a pre-filled issue on GitHub.