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

@sitespeed.io/log

v2.0.0

Published

The log for sitespeed.io projects

Readme

@sitespeed.io/log

A small, zero-dependency console logger used by sitespeed.io and related projects. It writes timestamped, level-aware messages to console, supports printf-style placeholders, and is configured once for the whole process.

Install

npm install @sitespeed.io/log

Requires Node.js 22 or later. ESM only.

Usage

import { configureLog, getLogger } from '@sitespeed.io/log';

configureLog({ verbose: 1 });

const log = getLogger('my-module');

log.info('Starting up');
log.debug('Using config %j', { port: 3000 });
log.error('Failed to load %s', 'plugin.js', new Error('boom'));

Output:

[2025-05-16 14:22:01] INFO: Starting up
[2025-05-16 14:22:01] DEBUG: [my-module] Using config {
  "port": 3000
}
[2025-05-16 14:22:01] ERROR: [my-module] Failed to load plugin.js Error: boom
    at ...

At info (the default) the logger name is omitted. At debug and below it is included, since extra noise is usually wanted there.

Log levels

Lowest number = most critical. Setting a level enables that level and everything more critical:

| Level | Number | console method | |----------|-------:|------------------| | none | 0 | (disabled) | | critical | 1 | error | | error | 2 | error | | warning | 3 | warn | | info | 4 | info (default) | | debug | 5 | debug | | verbose | 6 | log | | trace | 7 | trace |

Configuration

configureLog({
  level: 'debug',  // exact level by name (takes precedence)
  verbose: 0,      // 0 = info, 1 = debug, 2 = verbose, 3 = trace
  silent: false    // true disables all logging
});

Precedence: silent > level > verbose. Call configureLog() once near the start of your process; configuration is global.

Logger API

getLogger(name) returns a Logger. Names show up in the output when the level is debug or below.

const log = getLogger('my-module');

log.critical(message, ...args);
log.error(message, ...args);
log.warning(message, ...args);   // log.warn is an alias
log.info(message, ...args);
log.debug(message, ...args);
log.verbose(message, ...args);
log.trace(message, ...args);

if (log.isEnabledFor('debug')) {
  log.debug('Expensive: %j', computeStuff());
}

Message placeholders

Placeholders are replaced left-to-right with the trailing arguments. Leftover arguments are appended.

| Placeholder | Replaced with | |-------------|--------------------------------------------------------| | %s | String(arg) | | %d | String(Number(arg)) | | %j | JSON.stringify(arg, null, 2) | | %O | Pretty-printed object, or {name, message, stack} for Error | | %? | Inline: String(arg), pretty JSON for objects, Error: …\n<stack> for Error |

log.info('user=%s requests=%d', 'alice', 42);
log.error('Request failed: %?', err);

$ is not a special character — log.info('price $1') prints price $1 verbatim.

Advanced

Logger and the live loggerConfig object are exported for cases where you need to subclass or read the current level/format directly. Most users only need configureLog and getLogger.

License

Apache-2.0