Skip to main content

Pino Logger Config Builder

Configure Pino structured logging for Node.js. Set log level, transport, pretty-print, redaction paths, and serializers — get copy-ready Node.js code instantly.

✓ All transport types ✓ Redact sensitive fields ✓ pino-pretty support

Frequently Asked Questions

What is Pino and why is it fast?▼

Pino is a structured JSON logger for Node.js, widely regarded as one of the fastest loggers available. Its speed comes from minimizing object allocation during log calls, using a worker thread (asynchronous) for I/O when possible, and serializing log records to JSON strings as efficiently as possible. Unlike Winston, Pino separates concerns — the logger writes to stdout and a separate process (pino-pretty, log rotation, cloud transport) handles formatting.

What is pino-pretty and when should I use it?▼

pino-pretty is a development-time formatter that converts Pino's compact JSON output into a human-readable colorized format. Install it as a dev dependency: npm install -D pino-pretty. Use it only in development — in production, keep raw JSON output which is faster and directly ingestable by log aggregators (Datadog, Loki, CloudWatch). Configure it as a transport: { target: 'pino-pretty', options: { colorize: true } }.

How do I use Pino in a Fastify or Express app?▼

For Fastify: pass logger: true (or logger: { level: 'info' }) in the Fastify constructor — Fastify uses Pino internally. For Express: import pino and pino-http, then use app.use(pinoHttp({ logger: pinoInstance })). The pinoHttp middleware automatically logs each request/response pair including status code, response time, and content length.

What is the redact option in Pino?▼

redact removes or masks sensitive fields from log output. Pass redact: ['password', 'req.headers.authorization', 'user.email'] to replace those paths with '[Redacted]'. Use 'req.headers.authorization' to hide Bearer tokens, '*.password' to redact passwords at any depth. Redaction uses fast-redact under the hood and runs at serialization time with near-zero overhead.

How does Pino's child logger work?▼

const child = logger.child({ requestId: '123' }) creates a new logger that inherits the parent's config but adds fixed fields to every log line. This is the idiomatic way to add context — in web servers, create a child logger per request with { requestId, userId } so every log from that request automatically includes that context without passing it manually to every function.

What is the difference between Pino levels?▼

Pino has 6 levels in ascending severity: trace (5) for verbose debugging, debug (10) for development diagnostics, info (20) for normal operation events, warn (30) for degraded but functioning states, error (40) for failures that need attention, fatal (50) for critical failures that crash the app. Setting level: 'info' suppresses trace and debug. In production, use 'info' or 'warn'. In development, use 'debug' or 'trace'.

Share this tool: X / Twitter LinkedIn
✓ 60,000+ developers use DevPlaybook ★★★★★ 4.8 / 5 on Gumroad ✓ MIT licensed · Instant download ✓ No login required

Related Products

on Gumroad

You Might Also Need

More Free Tools

Enjoying this tool? Get more like it.

Weekly developer tool guides, productivity playbooks & AI tricks. Free. No spam.

DevPlaybook Pro 7 days free

Unlock AI-Powered Dev Tools

  • ⚡ AI Code Review, Doc Generator & SQL Builder
  • ⚡ All premium templates & early access
  • ⚡ Member discounts on Gumroad products
Start Free Trial →

$9/mo after trial · Cancel anytime

Want the full toolkit?

Get DevPlaybook Pro

Every template, guide, boilerplate, and automation script in one bundle. 13 premium products — grab them all at once and save big.

$79
$241 separately Save $162 (67% off)
Get DevPlaybook Pro — $79 →

MIT licensed · Instant download · No subscription

See what's included → Browse all deals →