1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#[cfg(all(
    not(target_family = "windows"),
    feature = "termcolor",
    not(feature = "paris")
))]
use log::*;
#[cfg(all(not(target_family = "windows"), feature = "termcolor"))]
use simplelog::*;

#[cfg(all(not(target_family = "windows"), feature = "termcolor"))]
fn main() {
    let config = ConfigBuilder::new()
        .set_level_color(Level::Error, Some(Color::Rgb(191, 0, 0)))
        .set_level_color(Level::Warn, Some(Color::Rgb(255, 127, 0)))
        .set_level_color(Level::Info, Some(Color::Rgb(192, 192, 0)))
        .set_level_color(Level::Debug, Some(Color::Rgb(63, 127, 0)))
        .set_level_color(Level::Trace, Some(Color::Rgb(127, 127, 255)))
        .build();

    TermLogger::init(
        LevelFilter::Trace,
        config,
        TerminalMode::Stdout,
        ColorChoice::Auto,
    )
    .unwrap();
    error!("Red error");
    warn!("Orange warning");
    info!("Yellow info");
    debug!("Dark green debug");
    trace!("Light blue trace");
}

#[cfg(any(target_family = "windows", not(feature = "termcolor")))]
fn main() {
    println!("this example requires the termcolor feature and a non-Windows OS.");
}