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

hushlog

v1.1.0

Published

Styled console logging for development environments

Readme

hushlog

A lightweight, styled console logger that stays quiet in production and speaks up in development.

Install

npm install hushlog

Usage

import { log } from "hushlog";

log("Server response:", data);
log("User authenticated");

Output is only shown when NODE_ENV === 'development'. In production, log is completely silent — no configuration needed.

Log Levels

hushlog includes five log levels, each with distinct colour styling:

import { log } from "hushlog";

log("Fetching user:", id); // Cyan   — general output
log.info("Cache hit:", key); // Blue   — informational messages
log.warn("Token expiring soon"); // Yellow — warnings, deprecations
log.error("Request failed:", err); // Red    — errors, failures
log.success("User saved!"); // Green  — confirmations, completed actions

| Method | Colour | Use for | | --------------- | ------ | -------------------------------- | | log() | Cyan | General output | | log.info() | Blue | Informational messages | | log.warn() | Yellow | Warnings, deprecations | | log.error() | Red | Errors, failures | | log.success() | Green | Confirmations, completed actions |

Features

  • Zero output in production — logs are automatically suppressed outside of development
  • Five log levels — distinct colour styling for each level
  • Styled output — messages are colour-highlighted in the console for easy scanning
  • Flexible arguments — pass a string label, additional data, or any combination
  • No dependencies — tiny footprint, nothing extra installed
  • ESM and CJS — works in modern bundlers and Node.js out of the box

API

All level methods share the same signature:

log(message?, ...args)
log.info(message?, ...args)
log.warn(message?, ...args)
log.error(message?, ...args)
log.success(message?, ...args)

| Argument | Type | Description | | --------- | -------- | -------------------------------------------------- | | message | string | A label or message, rendered with styling | | ...args | any | Any additional values to log alongside the message |

logScope(prefix)

Returns a namespaced logger instance with all five level methods attached.

| Argument | Type | Description | | -------- | -------- | ----------------------------------------------- | | prefix | string | A namespace label shown as [prefix] in output |

setLogFilter(...prefixes)

Controls which namespaced loggers produce output.

| Value | Behaviour | | --------------- | ------------------------------ | | '*' | Show all logs (default) | | 'auth' | Show only [auth] logs | | 'auth', 'api' | Show [auth] and [api] logs | | null | Silence everything |

Prefixes & Namespacing

Use logScope to create a named logger for a specific module or feature. Every message will be prefixed so you can immediately tell where it came from:

import { logScope } from "hushlog";

const log = logScope("auth");

log("User signed in:", user); // [auth] User signed in:
log.warn("Token expiring soon"); // [auth] Token expiring soon
log.error("Invalid credentials"); // [auth] Invalid credentials

Each module in your project can have its own logger:

// auth.js
const log = logScope("auth");

// api.js
const log = logScope("api");

// store.js
const log = logScope("store");

Groups

Use logGroup to wrap related logs in a collapsible section in devtools:

import { log, logGroup } from "hushlog";

logGroup("Fetch User", () => {
  log("Requesting /api/user");
  log.info("Headers:", headers);
  log.success("Response:", data);
});

In devtools this renders as a collapsible block:

▼ Fetch User
    Requesting /api/user
    Headers: { ... }
    Response: { ... }

Collapsed by default

Pass { collapsed: true } to render the group closed until clicked:

logGroup(
  "Fetch User",
  () => {
    log("Requesting /api/user");
    log.success("Response:", data);
  },
  { collapsed: true }
);

Async support

logGroup is async-aware — the group stays open until the callback fully resolves:

await logGroup("Load Config", async () => {
  const config = await fetchConfig();
  log.success("Config loaded:", config);
});

With logScope

logGroup accepts a prefix option to match a scoped logger:

const log = logScope("api");

logGroup(
  "Fetch User",
  () => {
    log("Requesting /api/user");
    log.success("Done:", data);
  },
  { prefix: "api" }
);

Output:

▼ [api] Fetch User
    [api] Requesting /api/user
    [api] Done: { ... }

logGroup(label, callback, options?)

| Option | Type | Default | Description | | ----------- | --------- | ----------- | -------------------------------------------------------- | | collapsed | boolean | false | Render the group collapsed by default | | prefix | string | undefined | Namespace label, shown as [prefix] in the group header |

Use setLogFilter to control which prefixes are shown at runtime. Useful when you want to focus on one area of your app without changing any code:

import { setLogFilter } from "hushlog";

setLogFilter("auth"); // only show [auth] logs
setLogFilter("auth", "api"); // show [auth] and [api] logs
setLogFilter("*"); // show all logs (default)
setLogFilter(null); // silence everything

Unprefixed logs from the default log are always shown unless setLogFilter(null) is used.

Imports

Named and default imports are all supported:

import log, { logScope, logGroup, setLogFilter } from "hushlog";
import { log, logScope, logGroup, setLogFilter } from "hushlog";

How It Works

hushlog checks process.env.NODE_ENV at runtime. If it equals "development", your logs are printed to the console with styled formatting. In any other environment — production, test, staging — the function exits silently.

No tree-shaking required, no build flags, no setup.

Environment Compatibility

Works with any environment that sets NODE_ENV, including:

License

MIT