DEV Community

tolongames
tolongames

Posted on

Scribelog — TypeScript-first logger for Node.js

I built Scribelog to stop wasting time wrestling with logger configs. It’s a TypeScript-first, configurable logger for Node apps with sensible defaults, useful adapters, and features you actually need in production — masking secrets, requestId propagation, batching, multiple transports, and easy child loggers. Give it a spin.


Why you might care

  • TypeScript-first + great DX — full types and autocompletion out of the box.
  • Multiple transports (Console, File, HTTP, WebSocket, TCP, UDP) + batching — send logs where they belong and reduce I/O with AsyncBatch.
  • Framework adapters — ready middleware/plugins for Express, Koa, Fastify, NestJS and Next.js so integration is trivial.
  • Security & observability extras — built-in sensitive-data masking, automatic request/trace ID propagation via AsyncLocalStorage, and optional automatic error handling.

Current release: v2.0.0 (freshly published). Weekly downloads are low right now — perfect time to try it and provide feedback.


Quick start (copy-paste)

npm i scribelog
# or: pnpm add scribelog
Enter fullscreen mode Exit fullscreen mode
import { createLogger, format } from 'scribelog';

const logger = createLogger({
  level: 'info',
  format: format.combine(
    format.timestamp(),
    format.simple()
  ),
});

logger.info('Scribelog ready!');
logger.warn('This is a warning', { detail: 'cache near limit' });
Enter fullscreen mode Exit fullscreen mode

(Check the README for JSON/file/http transports, batching and masking examples.) ([npm][1])


Integrations & common uses

  • Use adapters.express.createMiddleware({ logger }) to log requests with requestId and duration.
  • Attach AsyncBatch to an HTTP transport to buffer and gzip logs before sending to your collector.
  • Use format.maskSensitive([ 'password', 'token', 'apiKey' ]) to redact secrets before they leave your process.

TL;DR — when to try Scribelog

  • You want typed logging in Node + good defaults (timestamp, splat, errors).
  • You need quick adapters for web frameworks (Express/Fastify/Nest/Next).
  • You want built-in masking + requestId propagation without wiring AsyncLocalStorage yourself.
  • You want a good, advanced and highly configurable logging library for Node.js

Links / feedback

If you try it: open an issue with any rough edges, or drop a PR with an example for your framework — I’ll iterate fast. If you post this somewhere, ping me (@tolongames) and I’ll answer questions in the thread.

Top comments (0)