mrkeyoor.com_
Sat 08 Aug 21:58 UTC
npmCLI & Toolingupdated 08 Aug 2026

fancy-log

fancy-log is a CommonJS console wrapper from the Gulp project. Every call writes a local-time `[HH:mm:ss]` prefix, then delegates its arguments to Node's Console formatting. The default function plus info and dir write to stdout; warn and error put their message on stderr. When terminal color support is detected, the timestamp uses Node's util.inspect date style. That is the complete product: it adds readable timestamps to build-script output, not structured fields, transports, filtering, persistence, or application logging policy.

Verdict

Good at one narrow job: timestamping human-readable Gulp and build-script output. Do not mistake it for an application logger; once logs need structure, filtering, test injection, or transport, use a purpose-built package.

API stability5/5Version 2.0.0 exports one callable function with info, dir, warn, and error properties, all mirroring familiar Console methods. The changelog records only two breaking changes in that major: dropping Node versions below 10.13 and styling timestamps through util.inspect. The surface is so small that existing CommonJS call sites have little room to break unless runtime support changes again.
Docs3/5The README is short but accurately documents every exported method, output format, stream-like Console behavior, terminal color detection, and util.inspect date-color customization. It omits operational details visible in index.js: stdout versus stderr routing per method, separate writes for prefix and message, local-time semantics, precedence when both color flags appear, and the lack of stream injection.
Maintenance2/5The latest npm release, 2.0.0, was published on 2022-01-07, and GitHub reports the last push on 2023-12-29. The repository is not archived and currently reports zero open issues and PRs, which is healthy for a tiny finished utility, but there has been no release adapting package metadata for current ESM and TypeScript expectations.
Ecosystem4/5The npm downloads endpoint reports 3,841,741 downloads in its last-week window, and the package sits under the Gulp organization, so it is common in build-tool dependency trees. GitHub reports 123 stars, showing that direct interest is modest. Its interoperability is broad for CommonJS console code but intentionally stops before the plugin and transport ecosystems of Pino or Winston.

Use it if

  • You maintain a Gulpfile or small Node build script and want its existing output to match Gulp's timestamped console style
  • You want console.log-style placeholders and object formatting with no logger configuration
  • You need warn and error output routed to stderr while ordinary messages stay on stdout
  • You need a simple --color and --no-color convention for build output
Skip it if

Setup reality

Installation is one command, npm install fancy-log, with no peer dependencies, native build, credentials, or config file. Version 2.0.0 requires Node 10.13 or newer and exposes a CommonJS function, so traditional Gulpfiles use const log = require('fancy-log'). In a native ESM file, Node can usually synthesize a default import from the CommonJS export, but the package publishes no exports map or TypeScript declarations. The behavior is deliberately global and fixed. On module load it creates a Node Console bound to process.stdout and process.stderr; there is no constructor for injecting a file, test stream, or remote destination. Each call writes the timestamp separately before Console writes the message, so output from concurrent writers can interleave between prefix and content. log and info use stdout; warn and error write their prefixes and messages to stderr; dir uses stdout. Color detection comes from color-support unless process.argv contains --color or --no-color, with --no-color checked first. Changing util.inspect.styles.date changes timestamp color for the whole process and can also affect other date inspection. The timestamp comes from Date.toLocaleTimeString('en', { hour12: false }), so it is local wall-clock time with seconds only. There is no setting for ISO time, UTC, milliseconds, labels, or suppressing the prefix. For testable or machine-ingested logs, wrap it behind your own function or choose a logger with stream injection and structured records.

Patterns

Write a timestamped messagelog-message

const log = require('fancy-log');

log('Compiling templates');
// [16:27:02] Compiling templates

The timestamp uses the machine's local time and includes no date, time zone, or milliseconds.

Use Console-style placeholdersformat-values

const log = require('fancy-log');

log('Built %d files in %d ms', fileCount, elapsedMs);
log('Manifest: %j', manifest);

Formatting follows Node Console behavior. Circular data cannot be rendered through the %j JSON placeholder.

Write an informational message to stdoutlog-info

log.info('Watching', sourceGlob);

info is not a filterable severity level here. It always emits and uses stdout, just like the default log function.

Write a warning to stderrlog-warning

log.warn('Source map is missing for', filename);

warn writes both its timestamp prefix and formatted message to stderr. The package does not count or suppress repeated warnings.

Write an error to stderrlog-error

try {
  await build();
} catch (error) {
  log.error('Build failed:', error);
  process.exitCode = 1;
}

Logging does not set a failing exit status or throw. Set process.exitCode or propagate the error yourself.

Inspect an object with log.dirinspect-object

log.dir({
  task: 'styles',
  inputs: ['src/main.css'],
  cached: false,
});

log.dir delegates to Console.dir and writes to stdout. fancy-log exposes no parameter for changing inspect depth or colors per call.

Disable timestamp color in CI outputdisable-color

node build.js --no-color

The package scans process.argv for the literal --no-color flag on every call. This affects the timestamp, not ANSI codes produced by your message arguments.

Force timestamp colorforce-color

node build.js --color

If both --color and --no-color are present, --no-color wins because it is checked first.

Change the timestamp's inspect colorchange-timestamp-color

const util = require('util');
const log = require('fancy-log');

util.inspect.styles.date = 'red';
log('Timestamp is red when color is enabled');

util.inspect.styles is process-wide. This can change how other code styles Date values, not only fancy-log timestamps.

Report progress from a Gulp taskuse-in-gulp-task

const { src, dest } = require('gulp');
const log = require('fancy-log');

function copyAssets() {
  log('Copying assets');
  return src('src/assets/**/*').pipe(dest('dist/assets'));
}

exports.assets = copyAssets;

Return the stream so Gulp knows when the task finishes. fancy-log only reports progress and does not participate in task completion.

Log a build-stream error without hiding itreport-stream-error

function reportError(error) {
  log.error(error.stack || error.message);
  this.emit('end');
}

stream.on('error', reportError);

Emitting end is appropriate only for watch workflows that should continue. In CI, rethrow or fail the task so an error does not produce a successful build.

Use the CommonJS export from an ESM fileimport-from-esm

import { createRequire } from 'node:module';

const require = createRequire(import.meta.url);
const log = require('fancy-log');

log('Running from ESM');

Version 2.0.0 publishes only a CommonJS main and no exports map. createRequire avoids depending on synthetic default-import behavior.

Alternatives

PackageRegistryPick it when
pinonpmProduction Node services that need fast structured JSON, child loggers, redaction, and transports
winstonnpmApplications that need configurable levels, formats, and multiple output destinations
consolanpmDeveloper-facing CLIs that want polished output, log levels, prompts, and reporter customization
debugnpmLibraries that want namespace-based diagnostic output enabled through an environment variable