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

logpretty-cli

v1.0.0

Published

Pretty-print JSON logs in the terminal. Supports pino, winston, and bunyan formats.

Readme

logpretty

Version License

Pretty-print JSON logs in the terminal. Supports pino, winston, and bunyan formats out of the box.

If you use structured logging, your raw logs look like this:

{"level":30,"time":1700000000000,"pid":12345,"hostname":"server1","msg":"User signed in","userId":"u_8fk2","latency":42}
{"level":50,"time":1700000001000,"pid":12345,"hostname":"server1","msg":"Database connection failed","error":"ECONNREFUSED","retries":3}
{"level":40,"time":1700000002000,"pid":12345,"hostname":"server1","msg":"Rate limit approaching","current":980,"max":1000}

Pipe them through logpretty and get this:

2023-11-14 22:13:20.000 INFO  User signed in
    userId: u_8fk2
    latency: 42
2023-11-14 22:13:21.000 ERROR Database connection failed
    error: ECONNREFUSED
    retries: 3
2023-11-14 22:13:22.000 WARN  Rate limit approaching
    current: 980
    max: 1000

Timestamps in gray, levels color-coded (ERROR = red, WARN = yellow, INFO = green, DEBUG = blue), messages in bold white, and extra fields neatly indented below.

Installation

# npm
npm install -g logpretty-cli

# yarn
yarn global add logpretty-cli

# pnpm
pnpm add -g logpretty-cli

Usage

Pipe any JSON log stream through logpretty:

# From a log file
cat app.log | logpretty

# From a running process
node server.js 2>&1 | logpretty

# Docker logs
docker logs -f myapp | logpretty

# PM2 logs
pm2 logs --raw | logpretty

Non-JSON lines pass through unchanged, so mixed output works fine.

Options

--no-color          Disable colored output
--level-key <key>   Custom field name for log level  (default: "level")
--msg-key <key>     Custom field name for message    (default: "msg", "message")
--time-key <key>    Custom field name for timestamp  (default: "time", "timestamp", "@timestamp")
-h, --help          Show help

Supported Log Formats

pino

{"level":30,"time":1700000000000,"pid":42,"hostname":"app","msg":"Request completed","responseTime":12}

winston (JSON transport)

{"level":"info","message":"Server started","timestamp":"2023-11-14T22:13:20.000Z","port":3000}

bunyan

{"name":"myapp","hostname":"server","pid":1234,"level":30,"msg":"Listening","time":"2023-11-14T22:13:20.000Z","v":0,"port":8080}

Custom formats

Use the --level-key, --msg-key, and --time-key flags for any format:

cat custom.log | logpretty --level-key severity --msg-key text --time-key ts

How It Works

  1. Reads stdin line by line
  2. Attempts to parse each line as JSON
  3. If valid JSON object: extracts timestamp, level, and message fields, then pretty-prints with ANSI colors. Extra fields are displayed indented below the main line.
  4. If not JSON: prints the line unchanged

Zero Dependencies

This tool has no dependencies. It uses only Node.js built-in modules (readline). Install it and it just works.

License

MIT -- Tate Lyman