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

@yingyeothon/logger

v2.2.0

Published

Minimal structured logger with severity filtering, composition, and pluggable writers.

Downloads

1,228

Readme

@yingyeothon/logger

Minimal structured logger with severity filtering, writer composition, and pluggable log writers. Built for tiny serverless bundles: zero dependencies, a few hundred bytes of code.

One threshold, then any number of writers; an omitted logger option becomes nullLogger.

flowchart LR
  A["logger.info(message, context)"] --> F["createFilteredLogger<br/>severity threshold"]
  F --> C["combine"]
  C --> W1["consoleWriter"]
  C --> W2["your own LogWriter"]
  N["nullLogger"] -.->|"the default when logger is omitted"| A

Install

npm install @yingyeothon/logger

Usage

ESM:

import {
  combine,
  createConsoleLogger,
  createFilteredLogger,
  nullLogger,
} from "@yingyeothon/logger";

const logger = createConsoleLogger("info");
logger.debug("dropped: below severity");
logger.info("hello", { requestId: "r-1" });
logger.error("boom", new Error("bad"));

// Compose multiple writers and filter them together.
const buffered: string[] = [];
const audit = createFilteredLogger({
  severity: "debug",
  writer: combine(
    {
      debug: () => {},
      info: (...a) => buffered.push(a.join(" ")),
      warn: console.warn,
      error: console.error,
    },
    nullLogger, // combine() skips the null logger
  ),
});
audit.info("stored");

CJS:

const { createConsoleLogger } = require("@yingyeothon/logger");
const logger = createConsoleLogger("debug");
logger.debug("visible now");

Public API

  • createConsoleLogger(severity?) — Logger filtering the console writer (default severity "info")
  • createFilteredLogger(options) — Logger that writes to options.writer only when the record's severity is at or above the logger's (mutable) severity
  • combine(...writers) — fan-out writer; skips nullLogger
  • consoleWriter — LogWriter backed by console.debug/info/warn/error
  • nullLogger — a Logger that drops everything
  • Types: LogSeverity ("none" | "debug" | "info" | "warn" | "error"), LogWriter ({ debug, info, warn, error } sink interface), Logger (LogWriter plus a mutable severity field), FilteredLoggerOptions ({ severity, writer })

Migrating from the legacy package

  • The exported classes are gone: new ConsoleLogger(severity) becomes createConsoleLogger(severity) and new FilteredLogger(severity, writer) becomes createFilteredLogger({ severity, writer }). The returned objects are plain Logger values with the same behavior, including the mutable severity field.
  • warn was added to the contract: LogWriter sinks must provide debug/info/warn/error, and LogSeverity gained "warn".
  • The package now ships dual ESM/CJS with types; deep imports (@yingyeothon/logger/lib/...) are no longer supported — import everything from the package root.
  • Logger, LogSeverity, and LogWriter are type-only exports.