flexi_logger 0.18.0

An easy-to-configure and flexible logger that writes logs to stderr 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
use flexi_logger::*;
use log::*;
#[test]
fn test_default_files_dir_rot() {
    Logger::try_with_str("info")
        .unwrap()
        .log_to_file(FileSpec::default().directory("log_files"))
        .rotate(Criterion::Size(2000), Naming::Numbers, Cleanup::Never)
        .start()
        .unwrap_or_else(|e| panic!("Logger initialization failed with {}", e));

    error!("This is an error message");
    warn!("This is a warning");
    info!("This is an info message");
    debug!("This is a debug message - you must not see it!");
    trace!("This is a trace message - you must not see it!");
}