Skip to main content

Airplane Departure Transporter

When a log is passed to a Transporter, it flows through three clear stages:

  1. 🔀 Normalization — Ensures a consistent, structured shape.
  2. 🎨 Formatting — Transforms the data into a readable format.
  3. 🖨 Output — Sends the final log to the destination console.

Note:
In Node.js, NodeConsoleTransporter lazily appends fields like pid and hostname.
This is done asynchronously to ensure that Logger.log() remains synchronous and returns immediately.

Sparkles Built-in Transporters

Logry ships with platform-aware console transporters,
so your logs always show up in the right place—without any extra setup 🛠️

PlatformTransporterOutput target
Node.jsNodeConsoleTransporterTerminal console
BrowserBrowserConsoleTransporterBrowser developer console
EdgeEdgeConsoleTransporterPlatform console (plain text)

Each transporter activates only in its matching runtime, and does nothing otherwise.

Sparkles Universal by Default

Importing from "logry" gives you a universal logger with both Node and browser transporters attached:

import { logry } from "logry"; // Includes both NodeConsoleTransporter and BrowserConsoleTransporter

logry.info("Hello from anywhere");

In Node.js, logs go to the terminal. In the browser, they appear in the browser console.
⚡️ No extra configuration required.

Sparkles Platform-Specific Variants

To reduce bundle size or fine-tune behavior, you can import from a platform-specific entry point:

Import PathPlatformBound Transporter
"logry/node"Node.jsNodeConsoleTransporter
"logry/browser"BrowserBrowserConsoleTransporter
"logry/edge"EdgeEdgeConsoleTransporter

Each variant includes only the relevant transporter for its environment.

import { logry } from "logry/node"; // Logs only to terminal (no browser logic)

Sparkles Edge Runtime Support

The "logry/edge" export is optimized for environments like Cloudflare Workers and other serverless platforms.
It uses EdgeConsoleTransporter, a minimal transporter that prints plain-text logs to the platform’s console.

⚠️ Always use logry/edge in Edge runtimes.
Other versions rely on Node.js APIs and may fail to run.

import { logry } from "logry/edge";

logry.info("Hello from the Edge");

Sparkles Design Principle: Console Only

🔮 Unlike traditional loggers that mix console output with side-effects,
Logry keeps things clean and focused.
Transporters handle console output only; for other log deliveries, use Handlers.