npm.io
0.8.5 • Published 6d ago

zario

Licence
MIT
Version
0.8.5
Deps
0
Size
554 kB
Vulns
0
Weekly
103

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

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

Keywords