Fast β’ Lightweight β’ Zero Dependencies β’ TypeScript Native
π Documentation Β· β‘ Quick Start Β· β¨ Features Β· π€ Contributing
- Lightweight β minimal footprint, fast execution
- Simple API β intuitive methods like
info(),warn(),error() - Flexible formatting β plain text or structured JSON
- Multiple transports β Console, File (streaming rotation), HTTP (async retry), CircuitBreaker, and DeadLetterQueue
- Child loggers β scoped logging for modules or requests
- Async mode β non-blocking writes for high-performance applications
- Memory safe β bounded queues and memory-efficient streaming
- Customizable β custom log levels, colors, and filtering
bun add zarioimport { Logger, ConsoleTransport } from "zario";
const logger = new Logger({
level: "info",
colorize: true,
transports: [new ConsoleTransport()],
prefix: "[MyApp]",
});
logger.info("π Server started on port 3000");
logger.warn("β οΈ High memory usage detected");
logger.error("β Database connection failed", { code: 500 });If you only need the logger class, use the lightweight entrypoint to reduce bundled code:
import { Logger } from "zario/logger";zario/logger exports only Logger and related logger types.
If you use retryOptions from this entrypoint, set Logger.retryTransportFactory with RetryTransport once at startup.
const requestLogger = logger.createChild({
context: { scope: "request" },
});
requestLogger.info("Incoming request");import { Logger, ConsoleTransport } from "zario";
const jsonLogger = new Logger({
json: true,
transports: [new ConsoleTransport()],
});import { Logger, FileTransport } from "zario";
const logger = new Logger({
transports: [
new FileTransport({
path: "./logs/app.log",
maxSize: 10 * 1024 * 1024,
maxFiles: 5,
}),
],
});
logger.info("This log is written to a file");Documentation:
| Section | Description |
|---|---|
| π Introduction | Philosophy, core features, and common use cases. |
| π Getting Started | Detailed installation and environment auto-configuration. |
| βοΈ Configuration | Full reference for all logger options, custom levels, and colors. |
| π API Reference | Detailed API documentation for the Logger class and utilities. |
| π Transports | Guide to Console, File, HTTP, CircuitBreaker, and DeadLetterQueue transports. |
| π§© Advanced Usage | Filters, Enrichers (Structured Logging), and Aggregators. |
| π Log Formats | Specification for Text and JSON output formats. |
| πΊοΈ Roadmap | Future plans and upcoming features. |
| π Benchmarks | Performance comparison with other logging libraries. |
We welcome contributions! Whether it's bug reports, feature requests, or code contributions. Please see our Contributing Guide for more details.
This project is licensed under the MIT License - see the LICENSE file for full details.
