log-io 1.0.0

Structured logging pipeline for Rust. Zero-allocation fast path, JSON / logfmt / human-readable outputs, context propagation (request-id, trace-id), per-module filtering, async-safe sinks. An IO pipeline for log records, not a wrapper around log+tracing.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//! Attach service-level fields once at builder time and have them
//! appear on every record without the call sites repeating them.

use log_io::{Level, Logger};

fn main() {
    let logger = Logger::builder()
        .level(Level::Info)
        .with_default_field("service", "billing")
        .with_default_field("version", env!("CARGO_PKG_VERSION"))
        .with_default_field("env", "production")
        .stdout_json()
        .build();

    log_io::info!(logger, "boot");
    log_io::info!(logger, "ready", port = 8443_u32);
    log_io::warn!(logger, "slow query", query_ms = 1280_u64);
}