@atums/echo
v2.0.3
Published
A minimal, flexible logger
Downloads
75
Maintainers
Readme
@atums/echo
A minimal, flexible logger for Node with console and file output, ANSI colors, and daily rotation.
Installation
bun add @atums/echoQuick 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 startedFile (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
- Configuration Guide - Complete config options, environment variables, and patterns
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
.jsonlfiles 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
