basic_use/
basic_use.rs

1use x_log::*;
2
3#[derive(Debug)]
4struct Position {
5    x: f32,
6    y: f32
7}
8
9fn main() {
10    // you can also delete this
11    x_log::init_once(Some(Options {
12        print_level: true,
13        timezone: Timezone::Local,
14        colored: true,
15        ..Default::default()
16    }));
17
18    let file = file!();
19
20    trace!("This is an example message. file -> {}", file);
21    debug!("This is an example message.");
22    info!("This is an example message.");
23    warn!("This is an example message.");
24    error!("This is an example message.");
25
26    let pos = Position { x: 3.234, y: -1.223 };
27
28    info!("x is {} and y is {}",
29       if pos.x >= 0.0 { "positive" } else { "negative" },
30       if pos.y >= 0.0 { "positive" } else { "negative" });
31
32    valf!(pos, pos);
33    valf!(pos, pos);
34}
35