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
use loga::{
    ea,
    Log,
};

fn main() {
    let log = Log::new_root(loga::INFO);
    log.log(loga::INFO, "Hello");
    log.log_with(loga::INFO, "Hello", ea!(xyz = "abc", system = "primary"));
    log.log_err(
        loga::INFO,
        loga::err_with(
            "This is a sub-error",
            ea!(system = "secondary"),
        ).context_with("Got an error", ea!(context = "Additional details")),
    );
    log.log_err(
        loga::INFO,
        loga::agg_err_with(
            "This is a sub-error",
            vec![loga::err("Problem 1"), loga::err_with("Problem 2", ea!(client = "a:b:c:d"))],
            ea!(system = "secondary"),
        ).context_with("Got an error", ea!(context = "Additional details")),
    );
    let log2 = Log::new_root(loga::INFO).fork(ea!(logger = "log2"));
    log2.log_err(
        loga::INFO,
        loga::agg_err_with(
            "This is a sub-error",
            vec![log2.err("Problem 1"), log2.err_with("Problem 2", ea!(client = "a:b:c:d"))],
            ea!(system = "secondary"),
        ).context_with("Logging with logger details", ea!(context = "Additional details")),
    );
}