Registry / devops / winston-console-formatter

winston-console-formatter

JSON →
library1.0.0-beta.3jsnpmunverified

winston-console-formatter is a Winston transport formatter that outputs logs in a YAML-like style with colored levels, type-colored meta objects, and optional stack traces. Version 1.0.0-beta.3, last updated in 2016. No release cadence; appears to be a beta package with no further updates. Key differentiators: provides configurable colors, types via yamlify-object, and supports label, from, and stack props for enriched log lines. Designed specifically for Winston 2.x (old Logger API).

npm install winston-console-formatter
INSTALL
IMPORT
SIG · WINSTON-CONSOLE-FO
W
winston-console-formatter
devopsjavascriptv1.0.0-beta.3
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
const wcf = require('winston-console-formatter');
import wcf from 'winston-console-formatter';
CJS only; no ESM support. No named exports.
wcf()
const { formatter, timestamp } = wcf(options);
const formatter = wcf();
Returns an object with formatter and timestamp. The formatter is a function passed to winston transport.
config
const config = require('winston-console-formatter').config;
Not documented but exists in package. Use wcf() directly.

Creates a Winston logger with YAML-like console output using winston-console-formatter.

const winston = require('winston'); const wcf = require('winston-console-formatter'); const logger = new winston.Logger({ level: 'silly', }); const { formatter, timestamp } = wcf(); logger.add(winston.transports.Console, { formatter, timestamp, }); logger.log('error', 'message'); logger.log('warn', 'message'); logger.log('info', 'message'); logger.log('verbose', 'message'); logger.log('debug', 'message'); logger.log('silly', 'message');
Debug
Known issues
breakingPackage uses Winston 2.x Logger API (new winston.Logger). Not compatible with Winston 3.x where Logger is a class but transport format is different.
fix
Use winston@2.x. For winston 3.x, consider winston.format.combine with custom format.
affects: >=1.0.0-beta.3
deprecatedPackage is in beta and has not been updated since 2016. No longer actively maintained.
fix
Consider alternatives like winston's built-in console transport or fork the package.
affects: >=1.0.0-beta.1
gotchaThe function wcf() returns an object with formatter and timestamp, not just a formatter. Many users mistakenly use wcf() as a formatter directly.
fix
Use destructuring: const { formatter, timestamp } = wcf();
affects: >=1.0.0-beta.1
gotchaDefault colors depend on cli-color, which may have compatibility issues with newer Node versions.
fix
Provide custom colors or set colors: false.
affects: >=1.0.0-beta.1
gotchaPackage has no TypeScript types. May cause errors in TS strict mode.
fix
Create a custom .d.ts file or use with @ts-ignore.
affects: >=1.0.0-beta.1
Errors
Common errors & fixes
Cannot find module 'winston-console-formatter'
Package not installed or not in node_modules.
fix
Run npm install winston-console-formatter
TypeError: wcf is not a function
Using ES6 import syntax or incorrect require path.
fix
Use const wcf = require('winston-console-formatter');
winston.Logger is not a constructor
Using Winston 3.x where Logger is a class but format is different.
fix
Install winston@2.x or use winston.format.combine with custom format for Winston 3.
Cannot read property 'Console' of undefined
Winston not imported or transport not available.
fix
Ensure require('winston') is called before using winston.transports.Console.
Upgrade
Version history
1.0.0-beta.3latest on npm
Audit
Dependencies
winstonrequiredpeer dependency; formatter is designed for winston 2.x
cli-coloroptionalused for default level colors
yamlify-objectoptionalused for meta object YAML-like formatting
yamlify-object-colorsoptionalprovides default colors for yamlify-object
Agent activity
6 hits · last 30 days
node
6
Resources
winston-console-formatter — npm install winston-console-formatter · libregistry