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

@open-rgs/log

v1.0.0

Published

Structured JSON logger for open-rgs. ECS-aligned fields, ring buffer, child loggers, redaction, sampling. Zero deps.

Readme

@open-rgs/log

Structured JSON logger for open-rgs. ECS-aligned fields, in-process ring buffer, child loggers, redaction, sampling. Zero deps.

Built for production RGS workloads: log everything important, never crash on a bad sink, redact PII at the boundary, scale to thousands of RPS with sampling.

Use

import { createLogger } from "@open-rgs/log";

const log = createLogger({
  service: "rgs-hello-spin",
  version: "0.1.0",
  environment: process.env.NODE_ENV,
  minLevel: "info",
  // Credentials are redacted by DEFAULT (password/token/secret/authorization/
  // cookie/…). Add your own; matching is separator-insensitive, so
  // "session_id" also catches "session.id" / "sessionId".
  redactKeys: ["session_id"],
  ringBufferSize: 2000,
  sampleEvery: { "spin.tick": 100 },  // log 1 of every 100 ticks
});

log.info("server starting", { "event.category": "process", "event.action": "startup" });

// Per-request scope
const reqLog = log.child({ "request.id": "abc123", "session.id": "s-1" });
reqLog.warn("slow wallet call", { "event.action": "wallet.slow", "duration_ms": 850 });

// Exceptions
try { /* ... */ }
catch (e) { log.exception("spin failed", e, { "event.action": "spin" }); }

// Pull recent entries (newest first) — for an admin /logs endpoint
const recent = log.getRecent("warn", 100);

ECS-aligned output

{
  "@timestamp": "2026-05-23T12:00:00.000Z",
  "log.level": "warn",
  "message": "slow wallet call",
  "service.name": "rgs-hello-spin",
  "service.version": "0.1.0",
  "service.environment": "production",
  "event.action": "wallet.slow",
  "duration_ms": 850,
  "request.id": "abc123",
  "session.id": "[REDACTED]"
}

Features

| Feature | Why | |-------------------|--------------------------------------------------------------------| | ECS field names | Drops into Elastic / Datadog / Grafana Loki dashboards unchanged | | Ring buffer | Admin endpoint can return last N entries without external storage | | Child loggers | Per-request / per-session context without repeating field names | | PII redaction | On by default (credential keys); separator-insensitive key match + value scrubbing (Bearer tokens, ?token=… URLs); recursive, never mutates caller's objects | | Sampling | Keyed by event.action; drops to 1-in-N for high-volume entries | | Pluggable sink | Default is stdout JSON; swap for syslog / OTEL collector / file | | Sink-safe | A throwing sink never crashes the caller | | Runtime levels | log.setLevel("debug") from an admin handler when triaging | | LOG_LEVEL env | Standard 12-factor; overrides the default minLevel |

Test

bun install
bun test    # 11 cases