Open source — Zero dependencies, full colors

logpaint

Configure once, log everywhere — a lightweight colored logger for Node.js with full TypeScript support.

$ npm i logpaint 📋
View on npm GitHub
node app.js

Built for developers, not infrastructure.

Most logging libraries are heavy, complex, and need config files just to get colored output. logpaint does it in one line.

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

Everything you need. Nothing you don't.

Built for developers who want beautiful logs without the bloat.

Zero Dependencies

Pure JavaScript using native Node.js APIs. No bloat, no supply chain risk. Just install and go.

TypeScript First

Full IntelliSense for custom levels. Generics ensure your custom log methods are fully typed.

🎨

Custom Levels

Add your own levels like http or db with custom colors, prefixes, and priorities.

🕘

Timestamps

Enable with a single flag. Each log line gets a clean YYYY-MM-DD HH:MM:SS prefix.

🚦

Level Filtering

Set minLevel to suppress low-priority logs. Show only warnings and errors in production.

Runtime Switching

Change log level on the fly with setLevel(). No restart needed. Perfect for debugging.

Simple API. Powerful output.

From zero-config to fully customized — in just a few lines.

typescript
import { createLogger } from 'logpaint';

const log = createLogger();

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

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

log.info('Request received');
log.success('Response sent in 42ms');
log.error('Connection timeout');

// Output:
// 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
typescript
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');
typescript
import { createLogger } from 'logpaint';

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

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

// Switch at runtime — no restart needed
log.setLevel('debug');
log.debug('Now visible!');
javascript
const { createLogger } = require('logpaint');

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

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

createLogger(config?)

Returns a logger with methods for every level — built-in and custom.

Config Options

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

LevelConfig Object

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

Built-in Levels

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

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 level at runtime

Available Colors

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