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
use flexi_logger::{
    Age, Cleanup, Criterion, Duplicate, FileSpec, FlexiLoggerError, LevelFilter, Logger, Naming,
};
use std::{thread::sleep, time::Duration};

fn main() -> Result<(), FlexiLoggerError> {
    Logger::with(LevelFilter::Info)
        .rotate(
            Criterion::Age(Age::Second),
            Naming::TimestampsCustomFormat {
                current_infix: None,
                format: "%Y%m%d_%H%M%S",
            },
            Cleanup::Never,
        )
        .log_to_file(FileSpec::default())
        .duplicate_to_stdout(Duplicate::All)
        .start()?;

    log::info!("start");
    for step in 0..10 {
        log::info!("step {step}");
        sleep(Duration::from_millis(250));
    }
    log::info!("done");

    Ok(())
}