simple/
main.rs

1use std::fs::File;
2
3use redox_log::{OutputBuilder, RedoxLogger};
4use log::{debug, error, info, trace, warn};
5
6fn main() {
7    dbg!(RedoxLogger::new()
8        .with_output(
9            OutputBuilder::with_endpoint(
10                File::create("file.log").expect("failed to open log file")
11            )
12            .with_filter(log::LevelFilter::Trace)
13            .build()
14        )
15        .with_output(
16            OutputBuilder::stdout()
17                .with_filter(log::LevelFilter::Debug)
18                .with_ansi_escape_codes()
19                .build()
20        )
21        .with_process_name("simple".into())
22        .enable().expect("failed to enable"));
23    info!("Example started");
24    debug!("example started with log file: {}", "file.log");
25    trace!("useless comment");
26    warn!("useless comment is useless");
27    error!("deadlock");
28    loop {}
29}