Installation

Install and set up Pail in your project

Last updated:

Installation

Pail is available as an npm package and can be installed using your preferred package manager.

Package Managers

npm

npm install @visulima/pail

yarn

yarn add @visulima/pail

pnpm

pnpm add @visulima/pail

Requirements

  • Node.js: 20.19 or higher, up to 25.x
  • TypeScript: Optional but recommended for full type safety

Environment Support

Pail supports:

  • Node.js (CommonJS and ESM)
  • Edge Runtime (Cloudflare Workers, Vercel Edge, etc.)
  • Browser (Modern browsers with ES module support)

Optional Dependencies

Some features require optional peer dependencies:

Redact Processor

For sensitive data redaction:

npm install @visulima/redact
# or
yarn add @visulima/redact
# or
pnpm add @visulima/redact

File Reporter

For file-based logging (server only):

npm install rotating-file-stream
# or
yarn add rotating-file-stream
# or
pnpm add rotating-file-stream

Import Methods

Server (Node.js)

import { pail, createPail } from "@visulima/pail";
// or
import { pail, createPail } from "@visulima/pail/server";

Browser

import { pail, createPail } from "@visulima/pail/browser";

Auto-detection

import { pail, createPail } from "@visulima/pail";

The default import automatically selects the appropriate implementation based on your environment.

TypeScript Support

Pail is written in TypeScript and provides full type definitions. No additional type packages are required.

import type { Pail, LoggerFunction } from "@visulima/pail";

Verify Installation

After installation, verify that Pail is working correctly:

import { pail } from "@visulima/pail";

pail.info("Pail is installed and working!");

If you see the log message, installation was successful!

Next Steps

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