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.
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'.
Related Products
on GumroadDevPlaybook Interview Vault
210+ real technical interview questions with model answers, asked at Google, Meta, Amazon, Microsoft, Stripe, and Shopify. Covers Frontend (55), Backend (55), System Design (50), and DSA (50). Available in English and Traditional Chinese.
Buy on Gumroad →TypeScript Quick Reference Toolkit
5 practical reference files for TypeScript developers: cheatsheet, TS vs JS comparison, 20 utility types with real examples, tsconfig best practices template, and 15 common mistakes guide. Print it. Keep it on your desk.
Buy on Gumroad →Developer Interview Vault
210 technical interview questions with model answers, key points, and follow-up questions. Covers Frontend, Backend, System Design, and DSA — bilingual English + Traditional Chinese (ZH-TW). PWYW from $29.
Buy on Gumroad →You Might Also Need
SQL to TypeScript Types
Convert SQL CREATE TABLE statements to TypeScript interfaces and Zod schemas. Maps SQL column types to TypeScript with nullability.
Open free tool →
TypeScript Discriminated Union Builder
Build TypeScript discriminated unions visually. Add variants with fields and get type-safe switch statements, type guards, and exhaustive checking code.
Open free tool →
TypeScript Playground
Write TypeScript and instantly see compiled JavaScript output. Strip interfaces, types, generics, enums, and decorators. Share code via URL. No install needed.
Open free tool →
More Free Tools
Related Articles
Deno 2.0 vs Node.js: Should You Switch in 2026?
Honest comparison of Deno 2.0 vs Node.js in 2026. npm compatibility, JSR registry, performance benchmarks, security model, and who should (and shouldn't) migrate.
Deno 2.0 Complete Guide 2026: Setup, npm Support, Std Library & Deno Deploy
The complete hands-on guide to Deno 2.0 for 2026. Learn installation, npm package support, the standard library, TypeScript-first development, and deploying to Deno Deploy with real code examples.
Deno 2.0 vs Node.js 2026: Runtime Comparison Guide
Compare Deno 2.0 and Node.js in 2026: npm compatibility, performance benchmarks, security model, and when to choose each runtime for your next project.
Deno 2.0 vs Node.js: A Developer's Decision Guide for 2026
Should you choose Deno 2.0 or Node.js for your next backend project? This decision guide covers npm compatibility, performance, security model, TypeScript support, deployment options, and gives you a clear recommendation based on your project type.
Deno 2 vs Node.js vs Bun: JavaScript Runtime Comparison 2026
A comprehensive 2026 comparison of Deno 2, Node.js 22, and Bun. Benchmarks, security models, npm compatibility, TypeScript support, and when to use each runtime.
Enjoying this tool? Get more like it.
Weekly developer tool guides, productivity playbooks & AI tricks. Free. No spam.
Unlock AI-Powered Dev Tools
- ⚡ AI Code Review, Doc Generator & SQL Builder
- ⚡ All premium templates & early access
- ⚡ Member discounts on Gumroad products
$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.
MIT licensed · Instant download · No subscription
See what's included → Browse all deals →