Skip to content

dev-dami/zario

Zario

Fast and simple logging library for TypeScript

npm version license downloads bundle size

Japanese


FastSimpleZero DependenciesTypeScript Native


Quick Start · Documentation · Contributing


separator


Features

  • Zero dependencies — nothing to install, nothing to break
  • Simple APIlogger.info(), logger.warn(), logger.error()
  • Flexible formatting — plain text or structured JSON
  • Multiple transports — Console, File (rotation + compression), HTTP (with retry)
  • Child loggers — scoped logging for modules or requests
  • Async mode — non-blocking writes for high-throughput apps
  • Customizable — custom log levels, colors, and filters

Ecosystem

We provide official adapters to easily integrate Zario into your favorite web frameworks:

Comparison with Winston and Pino

To ensure a fair and objective evaluation, we benchmarked Zario against Winston and Pino under identical conditions:

  1. Bundle Size: Measured using esbuild to bundle and minify a minimal setup importing each package and performing a single logging operation.
  2. Performance: Measured by logging 100,000 iterations to a shared Node.js Writable null stream (to isolate formatting and framework overhead from system I/O latency).

Factual Comparison

Metric / Feature Zario (Lean) Zario (Full) Pino Winston
Bundle Size (Minified) 11.80 KB 24.72 KB 60.65 KB 143.92 KB
Speed (Simple Log) 586k ops/sec 586k ops/sec 942k ops/sec 177k ops/sec
Speed (With Metadata) 391k ops/sec 391k ops/sec 839k ops/sec 110k ops/sec
Runtime Dependencies 0 0 8+ 10+
Resilience Transports Built-in (via setup) Built-in (out-of-the-box) Needs custom streams Needs custom transports
Tree-shakeability Yes Yes No No

Installation

npm install zario

Quick Start

import { 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 });

Child Logger

const requestLogger = logger.createChild({
  context: { scope: "request" },
});
requestLogger.info("Incoming request");

JSON Logging

import { Logger, ConsoleTransport } from "zario";

const jsonLogger = new Logger({
  json: true,
  transports: [new ConsoleTransport()],
});

File Transport

import { Logger, FileTransport } from "zario";

const logger = new Logger({
  transports: [
    new FileTransport({
      path: "./logs/app.log",
      maxSize: 10 * 1024 * 1024,
      maxFiles: 5,
    }),
  ],
});

Lean Import

If you only need the core logger:

import { Logger } from "zario/logger";

Documentation

Section Description
Configuration Logger options, custom levels, and colors
API Reference Logger class and utilities
Transports Console, File, HTTP, CircuitBreaker, DeadLetterQueue
Advanced Usage Filters, enrichers, aggregators, async mode
Log Formats Text and JSON output spec
Benchmarks Performance comparison with other libraries
Roadmap Future plans

Contributing

Bug reports, feature requests, and pull requests welcome. See Contributing Guide.

License

MIT License


Star this repository if you find it useful


Back to Top

About

A Minimal and Fast Logging Solution for TypeScript

Topics

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors