Skip to content

Repository files navigation

@atums/echo

A minimal, flexible logger for Node with console and file output, ANSI colors, and daily rotation.

Installation

bun add @atums/echo

Quick Start

import { echo } from "@atums/echo";

// Basic logging
echo.info("App started");
echo.error("Something failed:", error, { userId: 123 });

// Multiple arguments
echo.warn("Rate limit:", 429, { endpoint: "/api/users" });

// Custom tagged logs
echo.custom("GET", "/health", { status: 200, duration: "15ms" });

Log Levels

trace | debug | info | warn | error | fatal

Output

Console:

2025-05-24 16:15:00.000 [INFO] (app.ts:3:6) Server started

File (logs/2025-05-24.jsonl):

{
  "timestamp": 1748115300000,
  "level": "info",
  "file": "app.ts",
  "line": "3",
  "data": ["Server started"]
}

Configuration

Configure via logger.json, environment variables, or constructor. See - Configuration Guide for full details.

Quick setup:

{
  "level": "debug",
  "directory": "logs",
  "console": true,
  "consoleColor": true,
  "lazyInit": true,
  "fastMode": false
}

Documentation

Features

  • Ultra-fast startup (< 50ms) with lazy initialization
  • High-performance I/O with optional console buffering
  • Multiple arguments per log call
  • Colored console output with ANSI codes
  • Daily rotated .jsonl files with automatic cleanup
  • Safe circular reference handling
  • Error object serialization
  • Custom log patterns and colors
  • Smart caller location tracking (only when needed)
  • Flexible configuration via files, environment, or constructor
  • Fast mode for maximum performance scenarios

License

BSD 3-Clause

About

A minimal, flexible logger for Node

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages