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

@mks2508/better-logger

v0.18.5

Published

Logger avanzado para consola con estilos CSS, temas adaptativos, badges automáticos, SVG, animaciones, CLI integrado y soporte dual browser/terminal con colores ANSI

Readme

🚀 Better Logger

Logger avanzado para consola con estilos CSS, log context tipo MDC, transports (File / HTTP / OTLP→SigNoz), hooks, serializers y CLI integrado. Soporte dual browser/terminal.

NPM Version TypeScript License

✨ Features

  • 🎨 Styling dual — CSS %c con gradientes y sombras en browser, ANSI en terminal. Themes (default/dark/light/neon/minimal/cyberpunk) y Smart Presets (cyberpunk/glassmorphism/minimal/debug/production).
  • 📊 6 niveles + verbosity — trace < debug < info < warn < error < critical (+ silent). trace alineado con la banda TRACE de OpenTelemetry (severity 1-4).
  • 🧩 Log context (MDC) — bindings persistentes con child() o scoped via AsyncLocalStorage con withContext(bindings, fn). Se mergean en TransportRecord.attributes.
  • 📡 Transports — FileTransport (async, bounded buffer), HttpTransport (batching + retry exponencial), OtlpTransport (OTLP/HTTP → SigNoz y otros backends). Custom via ITransport.
  • 🪝 Hooks awaited — beforeLog (mutación reflejada en el mensaje), afterLog (métricas fire-and-forget), middleware Koa-style con use(). Ideales para redacción PII.
  • 🧬 Serializers por tipo — addSerializer(Error, fn), addSerializer(User, fn). Defaults para Error/Date/Map/Set/Buffer/RegExp.
  • 🏷️ Scoped loggers — scope('Auth'), component('Database'), api('GraphQL') con badges automáticos y métodos específicos (slow, rateLimit, auth, deprecated).
  • 🖥️ CLI primitives — spinners braille 80ms, boxes ASCII, tablas, steps, headers, dividers. Fallback automático en non-TTY.
  • 🔭 OpenTelemetry ready — severityNumber / severityText / traceId / spanId / attributes / resource en cada TransportRecord.

📦 Instalación

npm install @mks2508/better-logger
# o
bun add @mks2508/better-logger

🚀 Quick Start

import logger from '@mks2508/better-logger';

logger.info('Application started');
logger.warn('High memory usage');
logger.error('Connection failed');

// Loggers hijuelos (request-scoped, persistentes)
const requestLog = logger.child({ requestId: getRequestId() });
requestLog.info('auth ok');   // lleva requestId automáticamente

Más métodos sueltos:

import { info, success, error, trace } from '@mks2508/better-logger';
info('Proceso iniciado');
success('✓ Completado');

📚 Documentación

| Página | Cubre | |---|---| | Inicio | Overview, features, instalación | | Transports | FileTransport, HttpTransport, OtlpTransport, custom ITransport | | Log Context (MDC) | child() inmutable vs withContext(bindings, fn) scoped | | Hooks & Middleware | on/once/off/use, redacción PII, métricas | | Serializers | addSerializer, defaults, circular refs, depth | | Styling | Themes, Smart Presets, StyleBuilder chainable, badges | | CLI | 8 comandos /help//config//themes/... vía logger.cli() | | Playground | Renderers raw y Logger wrappers para terminales | | Core Logger | CoreLogger minimal (~360 líneas) para Node/CLI ligeros | | Node (reserved) | Subpath reservado para futuras features Node-only | | Migración 0.18.x | Breaking changes desde 1.x–5.x | | API Reference | TypeDoc generado, 164 archivos |

📊 Niveles de log

trace(-1) < debug(0) < info(1) < warn(2) < error(3) < critical(4)

success() emite a nivel info con tag: 'success' para que transports distingan success de info genérico.

logger.setVerbosity('debug');   // trace + debug + info + ...
logger.setVerbosity('warn');    // solo warn, error, critical
logger.setVerbosity('silent');  // nada

🌐 Compatibilidad

  • ✅ Browsers modernos — soporte completo (CSS, DevTools, localStorage fallback)
  • ✅ Node.js — core + transports (File async, HTTP, OTLP)
  • ✅ TypeScript — definiciones completas, cero any en superficie pública
  • ✅ ESM & CommonJS — ambos exports; subpath layout (./transports, ./context, ./hooks, ./serializers, ./styles, ./cli, ./playground, ./core)

📄 Licencia

MIT — ver LICENSE.