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

pretty-log-tagged

v1.0.8

Published

Make console logs readable with clean, structured, tag-based output.

Readme

pretty-log-tagged

Make console logs readable with clean, structured, tag-based output.

npm version npm downloads license

The Problem

console.log(`User login: ${JSON.stringify(user)}`);
console.log(`[PAYMENT] ${JSON.stringify(payload)}`);
console.log(`[DB] Query took ${ms}ms`);

Hard to scan. No structure. No color. Every log looks the same.

The Solution

clog.user(user);
clog.payment(payload);
clog.db(`Query took ${ms}ms`);

Each log line gets a colored tag, a timestamp, and formatted output automatically.

Installation

npm install pretty-log-tagged

Usage

import { clog } from 'pretty-log-tagged';

clog.user({ id: 1, name: 'Jay' });
clog.error('Something went wrong');
clog.payment({ amount: 99.99, currency: 'USD' });
clog.server('Listening on port 3000');
clog.db({ query: 'SELECT *', table: 'users' });
clog.auth({ token: 'Bearer ...' });

The dot notation is the tag. Any property you access becomes the label of that log line. All built-in tags are pre-styled, and any unknown tag falls back to a default style automatically.

clog.anything('works too');
clog.myCustomTag({ whatever: true });

Built-in Tags

| Tag | Console Method | |------------|----------------| | info | console.info | | success | console.log | | warn | console.warn | | error | console.error | | debug | console.debug | | user | console.log | | auth | console.log | | db | console.log | | api | console.log | | server | console.log | | request | console.log | | response | console.log | | cache | console.log | | job | console.log | | event | console.log | | mail | console.log | | payment | console.log | | socket | console.log | | test | console.log |

Custom Logger

Need your own tags or want to silence logs in tests? Use createLogger:

import { createLogger } from 'pretty-log-tagged';

const log = createLogger({
  timestamp: true,   // show ISO timestamp, default: true
  silent: false,     // suppress all output, default: false
  tags: {
    stripe: { fg: 'black', bg: 'brightGreen', level: 'log' },
    redis:  { fg: 'white', bg: 'red',         level: 'warn' },
  },
});

log.stripe({ event: 'charge.succeeded' });
log.redis('Cache miss');

Silence all output in test environments:

const log = createLogger({ silent: process.env.NODE_ENV === 'test' });

Options

| Option | Type | Default | Description | |-------------|-----------|---------|-----------------------------------| | timestamp | boolean | true | Prepend ISO timestamp to each log | | silent | boolean | false | Suppress all output | | tags | object | {} | Add or override tag definitions |

Tag Config

Each entry in tags accepts:

{
  fg: FgColor,     // foreground color
  bg: BgColor,     // background color
  level: 'log' | 'info' | 'warn' | 'error' | 'debug'
}

Available colors: black, red, green, yellow, blue, magenta, cyan, white, gray, and their bright variants — brightRed, brightGreen, brightBlue, etc.

TypeScript

Fully typed. The default clog instance and any instance from createLogger are typed with all built-in tags. Custom tags are accessible via string indexing.

import { clog, createLogger, PrettyLogger, LoggerOptions } from 'pretty-log-tagged';

License

MIT