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

@abhinav-dev/ctx-logger

v0.2.0

Published

Explicit, vendor-neutral structured logger for Node.js/TypeScript (pino engine).

Readme

Structured Logger (Node.js / TypeScript)

A simple, explicit, and vendor-neutral logging wrapper for Node.js services.

Designed to survive:

  • CloudWatch → Splunk → Datadog migrations
  • different execution models (API, cron, queue, batch, CLI)
  • long-lived enterprise codebases

No magic. No hidden context. No runtime dependencies on async hooks.


Why this library exists

In many services:

  • logging libraries get swapped over time (pino → something else)
  • log destinations change (CloudWatch → Splunk → Datadog)
  • log formats drift and dashboards break

This library solves that by enforcing:

  • a stable log schema
  • explicit context passing
  • structured JSON logs
  • engine abstraction (pino today, others later)

Core principles

  • JSON logs only
  • Explicit context (no AsyncLocalStorage)
  • Stable, machine-friendly event names
  • Human-friendly messages
  • Redaction by default
  • Compatible with CommonJS and older Node runtimes

Installation

npm install @abhinav-dev/ctx-logger

Quick Start

  1. Create the logger (once)
import { createLogger } from "@abhinav-dev/ctx-logger";

const logger = createLogger();
  1. Create a context (per request / job / trigger)
const ctx: LoggerContext = {
  service: "orders-api",
  env: "prod",
  version: "1.2.3",
  correlation_id: "c-9f3e8d2",
};
  1. Log events
logger.info(ctx, "service_started");

logger.info(ctx, "order_created", {
  order_id: "o-123",
  amount: 499,
});

logger.error(ctx, "db_query_failed", {
  table: "orders",
  reason: "timeout",
});

Derived context (optional)

To add stable sub-scope fields without mutating the original context:

const orderCtx = logger.with(ctx, { order_id: "o-123" });

logger.info(orderCtx, "order_loaded");

Log Output

Example:

{
  "level": 30,
  "time": "2026-01-16T06:38:58.483Z",

  "service": "demo",
  "env": "dev",
  "version": "0.1.0",
  "correlation_id": "c-1",

  "level_name": "info",
  "event": "hello",
  "message": "hello",

  "details": {
    "name": "a",
    "password": "[REDACTED]"
  }
}

Redaction

Sensitive keys are redacted automatically inside details.

Default redacted keys (case-insensitive):

  • authorization
  • cookie, set-cookie
  • password
  • token
  • secret
  • api_key
  • client_secret

Example:

logger.info(ctx, "login_attempt", {
  username: "myusername",
  password: "secret123",
});

Output:

"details": {
  "username": "myusername",
  "password": "[REDACTED]"
}