pino
Super-fast, low-overhead JSON logger for Node.js — structured logs with transports, redaction, and child loggers.
pino
Node.jsSuper-fast, low-overhead JSON logger for Node.js — structured logs with transports, redaction, and child loggers.
Fit
Bundle (gzip)
3.4 kB
8.5 kB raw
Install size includes transitive dependencies. Bundle size is gzipped browser payload.
Freshness
The Problem
console.log produces unstructured output that's hard to search and filter in log aggregation tools. Most logging libraries serialize objects synchronously, adding latency to every request.
What It Does
Pino serializes logs to JSON asynchronously via a worker thread, minimizing the impact on your hot path. Every log entry includes a timestamp, level, and any metadata you pass. Child loggers propagate context (like request ID) to all logs within a scope without repeating it.
Installation
npm install pino pino-prettyUsage Example
import pino from 'pino';
const logger = pino({
level: process.env.LOG_LEVEL ?? 'info',
redact: ['req.headers.authorization', 'user.password'],
});
// Child logger with request context
const reqLogger = logger.child({ requestId: 'abc-123', method: 'GET', path: '/users' });
reqLogger.info('Fetching users');
reqLogger.error({ err }, 'Database query failed');Related packages
Role and attribute based access control (RBAC + ABAC) for Node.js with a fluent, readable API.
bcryptjsNode.jsPure JavaScript bcrypt password hashing — no native dependencies, same API as bcrypt, works anywhere Node.js runs.
bullmqNode.jsPremium message queue and job scheduler for Node.js backed by Redis — reliable background job processing with retries, priorities, and rate limiting.
casbinNode.jsA powerful authorization library that supports RBAC, ABAC, ACL and more via configurable policy models.
dotenvNode.jsLoad environment variables from a `.env` file into `process.env` — the standard way to manage configuration in Node.js apps.