Registry / devops / winston-format-debug

winston-format-debug

JSON →
library1.4.0jsnpmunverified

A debug formatter for Winston 3.x that provides human-readable, colorized console output similar to Bunyan's debug stream. Current stable version is 1.4.0, released under semantic-release with automated updates. It supports syslog levels, custom colors (including hex), process name detection, PID display, configurable indentation, stack trace simplification via basePath, and property skipping. Released monthly on average. Distinguishes itself by offering fine-grained control over colorization (prefix, message, values), terminal width limits, and maximum exception lines, making it ideal for development debugging.

npm install winston-format-debug
INSTALL
IMPORT
SIG · WINSTON-FORMAT-DEB
W
winston-format-debug
devopsjavascriptv1.4.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.

default
import debugFormat from 'winston-format-debug';
const debugFormat = require('winston-format-debug').default;
Package uses ESM default export; in CommonJS, you must use .default or use require('winston-format-debug').default.
default
const debugFormat = require('winston-format-debug');
const debugFormat = require('winston-format-debug').default;
In CommonJS, the package exports the format function directly. Do not add .default.
default
import debugFormat from 'winston-format-debug';
import { debugFormat } from 'winston-format-debug';
It is a default export, not a named export.

Creates a Winston logger with debugFormat to produce color-coded, human-readable console output, including extra metadata.

import winston from 'winston'; import debugFormat from 'winston-format-debug'; const logger = winston.createLogger({ levels: winston.config.syslog.levels, level: 'info', transports: [ new winston.transports.Console({ format: winston.format.combine( debugFormat({ levels: winston.config.syslog.levels, colors: winston.config.syslog.colors, showPID: true, basePath: process.cwd(), indent: 2, }) ), }), ], }); logger.info('Hello world', { extra: 'value' });
Debug
Known issues
gotchaWhen using CommonJS require, you must not add .default; the package exports the format function directly.
fix
Use const debugFormat = require('winston-format-debug');
affects: *
gotchaThe 'colors' option is required for colorization to work; if not set, no colors will be applied.
fix
Explicitly pass colors from winston.config or provide custom colors object.
affects: *
gotchaSetting 'colors' to false disables all colorization, overriding colorizePrefix, colorizeMessage, and colorizeValues.
fix
To disable colors, set colors: false. To customize, provide a colors object and set individual colorize* options.
affects: *
deprecatedThe 'processName' option may be deprecated in future versions; auto-detection from process.argv is preferred.
fix
Omit processName or set to empty string to hide it.
affects: >=1.0.0
gotchaThe 'skip' option does not affect 'level', 'message', '@timestamp', or 'name' keys — they are always skipped.
fix
Do not include those keys in skip; they are already ignored.
affects: *
Errors
Common errors & fixes
TypeError: debugFormat is not a function
Using named import instead of default import in ESM, or using .default in CommonJS.
fix
Use import debugFormat from 'winston-format-debug' (ESM) or const debugFormat = require('winston-format-debug') (CJS).
Error: Cannot find module 'winston-format-debug'
Missing dependency install, or the package is not in node_modules.
fix
Run npm install winston-format-debug
winston.format.combine is not a function
Attempting to use debugFormat without wrapping it in winston.format.combine().
fix
Wrap debugFormat() inside winston.format.combine(), e.g., format: winston.format.combine(debugFormat()).
Unhandled error: TypeError: Cannot read properties of undefined (reading 'levels')
Not providing a 'levels' option in debugFormat when using custom Winston levels.
fix
Pass levels: winston.config.syslog.levels (or custom levels) to debugFormat.
Upgrade
Version history
1.4.0latest on npm
Audit
Dependencies
winstonrequiredPeer dependency: this is a format plugin for Winston 3.x
Agent activity
6 hits · last 30 days
node
6
Resources
winston-format-debug — npm install winston-format-debug · libregistry