flexi_logger 0.31.8

An easy-to-configure and flexible logger that writes logs to stderr or stdout and/or to files. It allows custom logline formats, and it allows changing the log specification at runtime. It also allows defining additional log streams, e.g. for alert or security messages.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
mod test_utils;

use flexi_logger::{DeferredNow, Logger};
use log::*;

#[test]
#[should_panic(expected = "offset is already initialized not to enforce UTC")]
fn test_force_utc_1_panic() {
    let _ = Logger::try_with_str("info")
        .unwrap()
        .format_for_stderr(flexi_logger::detailed_format)
        .start()
        .unwrap_or_else(|e| panic!("Logger initialization failed with {e}"));
    info!("MUST BE REACHED");
    DeferredNow::force_utc();
    panic!("MUST NOT BE REACHED");
}