DEV Community

Cover image for Why I Built dd-tinylog: A Lightweight Logging Library Made for Speed and Simplicity
Damilare Osibanjo
Damilare Osibanjo

Posted on

Why I Built dd-tinylog: A Lightweight Logging Library Made for Speed and Simplicity

The Core Problem: Logging Has Become Too Heavy

In many Node.js projects, logging libraries try to handle too much at once:

  • complex configuration files
  • confusing APIs
  • nested options that make setup slower than writing your own wrapper
  • blocking writes that slow down the event loop
  • inconsistent performance between development mode and production

I wanted to create a logger that didn’t feel like a burden. You should be able to add it to a project quickly and rely on it without thinking too much.

GitHub Repository: https://github.com/Dev-Dami/tini-log

The Philosophy Behind dd-tinylog

1 . It is Lightweight
Minimal overhead. Fast defaults. Async transports avoid blocking.

2 . It is Flexible
Use text or JSON, choose timestamps, customize prefixes, and change log levels on the fly.

3 . Making Simple Structures
Child loggers offer clear separation between modules, requests, or components.

Real Usage Example

  • Installation
npm install dd-tinylog
Enter fullscreen mode Exit fullscreen mode
  • Simple Use of logger
import { Logger } from 'dd-tinylog';

const logger = new Logger({
  level: 'info',
  async: true,
  colorize: true,
  transports: [
    { type: 'console' },
    { type: 'file', options: { path: './logs/app.log' } },
  ],
  prefix: '[My-App]',
  timestamp: true,
});

logger.info('Server started');
logger.warn('Low disk space');
logger.error('Database error', { code: 500 }); 
Enter fullscreen mode Exit fullscreen mode
  • Child Loggers
const requestLogger = logger.createChild({
  prefix: '[Request-123]',
  context: { requestId: 'req-123' },
});

requestLogger.info('Processing request'); 
Enter fullscreen mode Exit fullscreen mode

This keeps logs organized without needing separate logger files or duplicated configuration.

Where Does This Library Fit

  • Web servers and APIs
  • CLI tools
  • Background workers
  • Microservices
  • Development and testing

Regardless of the environment, the goal is the same: keep logs flowing without slowing everything else down.

Top comments (0)