JSPM

  • Created
  • Published
  • Downloads 134
  • Score
    100M100P100Q98592F
  • License MIT

🌌 Logging built for humans, everywhere JavaScript runs.

Package Exports

  • logry
  • logry/plugins

Readme

Logry

Console-first, native, and universal logging for JavaScript.
A modular pipeline for structured and extensible log flows.

NPM version Bundle size Coverage Status TypeScript License

Built for human-readable logs first, not added later.

Features

  • 🌐 Runtime-agnostic — consistent logging across all JavaScript runtimes, built on the native console.
  • 🌊 Hook-based pipeline — a composable logging flow, fully customizable with hooks and plugins.
  • 🎨 Render & styling — fine-grained control over layout and visual presentation.

Installation

# npm
npm install logry

# yarn
yarn add logry

# pnpm
pnpm add logry

Or load it directly from a CDN:

import { logry } from "https://cdn.jsdelivr.net/npm/logry/+esm";

Quick Start

The examples below work wherever JavaScript runs.

Create a logger

  • Create a logger instance for consistent configuration across your application.
import { logry } from "logry";

const logger = logry();

logger.error("Authentication failed.");

Standalone logging

  • Use standalone methods for simple, one-off logs.
import { error } from "logry";

error("Unexpected error.");

Configuration

Configure a logger when creating it, or adjust behavior for a single log entry.

  • Create-time configuration
const logger = logry({
  id: "my-logger", // Logger identity
  level: "trace", // Minimum log level
  scope: ["api", "auth"], // Default scope
  context: { ver: "1.2.1" }, // Shared context for all logs
  preset: "pretty", // Preset for default behavior

  // Pipeline configurations
  normalizeConfig: { meta: { errorStackLines: 5 } },
  formatConfig: { timestamp: { format: "iso" } },
  renderConfig: { message: { prefix: "⚡️ ", marginAfter: 1 } },
  printConfig: { consoleMode: "log", lineBreaksAfter: 1 },
});
  • Runtime options
logger.warn("A msg.", { scope: "login", printConfig: { lineBreaksBefore: 2 } });

Method overloads

Log methods support flexible argument patterns:

// log(message, options?)
log("Message", options);

// log(meta, options?)
log({ key: "value" }, options);

// log(message, meta, options?)
log("Message", { key: "value" }, options);

Hooks & Plugins

Logry is built around a hook-based pipeline,
making it easy to customize behavior or build plugins.

Official Plugins

  1. Discord plugin — send logs to Discord via webhooks
import { discordPlugin } from "logry/plugins";

logger.use(discordPlugin("https://discord.com/api/webhooks/13869..."));

Rocket More official plugins are under development.