// readme

debug-fabulous

Lazy-evaluation wrapper for debug β€” skip string building entirely when logging is disabled.

Why?

The debug module always evaluates its arguments, even when the namespace is disabled. If you’re building expensive strings β€” JSON serialization, large object inspection, string concatenation β€” you pay the cost even when nobody’s reading the output.

debug-fabulous wraps debug with lazy evaluation. Pass a function instead of a string, and it only runs when the namespace is actually enabled. When logging is off, the call is a no-op β€” no string allocation, no concatenation, no wasted cycles.

This matters at scale. Libraries like gulp-sourcemaps (700K+ weekly downloads) use debug-fabulous as a transitive dependency for exactly this reason.

Install

npm install debug-fabulous

Quick Start

const debugFab = require('debug-fabulous');
const debug = debugFab()('my-app');

// Lazy evaluation β€” the function only runs if 'my-app' is enabled
debug(() => 'user object: ' + JSON.stringify(largeUserObject));

// Plain strings still work
debug('server…