500+ downloads/week elysia-js v5.2.2 MIT

Beautiful logs for
Elysia.js apps

An elegant, fast, and type-safe logging middleware for Elysia.js. Take absolute control of your request feeds with colorized square console streams and structured file records.

$ bun add @rasla/logify
bun run server.ts
[17:40:00] INFO 🦊 Elysia server started on port 3000

Designed for modern Bun apps

Elysia Native

Fitted precisely to Elysia's lifecycle events. Zero setup with high-resolution execution timelines and zero overhead.

Colorized Streams

Color-coded methods and HTTP status symbols (2xx/3xx/4xx/5xx) so your eyes track health in real time.

Structured File Logging

Autocreates log folders and writes organized chronological entries to disk for production reviews.

IP Resolution

Resolves and appends inbound client IPs, including fallbacks for proxy servers behind standard cloud loads.

Path Filtering

Bypass request logging for system endpoints (like /health, /metrics, or assets) to keep logs clean.

100% Type-Safe

Engineered in TypeScript. Ships with type auto-completion and rigid validation for all customization setups.

Three Lines Integration

Simply load and register the logger() middleware into your Elysia chain. It begins tracking your incoming web traffic instantly, printing clear, beautifully aligned console lines with zero custom parameters required.

Want specific formats or filters? Just supply your properties to the logger(...) options.

index.ts
import { Elysia } from "elysia";
import { logger } from "@rasla/logify";

const app = new Elysia()
  .use(logger())
  .get("/", () => "🦊 Hello World!")
  .listen(3000);

console.log("🦊 Elysia server running at localhost:3000");
service.ts
import { 
  initializeLogger, 
  debug, 
  info, 
  warn, 
  error 
} from "@rasla/logify";

// Configure once in your entry file
initializeLogger({
  level: "debug",
  file: true,
  filePath: "./logs/app.log"
});

// Execute log commands anywhere in your application
debug("Init db connection pool...");
info("System health checked: OK");
warn("Database query latency: 154ms");
error("Failed to retrieve user ID: 219");

Application-Wide Messaging

Logify packs a global instance. Instead of injecting custom middleware variables through domain components, simply instantiate Logify's settings once in your setup file via initializeLogger(...).

You can then import clean functions directly: debug(), info(), warn(), and error(). Keep your layers separated and imports simple.

Tailor Every Property

Configure outputs, toggle disk writes, bypass custom route endpoints, and customize terminal strings using rich, modular formatting tokens.

Explore a reference options structure you can feed directly into your initialization configurations:

options.ts
{
  // Console logs (default: true)
  console: true,

  // File logging (default: false)
  file: true,
  filePath: './logs/app.log',

  // Log level limit (default: 'info')
  level: 'debug', // 'debug' | 'info' | 'warn' | 'error'

  // Skip routes (avoid health or assets spam)
  skip: ['/health', '/metrics'],

  // Display client IP (default: false)
  includeIp: true,

  // String format tokens (see right playground!)
  format: '[{timestamp}] {level} [{method}] {path} - {statusCode} {duration}ms'
}

Log Formatter Playground

Build your custom terminal output view. Modify the format string below, or click tokens to append them, and see the immediate output.

Available Tokens (Click to append)

Terminal Preview Output LIVE

Token Reference

Token Resolves To Terminal Preview Example
{timestamp} ISO-8601 formatted global time string 2026-05-21T17:40:00.123Z
{level} Colorized severity tag (INFO, WARN, ERROR) INFO
{method} HTTP request verb (GET, POST, PUT, DELETE) GET
{path} Target endpoint relative pathname /api/users
{statusCode} Dynamic HTTP status code (green/yellow/red) 200
{duration} Request execution time measured in ms 8.4ms
{ip} The client IP resolve (e.g. proxy header fallback) 127.0.0.1