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

loggette

v1.0.5

Published

A micrologger for your apps. Basics-only.

Readme

Loggette

A lightweight, zero-dependency TypeScript logger with template literal support, color output, and runtime level control.

Features

  • Template literal API for easy value interpolation
  • Four log levels: error, warn, info, debug
  • Automatic color detection (TTY, NO_COLOR, FORCE_COLOR)
  • Runtime level and color switching
  • Swappable default logger
  • Chainable methods

Installation

Depending on your package manager:

  • npm i loggette
  • bun add loggette
  • yarn add loggette
  • pnpm add loggette
  • deno add npm:loggette

Usage

Default logger

import logger from "loggette";

logger.info`Server started on port ${port}`
.warn(`Config file ${"config.json"} not found, using defaults`)
.error`Failed to connect to database: ${err.message}`
.debug`Parsed payload: ${JSON.stringify(payload)}`;

Custom logger

import { createLogger } from "loggette";

const logger = createLogger("debug");

logger.debug`This will show`;

Chaining

All methods return the logger instance, so they can be chained:

const logger = createLogger("info")
    .setLevel("debug")
    .setUseColor(false)
    .setDefault()
    .debug("test") // not printed
    .info`Logged in as ${username}`;

Template literals

Interpolated values are highlighted in the level's color:

logger.info`Connected to ${"localhost"}:${5432}`;
// the values "localhost" and "5432" are colored
logger.info(`Database ${db.name} connected.`)
// db.name is not highlighted

[!NOTE] Interpolated values are only processed using String() so data types like objects may print as "[object, Object]". Validate the values yourself as this is only a minimal logger.

Log Levels

Levels are ordered by severity. Setting a level suppresses everything below it.

| Level | Prints | |---------|-------------------------------| | error | errors only | | warn | errors, warnings | | info | errors, warnings, info | | debug | everything |

const logger = createLogger("warn");

logger.info`This won't print`;
logger.warn`This will`;

API

createLogger(level, useColor?)

Creates a new logger instance.

| Param | Type | Description | |------------|------------|--------------------------------------------------| | level | LogLevel | Minimum level to print | | useColor | boolean? | Force color on/off. Auto-detects if not provided |

logger.setLevel(level)

Change the log level at runtime. Returns the logger for chaining.

logger.setLevel("debug");

logger.setUseColor(color?)

Force color on/off, or pass undefined to re-enable auto-detection. Returns the logger for chaining.

logger.setUseColor(false); // force off
logger.setUseColor();      // back to auto

logger.setDefault()

Replace the module-level default logger with this instance. Returns the logger for chaining.

const logger = createLogger("debug");
logger.setDefault();

Color Control

Loggette respects standard color environment variables:

| Variable | Effect | |---------------|-------------------------------| | NO_COLOR | Disables color (any value) | | FORCE_COLOR=0 | Disables color | | FORCE_COLOR=1 | Enables color | | TTY detection | Enables color if stdout is a TTY |

Output Format

2026-06-23T10:00:00.000Z LEVEL : MESSAGE WITH HIGHLIGHTS
  • Timestamp in dim gray
  • Level in its respective color, padded to 5 chars
  • Interpolated values highlighted in level color