Introduction
Get started with Pail, a highly configurable logging library for Node.js, Edge, and Browser
Last updated:
Pail is a powerful, flexible logging library for Node.js, Edge, and Browser environments. It gives you structured logging with pretty or JSON output, scoped loggers, built-in timers, and a pluggable processor/reporter architecture — all with full TypeScript support.
Features at a Glance
- Structured and pretty output — JSON, formatted console, simple text, and rotating file reporters
- Pluggable architecture — Custom processors and reporters to fit any workflow
- Scoped loggers and timers — Organize logs by context with built-in performance timing
- Interactive terminal UI — Progress bars, spinners, and interactive managers
- Production-ready — Log sampling, throttling, sensitive data redaction, and environment detection
- Wide events and framework middleware — Request-scoped logging for Express, Fastify, Hono, Elysia, SvelteKit, and Next.js
- Cross-platform — Works in Node.js, Bun, Edge runtimes, and browsers (ESM-only, Node.js ≥ 20.19)
Quick Start
npm i @visulima/pailimport { pail } from "@visulima/pail";
pail.success("Operation successful");
pail.debug("Hello", "from", "L59");
pail.pending("Write release notes for %s", "1.2.0");
pail.critical(new Error("Unable to acquire lock"));Core Concepts
Pail is built around three pillars: log levels following RFC 5424 (extended with trace), reporters that write to different destinations (console, files, JSON), and processors that enrich or transform log metadata before it reaches reporters.
Extensible by design
Every part of the pipeline — from message formatting to output — can be replaced or extended with your own processors and reporters. See the Processors guide to get started.
What's Next?
Installation
Set up Pail in your project
Basic Usage
Start logging with simple examples
Wide Events
Structured request-scoped logging
Framework Middleware
Auto-logging for Express, Fastify, Hono, and more
Configuration
Customize Pail to your needs
Comparison
How Pail compares to Pino, Winston, Consola
API Reference
Complete API documentation