Fibre Logging

Sync and async logging that unifies the log and tracing ecosystems, driven by external configuration.

fibre_logging is a logging backend for Rust applications that takes its whole setup from a YAML file. Levels, destinations and output formats live in fibre_logging.yaml instead of in code, so an operator can turn up the detail for one module or send a noisy dependency to its own file by editing that file and restarting the program, without recompiling it.

It collects events from both the log and tracing crates into one pipeline. Your own code can use whichever macros you like. Dependencies that still use log end up in the same place as your tracing events, with the same filters and formats applied.

A config has three parts. Appenders say where events go. The kinds are console, file, rolling_file (rolls by time or size and keeps a set number of old files) and custom (a channel your application reads LogEvent values from). Encoders say what a line looks like: a Log4j-style pattern or json_lines. Loggers match targets such as my_app::db, set a level and pick appenders. Setting additive: false keeps a module's events out of the root logger's output.

File writes happen on background threads, so a slow disk does not stall the code that logs. Initialisation returns a guard. Dropping it at the end of main flushes what is still buffered. There is also a debug-only debug_report appender that gathers events and counters in memory, plus an optional tokio-console feature.

let _logging = fibre_logging::init::init_from_file(std::path::Path::new("fibre_logging.yaml"))
    .expect("failed to start logging");
log::info!("started");

Licensed under MPL-2.0. Source at https://github.com/excsn/fibre/tree/main/logging and API docs at https://docs.rs/fibre_logging.

Tutorials