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/pail
import { 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?

Support

Contribute to our work and keep us going

Community is the heart of open source. The success of our packages wouldn't be possible without the incredible contributions of users, testers, and developers who collaborate with us every day.Want to get involved? Here are some tips on how you can make a meaningful impact on our open source projects.

Ready to help us out?

Be sure to check out the package's contribution guidelines first. They'll walk you through the process on how to properly submit an issue or pull request to our repositories.

Submit a pull request

Found something to improve? Fork the repo, make your changes, and open a PR. We review every contribution and provide feedback to help you get merged.

Good first issues

Simple issues suited for people new to open source development, and often a good place to start working on a package.
View good first issues