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

esm-iso-logger

v1.0.2

Published

A simple dependency free logging utility

Readme

esm-iso-logger

A zero-dependency, isomorphic logger that looks great in Node.js, browsers, VS Code, GitHub Actions, Deno, Bun… and anywhere else JavaScript runs. Universal logging core. One event emitter, one logger class, zero deps. Bolt on any backend by subscribing to the same single event. Tree-shakeable ESM only, no CommonJS.

Ships with pretty console printers for node (ansi) and browser (css):

| Feature | Node.js | Browser | | ----------------------------------------------- | ------- | ------- | | True-color ANSI (256 / 24-bit) | X | — | | CSS-styled console output | — | X | | Automatic environment detection | X | X | | Toggle log-levels at runtime | X | X | | Tree-shakeable ESM only | X | X | | Extendable define your own backends | X | X |


Installation

npm i esm-iso-logger


Api surface

import {
  Logger,                 // Create named loggers
  LogLevel,               // Union type: 'log'|'info'|'warn'|'error'|'debug'|'verbose'|'fatal'
  LogMessage,             // Shape of each log event
  loggingEventEmitter,    // Shared EventEmitter – subscribe to 'log' to build custom backends

  LogPrinter,             // Ready-made console backend (auto-picks Node ANSI or Browser CSS)
  ILogPrinter,            // Interface if you want to write your own printer
  LogPrinterOptions,      // Constructor options bag for LogPrinter

  Colour,                 // Colour builder: Colour.rgb(r,g,b).bold.italic …
  Palette,                // Palette interface map used by LogPrinter
  defaultPalette,         // Default colours (light-ish)
  defaultPalette2,        // Darker alternative palette

  defaultArgsFormatter    // turns args[] -> single string (used by LogPrinter, reusable)
} from 'esm-iso-logger';

Logger:

  new Logger(context: string)
  logger.log|info|warn|error|debug|verbose|fatal(...args: unknown[])

LogMessage shape:

  interface LogMessage {
    level: 'log'|'info'|'warn'|'error'|'debug'|'verbose'|'fatal';
    args: unknown[];
    context: string;
    timestamp: string; // ISO
  }

LogPrinter (optional):

  const printer = new LogPrinter<H extends string>(
    header: H,
    levels?: LogLevel[],           // Log levels (default: ['log', 'info', 'error', 'warn', 'debug', 'verbose', 'fatal'])
    palette?: Palette,             // RGB + styles (default: defaultPalette)
    formatter?: (args[]) => string // Formatter (default: defaultArgsFormatter)
  )

Runtime toggle:

  printer.disable('debug');
  printer.enable('debug');

Multiple printers / backends are possible:

new LogPrinter('Prod', ['error', 'fatal']); // console only errors
new LogPrinter('Dev');                      // console everything

Environment quirks:

NO_COLOR=1 or FORCE_COLOR=0  -> plain text
FORCE_COLOR=3                -> full 24-bit ANSI
VS Code / GitHub Actions     -> auto-detected true-color
Browser                      -> falls back to unstyled if console lacks %c

Quickstart

import { LogPrinter } from 'esm-iso-logger';

// 2. spin it up (can have many)
new LogPrinter('MyApp');

// 3. create contextual loggers
import { Logger } from 'esm-iso-logger';
const logger = new Logger('UserService');

logger.info('Server listening on port', 3000);
[MyApp] 2026-01-21T17:04:12.345Z    INFO [UserService] Server listening on port 3000

Bring your own backend

The core only emits; it never cares who listens.

import { loggingEventEmitter, type LogMessage } from 'esm-iso-logger';

// plain function
loggingEventEmitter.on('log', (msg: LogMessage) => {
  fetch('https://grafana.example.com/loki/api/v1/push', {
    method: 'POST',
    body: JSON.stringify(msg)
  });
});

Wrap it in a class if you want:

class FileSink {
  constructor(private path: string) {
    loggingEventEmitter.on('log', m => this.append(m));
  }
  private append(m: LogMessage) {
    require('node:fs').appendFileSync(this.path, JSON.stringify(m) + '\n');
  }
}
new FileSink('./app.jsonl');

You can run any number of backends side-by-side; each receives every LogMessage and decides what to do with it.

Test commands

npm run demo:node:default          # default colour detection
npm run demo:node:force3           # force 24-bit RGB
npm run demo:node:force0           # force off (plain)
npm run demo:node:nocolor          # respect NO_COLOR=1
npm run demo:node:vscode           # VS Code terminal
npm run demo:node:github           # GitHub Actions
npm run demo:node:gitea            # Gitea Actions
npm run demo:node:xterm256         # 256-colour palette
npm run demo:browser               # opens headless Chrome demo

License:

MIT 2026