npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

zario

v0.3.1

Published

A minimal, fast logging library for Node.js.

Readme

zario

A minimal, fast logging library for Node.js with TypeScript support.

What's New in 0.2.11

  • Added HTTP transport support with new HttpTransport class
  • Added log batching functionality for efficient writes
  • Added compression support (.gz for gzip, .zz for deflate) for rotated files
  • Enhanced rotation with maxSize, maxFiles, and configurable compression

Installation

npm install zario

Quick Start

import { Logger, ConsoleTransport } from "zario";

const logger = new Logger({
  level: "info",
  colorize: true,
  transports: [new ConsoleTransport()],
  prefix: "[MyApp]",
});

// Start logging
logger.info("🚀 Server started on port 3000");
logger.warn("⚠️ High memory usage detected");
logger.error("❌ Database connection failed", { code: 500 });

API Documentation

Logger Constructor Options

| Option | Type | Description | | -------------- | -------- | ----------------------- | | level | string | Log level threshold | | json | boolean| Output in JSON format | | timestamp | boolean| Include timestamps | | prefix | string | Prepended label | | transports | array | Where logs are written (with transport-specific options like path, maxSize, maxFiles, compression, batchInterval, compressOldFiles for file transport) | | customLevels | object | Define custom log levels and their priorities | | customColors | object | Assign colors to custom log levels |

Log Levels

| Level | Method | Use Case | |----------|---------------|----------------------------| | 🔍 DEBUG | logger.debug() | Detailed debugging info | | ✨ INFO | logger.info() | General information | | ⚠️ WARN | logger.warn() | Warning messages | | ❌ ERROR | logger.error() | Error messages | | 🤫 SILENT | logger.silent()| Not output to console | | 📝 BORING | logger.boring()| Lowest priority messages |

Transports

Console Transport

import { Logger, ConsoleTransport } from "zario";

const logger = new Logger({
  transports: [
    new ConsoleTransport({ colorize: true })
  ]
});

File Transport

import { Logger, FileTransport } from "zario";

const logger = new Logger({
  transports: [
    new FileTransport({
      path: './logs/app.log',
      maxSize: 10485760, // 10MB in bytes
      maxFiles: 5,
      compression: 'gzip', // 'gzip', 'deflate', or 'none' (default: 'none')
      batchInterval: 1000, // Batch interval in ms (0 to disable, default: 0)
      compressOldFiles: true // Whether to compress old files during rotation (default: true)
    })
  ]
});

HTTP Transport

import { Logger, HttpTransport } from "zario";

const logger = new Logger({
  transports: [
    new HttpTransport({
      url: 'https://api.example.com/logs',
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
        'Authorization': 'Bearer your-token-here'
      },
      timeout: 10000,  // Request timeout in ms
      retries: 3       // Number of retry attempts
    })
  ]
});

Methods

  • logger.debug(message, metadata?) - Debug level logging
  • logger.info(message, metadata?) - Info level logging
  • logger.warn(message, metadata?) - Warning level logging
  • logger.error(message, metadata?) - Error level logging
  • logger.logWithLevel(level, message, metadata?) - Log a message at an arbitrary/custom level
  • logger.createChild(options) - Creates a child logger with inherited settings
  • logger.setLevel(level) - Change the logger level at runtime
  • logger.setFormat(format) - Set the output format to text or json

Usage Examples

Basic Usage

import { Logger, ConsoleTransport } from "zario";

const logger = new Logger({
  level: "info",
  colorize: true,
  transports: [new ConsoleTransport()]
});

logger.info("Application started");
logger.error("Something went wrong", { userId: 123 });

JSON Format

const logger = new Logger({ json: true });

Custom Levels & Colors

import { Logger, ConsoleTransport } from "zario";

const logger = new Logger({
  level: 'info',
  customLevels: {
    'success': 6,      // Higher priority than error (5).
    'verbose': 1,      // Lower priority than debug (2).
    'critical': 7,     // Highest priority.
  },
  customColors: {
    'success': 'green',
    'verbose': 'cyan',
    'critical': 'brightRed',
  },
  transports: [
    new ConsoleTransport()
  ]
});

// Using custom levels.
logger.logWithLevel('success', 'This is a success message in green!');
logger.logWithLevel('verbose', 'This is a verbose message in cyan');
logger.logWithLevel('critical', 'This is a critical message in bright red');

Child Loggers

const main = new Logger({ prefix: "[APP]" });
const db = main.createChild({ prefix: "[DB]" });

main.info("App initialized");
db.error("Connection timeout");

Multiple Transports

import { Logger, ConsoleTransport, FileTransport } from "zario";

const logger = new Logger({
  level: 'info',
  transports: [
    new ConsoleTransport(),
    new FileTransport({ path: './logs/app.log' })
  ]
});