Registry / devops / winston-console-format

winston-console-format

JSON →
library1.0.8jsnpmunverified

A Winston@3 console formatter that uses util.inspect() to produce detailed, colorized log output ideal for debugging. Version 1.0.8 is the latest stable release; the package is mature with infrequent updates. It supports ESM and CJS, ships TypeScript types, and is designed specifically for Winston 3.x. Key differentiator: uses Node's util.inspect() for deep object inspection with configurable depth, colors, and formatting options, making it more suitable for debugging complex objects than built-in Winston formatters.

npm install winston-console-format
INSTALL
IMPORT
SIG · WINSTON-CONSOLE-FO
W
winston-console-format
devopsjavascriptv1.0.8
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.

consoleFormat
import { consoleFormat } from 'winston-console-format'
import consoleFormat from 'winston-console-format'
Named export, not default. Both ESM and CJS work.
consoleFormat (CommonJS)
const { consoleFormat } = require('winston-console-format')
const consoleFormat = require('winston-console-format')
Destructure the named export. Direct require returns the module, not the formatter.
ConsoleFormatOptions
import type { ConsoleFormatOptions } from 'winston-console-format'
Type import; only available in TypeScript.

Creates a Winston logger with the consoleFormat formatter, using util.inspect options and meta stripping for debugging.

import { createLogger, format, transports } from 'winston'; import { consoleFormat } from 'winston-console-format'; const logger = createLogger({ level: 'silly', format: format.combine( format.timestamp(), format.ms(), format.errors({ stack: true }), format.splat(), format.json() ), transports: [ new transports.Console({ format: format.combine( format.colorize({ all: true }), format.padLevels(), consoleFormat({ showMeta: true, metaStrip: ['timestamp', 'service'], inspectOptions: { depth: Infinity, colors: true, maxArrayLength: Infinity, breakLength: 120, compact: Infinity, }, }) ), }), ], }); logger.info('Hello from winston-console-format!', { foo: 'bar' });
Debug
Known issues
gotchaconsoleFormat must be passed inside format.combine() in a Console transport; it does not work as a top-level logger format.
fix
Always use format.combine() with other formatters (colorize, padLevels) before consoleFormat.
affects: >=1.0.0
gotchaIf you do not call format.colorize({ all: true }), colors from inspectOptions.colors may not display correctly in the console.
fix
Ensure format.colorize({ all: true }) is included before consoleFormat in the combine.
affects: >=1.0.0
deprecatedThe package has not been updated in over 5 years and uses deprecated dependencies (e.g., winston@3 is still compatible, but no new features).
fix
Consider alternative formatters like winston-logstash or custom formats if active maintenance is needed.
affects: >=1.0.0
gotchaSetting inspectOptions.depth to Infinity may cause huge output for circular references or very deep objects.
fix
Use a finite depth (e.g., 5) or ensure your objects don't have recusive references.
affects: >=1.0.0
Errors
Common errors & fixes
Cannot find module 'winston-console-format'
Package not installed or import path wrong.
fix
Run: npm install winston-console-format
TypeError: winston.format.combine(...) is not a function
Forget to import format from winston, or misspelled combine.
fix
Use: import { format } from 'winston'; then format.combine(...)
consoleFormat is not a function
Default import used instead of named import.
fix
Use named import: import { consoleFormat } from 'winston-console-format'
Upgrade
Version history
1.0.8latest on npm
Audit
Dependencies
winstonrequiredPeer dependency required; the formatter must be composed with winston's format.combine() and used in transports.
Agent activity
8 hits · last 30 days
node
8
Resources
winston-console-format — npm install winston-console-format · libregistry