Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

RLG — RustLogs

A high-performance structured logging library for Rust.

RLG pushes log events into a lock-free ring buffer and formats them on a background thread. Your application thread never blocks on I/O.

Core Features

  • 14 output formats — JSON, NDJSON, OTLP, MCP, GELF, CEF, ECS, Logfmt, CLF, W3C, Syslog, Logstash, Log4j-XML, Apache Error
  • Fluent builder APILog::info("msg").with("key", val).fire()
  • Platform-native sinks — macOS os_log, Linux journald, file, stdout
  • log and tracing bridges — drop-in replacement for existing Rust logging
  • TUI dashboard — real-time throughput and error metrics in-terminal
  • Log rotation — size, time, date, or count-based policies

Quick Start

[dependencies]
rlg = "0.0.7"
use rlg::init;
use rlg::log::Log;

fn main() {
    let _guard = init::init().expect("failed to initialise RLG");

    Log::info("Service started")
        .with("version", "0.0.7")
        .fire();
}
// FlushGuard drops here — all buffered events flush automatically.
  • Getting Started — install, configure, and emit your first log
  • Fluent API — chain .with(), .component(), .format(), then .fire()
  • Engine Design — how the ring buffer and background flusher work
  • Safety — MIRI verification and FFI boundary guarantees
  • API Reference — auto-generated Rustdoc