#low-latency #logging #level #cpu #file #🪵

logflume

A low latency logging library 🪵

5 releases

new 0.0.5 Apr 25, 2024
0.0.4 Apr 10, 2024
0.0.3 Apr 9, 2024
0.0.2 Apr 8, 2024
0.0.1 Apr 8, 2024

#36 in #low-latency

Download history 291/week @ 2024-04-08 117/week @ 2024-04-22

408 downloads per month

MIT license

14KB
255 lines

Low latency logging library for Rust 🪵

Example

use logflume::{info, Level};
use std::fs;

fn main() {
    logflume::Logger::new()
        .level(Level::Debug)
        .cpu(2)
        .file("my-log-file.log")
        .init()
        .expect("Unable to construct logger");

    for i in 1..1_000_001 {
        info!("number {}", i);
    }
    logflume::logger().flush();
}

logflume is an asynchronous logger, it hands of all the formatting and writing of logs to another thread to minimize latency on the calling thread. A blocking call to logflume::logger::flush() is needed if you want to wait for all log messages to be processed, it is advisable to do this before the program shuts down to guarantee that all logs are persisted.

Dependencies

~9–21MB
~284K SLoC