npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

logpaint

v1.0.1

Published

Configure once, log everywhere — a lightweight colored logger for Node.js

Readme

logpaint

Configure once, log everywhere.

A lightweight, zero-dependency colored logger for Node.js with full TypeScript support. Custom log levels, timestamps, level filtering, and runtime switching — all in one tiny package.

npm version npm downloads license node

Website · npm · Report a Bug


Table of Contents


Why logpaint?

Most logging libraries are designed for production-grade infrastructure — they're heavy, complex, and need configuration files, transports, and plugins just to get colored output.

logpaint does one thing well: it gives your Node.js app beautiful, colored console logs with a single function call. No config files. No transports. No dependencies. Just install, call createLogger(), and your terminal comes to life.

| Feature | logpaint | chalk | winston | pino | |---|---|---|---|---| | Zero dependencies | ✅ | ✅ | ❌ | ❌ | | Built-in log levels | ✅ | ❌ | ✅ | ✅ | | Custom levels (typed) | ✅ | ❌ | ✅ | ❌ | | Level filtering | ✅ | ❌ | ✅ | ✅ | | Runtime level switching | ✅ | ❌ | ✅ | ❌ | | ESM + CJS | ✅ | ✅ | ✅ | ✅ | | TypeScript generics | ✅ | ✅ | ❌ | ✅ |


Features

  • Zero runtime dependencies — pure Node.js, nothing to audit or update
  • 5 built-in levelsdebug, info, success, warn, error — ready out of the box
  • Custom log levels — add http, db, query, or anything else, fully typed in TypeScript
  • Timestamps — enable with a single flag (YYYY-MM-DD HH:MM:SS format)
  • Level filtering — set minLevel to suppress noise in production
  • Runtime switching — change log level on the fly with setLevel(), no restart needed
  • TypeScript generics — custom level methods get full IntelliSense autocomplete
  • Dual CJS + ESM — works with import and require() out of the box

Installation

# npm
npm install logpaint

# yarn
yarn add logpaint

# pnpm
pnpm add logpaint

Requirements: Node.js ≥ 14


Quick Start

import { createLogger } from 'logpaint';

const log = createLogger();

log.info('Server started on port 3000');
log.success('Database connected');
log.warn('Deprecated API endpoint used');
log.error('Failed to read config file');
log.debug('Request payload: { id: 42 }');

Output (colors rendered in your terminal):

[INFO]    Server started on port 3000
[SUCCESS] Database connected
[WARN]    Deprecated API endpoint used
[ERROR]   Failed to read config file
[DEBUG]   Request payload: { id: 42 }

With Timestamps

Pass timestamp: true to prepend a YYYY-MM-DD HH:MM:SS timestamp to every log line.

import { createLogger } from 'logpaint';

const log = createLogger({ timestamp: true });

log.info('Request received');
log.success('Response sent in 42ms');
log.error('Connection timeout');
2026-02-22 10:30:45 [INFO]    Request received
2026-02-22 10:30:45 [SUCCESS] Response sent in 42ms
2026-02-22 10:30:45 [ERROR]   Connection timeout

Log Level Filtering

Set minLevel to suppress all logs below a certain priority. Useful for silencing debug/info noise in production.

import { createLogger } from 'logpaint';

const log = createLogger({ minLevel: 'warn' });

log.debug('Hidden');   // suppressed — priority 0 < 2
log.info('Hidden');    // suppressed — priority 1 < 2
log.warn('Visible');   // shown — priority 2 ≥ 2
log.error('Visible');  // shown — priority 3 ≥ 2

Default Priority Table

| Level | Color | Priority | |-----------|---------|----------| | debug | magenta | 0 | | info | cyan | 1 | | success | green | 1 | | warn | yellow | 2 | | error | red | 3 |


Custom Levels

Add your own log levels with custom colors, prefixes, and priorities. They're fully typed — TypeScript will give you autocomplete on log.http(), log.db(), etc.

import { createLogger } from 'logpaint';

const log = createLogger({
  timestamp: true,
  levels: {
    http: { color: 'brightBlue' },
    db:   { color: 'brightMagenta', prefix: 'DATABASE' },
  },
});

log.http('GET /api/users 200 OK');
log.db('Query executed in 12ms');
log.info('Default levels still work');
2026-02-22 10:30:45 [HTTP]     GET /api/users 200 OK
2026-02-22 10:30:45 [DATABASE] Query executed in 12ms
2026-02-22 10:30:45 [INFO]     Default levels still work

You can also pass a color name directly as a shorthand:

import { createLogger } from 'logpaint';

const log = createLogger({
  levels: {
    http: 'brightBlue',
    db:   'brightMagenta',
  },
});

Runtime Level Switching

Change the minimum log level at any point during execution using setLevel(). No process restart needed — useful for toggling verbose output in long-running servers.

import { createLogger } from 'logpaint';

const log = createLogger();

log.info('Visible');        // shown

log.setLevel('error');      // from now on, only show errors

log.info('Hidden');         // suppressed
log.error('Visible');       // shown

CommonJS Usage

logpaint ships both ESM and CJS builds. Use require() if you're not using ES modules.

const { createLogger } = require('logpaint');

const log = createLogger({ timestamp: true });

log.info('Works with require() too');
log.success('CJS + ESM — your choice');

Full working examples: Node.js · NestJS


Available Colors

Use any of these color names in color fields for built-in or custom levels.

| Basic | Bright | |--------------|---------------------| | black | brightBlack | | red | brightRed | | green | brightGreen | | yellow | brightYellow | | blue | brightBlue | | magenta | brightMagenta | | cyan | brightCyan | | white | brightWhite |


API Reference

createLogger(config?)

Creates and returns a logger instance. All built-in level methods and any custom level methods are available on the returned object.

Config Options

| Option | Type | Default | Description | |-------------|--------------------------------------------|-------------|------------------------------------------| | timestamp | boolean | false | Prepend YYYY-MM-DD HH:MM:SS to each log | | minLevel | string | undefined | Minimum priority level to display | | levels | Record<string, ANSIColor \| LevelConfig> | undefined | Custom levels to add alongside built-ins |

LevelConfig

| Field | Type | Default | Description | |------------|-------------|------------------------|--------------------------------------| | color | ANSIColor | required | ANSI color name for this level | | prefix | string | level name (uppercase) | Label shown in brackets, e.g. [DB] | | priority | number | 1 | Priority used for minLevel filtering |

Logger Methods

| Method | Description | |-----------------------|------------------------------------------| | log.debug(...args) | Log at debug level (priority 0) | | log.info(...args) | Log at info level (priority 1) | | log.success(...args)| Log at success level (priority 1) | | log.warn(...args) | Log at warn level (priority 2) | | log.error(...args) | Log at error level (priority 3) | | log.setLevel(level) | Change minimum log level at runtime |


Contributing

Contributions, bug reports, and feature requests are welcome.

  1. Fork the repository
  2. Create a branch: git checkout -b feat/your-feature
  3. Make your changes and run npm test
  4. Open a pull request

Please open an issue first for large changes so we can discuss the approach.


License

MIT © Sounak Das