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

@mounaji_npm/logger

v0.3.0

Published

Structured app logger with a fail-open HTTP batch shipper (LogScope ingest), opt-in console patching, secret redaction and request context via AsyncLocalStorage. Node-only, zero UI.

Readme

@mounaji_npm/logger

Structured app logger + fail-open HTTP batch shipper for LogScope, with opt-in console.* patching, secret redaction (via @mounaji_npm/error-handler) and per-request context through AsyncLocalStorage. Node-only, zero UI.

One-liner adoption (api / worker process)

import { initLogScope } from '@mounaji_npm/logger';

const { log } = initLogScope({
  service: 'api',                        // process identity
  deploy: process.env.DEPLOY_TARGET,     // 'render' | 'vps'
  url: process.env.LOGSCOPE_URL,         // https://…/api/logs/ingest
  apiKey: process.env.LOGSCOPE_KEY,      // lsk_…
});
  • Without url/apiKey it runs echo-only — safe in dev/tests.
  • patchConsole defaults to true: every existing console.log/warn/error keeps printing exactly as before AND ships a structured copy.
  • Shipping is fail-open: bounded buffer, batches of ≤200 every 5s, re-queue-once on failure, drop-oldest beyond 2000 entries. LogScope being down can never break or slow the app.

"¿Está conectado el cable?" (announce)

Fail-open significa que un deploy sin LOGSCOPE_URL se ve exactamente igual que uno que shippea bien: cero ruido, cero error. Para que eso sea diagnosticable desde el log del propio deploy, initLogScope imprime tres líneas por la consola cruda (nunca vuelven al shipper):

[logscope] shipping ON → https://logscope.example.com/api/logs/ingest · service=api deploy=render · filtro=minLevel=warn · control remoto=on
[logscope] shipping OFF — falta url (LOGSCOPE_URL). Los logs quedan SOLO en la consola de este proceso. service=api deploy=render
[logscope] no se pudo entregar el primer batch: ingest responded 401 — fail-open, la app sigue normal pero esos logs se pierden. Este aviso no se repite.

El destino se imprime sin query, fragmento ni credenciales: la api-key nunca sale en el log. El fallo se avisa una sola vez (no convierte una caída de LogScope en una tormenta de logs) y cuando la entrega se restablece sale una línea de cierre, para no dejar un "está roto" colgado. announce: false lo apaga.

Si el destino está bien pero LogScope se ve vacío, mirá el filtro= de la línea ON: un minLevel=warn (local o empujado por el control remoto) descarta todo el tráfico info en origen — es la explicación más común.

Request context (Express)

import { logContextMiddleware } from '@mounaji_npm/logger';
app.use(logContextMiddleware());
// every log emitted during the request carries requestId/method/path

Direct API

log.info('user created', { userId });
log.error('payment failed', err);            // Error → serialized meta.err
const payLog = log.child({ name: 'payments' });
await log.flush();                            // drain now
await log.shutdown();                         // flush + stop (SIGTERM hooks are automatic)

Levels: debug < info < warn < error < fatal. Secrets in meta (password, token, apiKey, …) are redacted before shipping.

Crash capture

Deliberately not handled here — compose @mounaji_npm/error-handler/node for uncaughtException/unhandledRejection semantics.