npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

winston-pretty-format

v1.0.3

Published

A clean, human-friendly console formatter for Winston — with color support, stack trace folding, and structured metadata inspection.

Downloads

14

Readme

CI GitHub license

npm version Gitpod Ready-to-Code install size npm bundle size npm downloads

winston-pretty-format

A clean, human-friendly console formatter for Winston 3+, designed for modern Node.js projects.

Supports colorized output, structured metadata, stack trace folding, and consistent box-style layout.

winston-pretty-format

If you find this package useful for your projects, please consider supporting me by Patreon, KO-FI or Paypal. It's a great way to help me maintain and improve this tool in the future. Your support is truly appreciated!

KO-FI Paypal Patreon


✨ Features

✅ Elegant, compact output layout (inspired by professional CLI tools)
✅ ANSI color support with automatic reset — no bleed
✅ Shows error stacks and structured meta in a readable tree format
✅ Configurable options for timestamps, metadata, and color
✅ Fully written in TypeScript, zero dependencies beyond Winston & colors
✅ Safe and fast — no mutation, no unhandled edge cases


📦 Installation

npm install winston-pretty-format
# or
pnpm add winston-pretty-format
# or
yarn add winston-pretty-format

🚀 Usage

Basic example

import winston from 'winston';
import { prettyFormat } from 'winston-pretty-format';

const logger = winston.createLogger({
    level: 'debug',
    format: winston.format.combine(
        winston.format.timestamp({ format: 'YYYY-MM-DD HH:mm:ss' }),
        winston.format.colorize({ all: true }),
        padLevels(),
        prettyFormat({
            showMeta: true,
            showTimestamp: true,
            showColor: true,
            metaStrip: ['timestamp'],
            inspectOptions: {
                colors: true,
                depth: 9,
                maxArrayLength: 30_000,
                breakLength: 120,
                compact
            }
        })
    ),
    transports: [new winston.transports.Console()]
});

logger.silly('🧠 Silly mode activated — testing deep internals...');
logger.debug('🔍 Debugging login flow — validating token cache...');
logger.verbose('🗒️ Verbose trace — response headers captured for inspection.');
logger.info('✨ Application started successfully. Ready for incoming requests.');
logger.warn('⚠️ High memory usage detected (512MB / 1024MB). Consider optimizing.', {
    requestId: '8a92f1',
    userId: 'U1029',
    ip: '10.12.0.21'
});
logger.error('🔥 Failed to connect to database after 3 retries.', {
    StatusCode: '-1',
    StatusMessage: 'Connection timed out after 5s'
});
throw new Error('❌ Null payload received from auth microservice.');

Output example:

2025-10-17 17:22:13 silly   ▪ 🧠 Silly mode activated — testing deep internals...
2025-10-17 17:22:13 debug   ▪ 🔍 Debugging login flow — validating token cache...
2025-10-17 17:22:13 verbose ▪ 🗒️ Verbose trace — response headers captured for inspection.
2025-10-17 17:22:13 info    ▪ ✨ Application started successfully. Ready for incoming requests.
2025-10-17 17:22:13 warn    ┏ ⚠️ High memory usage detected (512MB / 1024MB). Consider optimizing.
2025-10-17 17:22:13 warn    ┃ [1] {
2025-10-17 17:22:13 warn    ┃ [2]   requestId: '8a92f1',
2025-10-17 17:22:13 warn    ┃ [3]   userId: 'U1029',
2025-10-17 17:22:13 warn    ┃ [4]   ip: '10.12.0.21'
2025-10-17 17:22:13 warn    ┗ [5] }
2025-10-17 17:22:13 error   ┏ 🔥 Failed to connect to database after 3 retries.
2025-10-17 17:22:13 error   ┃ [1] {
2025-10-17 17:22:13 error   ┃ [2]   StatusCode: '-1',
2025-10-17 17:22:13 error   ┃ [3]   StatusMessage: 'Connection timed out after 5s'
2025-10-17 17:22:13 error   ┗ [4] }
2025-10-17 17:22:13 error   ┏ ❌ Null payload received from auth microservice.
2025-10-17 17:22:13 error   ┃ [ 1] Error: Null payload received from auth microservice.
2025-10-17 17:22:13 error   ┃ [ 2]     at main (/opt/services/app-auth/src/index.ts:32:11)
2025-10-17 17:22:13 error   ┃ [ 3]     at CronJob.<anonymous> (/opt/services/app-auth/src/index.ts:101:19)
2025-10-17 17:22:13 error   ┃ [ 4]     at CronJob.<anonymous> (/app/node_modules/cron/dist/job.js:126:45)
2025-10-17 17:22:13 error   ┃ [ 5]     at Generator.next (<anonymous>)
2025-10-17 17:22:13 error   ┃ [ 6]     at /app/node_modules/cron/dist/job.js:8:71
2025-10-17 17:22:13 error   ┃ [ 7]     at new Promise (<anonymous>)
2025-10-17 17:22:13 error   ┃ [ 8]     at __awaiter (/app/node_modules/cron/dist/job.js:4:12)
2025-10-17 17:22:13 error   ┃ [ 9]     at CronJob.fireOnTick (/app/node_modules/cron/dist/job.js:120:16)
2025-10-17 17:22:13 error   ┃ [10]     at new CronJob (/app/node_modules/cron/dist/job.js:65:23)
2025-10-17 17:22:13 error   ┃ [11]     at <anonymous> (/opt/services/app-auth/src/index.ts:85:13)
2025-10-17 17:22:13 error   ┃ [12]     at ModuleJob.run (node:internal/modules/esm/module_job:345:25)
2025-10-17 17:22:13 error   ┃ [13]     at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:665:26)
2025-10-17 17:22:13 error   ┗ [14]     at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5)

⚙️ Options

| Option | Type | Default | Description | | ---------------- | ---------------------- | -------------------------------- | --------------------------------- | | showTimestamp | boolean | true | Show timestamp before message | | showMeta | boolean | true | Include stack trace & metadata | | showColor | boolean | true | Enable ANSI colors | | metaStrip | (string \| symbol)[] | internal defaults | Remove extra fields from metadata | | inspectOptions | InspectOptions | { depth: 4, breakLength: 100 } | Pass to Node.js util.inspect |

🧠 Advanced Examples

Monochrome mode (no color)

import winston from 'winston';
import { prettyFormat } from 'winston-pretty-format';

const logger = winston.createLogger({
    level: 'debug',
    format: winston.format.combine(
        winston.format.timestamp({ format: 'YYYY-MM-DD HH:mm:ss' }),
        winston.format.uncolorize(),
        padLevels(),
        prettyFormat({
            showColor: false,
            metaStrip: ['timestamp'],
            inspectOptions: {
                colors: false
            }
        })
    ),
    transports: [new winston.transports.Console()]
});

JSON-like meta formatting

logger.info('User logged in', {
    userId: 42,
    role: 'admin',
    ip: '192.168.0.5'
});

❤️ Acknowledgements

Inspired by:

  • winston
  • logform
  • winston-console-format

📣 Feedback

If you discover a bug, or have a suggestion for a feature request, please submit an issue.

📚 License

This extension is licensed under the MIT License