Registry / devops / nightingale-ansi-formatter

nightingale-ansi-formatter

JSON →
library18.1.0jsnpmunverified

ANSI formatter for the Nightingale logging library (v18.1.0). Converts structured log records into colorized, human-readable terminal output using ANSI escape codes. Part of the monorepo maintained by Christophe Hurpeau, released on npm with Node >=22.18.0 requirement. Ships TypeScript types. Compared to other formatters like pino-pretty or winston's cli format, this is tightly coupled to Nightingale's record structure and configuration system.

npm install nightingale-ansi-formatter
INSTALL
IMPORT
SIG · NIGHTINGALE-ANSI-F
N
nightingale-ansi-formatter
devopsjavascriptv18.1.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

nightingaleAnsiFormatter
import { nightingaleAnsiFormatter } from 'nightingale-ansi-formatter'
const nightingaleAnsiFormatter = require('nightingale-ansi-formatter')
ESM-only package due to Node >=22.18.0 requirement
NightingaleAnsiFormatter
import { NightingaleAnsiFormatter } from 'nightingale-ansi-formatter'
TypeScript type export for class instance
Config
import type { Config } from 'nightingale-ansi-formatter'
Type-only import for the formatter configuration interface if needed

Configures Nightingale to use the ANSI formatter for console output, showing colorized log levels and messages.

import { nightingaleAnsiFormatter } from 'nightingale-ansi-formatter'; import { configure, createConsoleAppender, createLogger } from 'nightingale'; configure([ createConsoleAppender(nightingaleAnsiFormatter), ]); const logger = createLogger('my-app'); logger.info('Hello %s', 'world!'); logger.warn('This is a warning'); logger.error('Something went wrong');
Debug
Known issues
breakingNode.js >=22.18.0 is required; older Node versions will fail to import.
fix
Upgrade Node.js to v22.18.0 or later, or pin to an older major version of the package.
affects: >=18.1.0
breakingThe package is ESM-only; CommonJS require() will throw an error.
fix
Use dynamic import() in CJS projects, or switch to ESM.
affects: >=18.1.0
deprecatedThe default export was removed in v18; use named export 'nightingaleAnsiFormatter' instead.
fix
Replace default import with named import.
affects: >=18.0.0
gotchaThe formatter expects a Nightingale log record; passing raw objects will cause errors.
fix
Ensure logs are generated via Nightingale createLogger, not manually.
affects: >=1.0.0
Errors
Common errors & fixes
Error [ERR_REQUIRE_ESM]: require() of ES Module not supported.
Using require() on an ESM-only package.
fix
Use import syntax or dynamic import() instead of require().
TypeError: nightingaleAnsiFormatter is not a function
Using a default import instead of a named import.
fix
Use `import { nightingaleAnsiFormatter } from 'nightingale-ansi-formatter'`.
Error: Cannot find module 'color-name'
Missing peer dependency 'color-name'.
fix
Install color-name: `npm install color-name`.
Upgrade
Version history
18.1.0latest on npm
Audit
Dependencies
nightingalerequiredpeer dependency for Nightingale logger types and config
color-namerequiredused to resolve ANSI color names to codes
Agent activity
2 hits · last 30 days
node
2
Resources
nightingale-ansi-formatter — npm install nightingale-ansi-formatter · libregistry