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
38
39

// for logging (debug mostly, switched at compile time in cargo.toml)


use lazy_static::lazy_static;

pub mod prelude;
pub mod types;
pub mod scsg;
pub mod svrg;
pub mod sag;
pub mod mnist;
mod monitor;
pub mod applis;

lazy_static! {
    static ref LOG: u64 = {
        let res = init_log();
        res
    };
}

// install a logger facility
fn init_log() -> u64 {
    let res = env_logger::try_init();
    if res.is_ok() {
        println!("\n ************** initializing logger *****************\n");  
    }
    return 1;
}

#[cfg(test)]
mod tests {
    #[test]
    // initialize once log system for tests.
    fn init_log() {
        env_logger::try_init().unwrap();
    }
}  // end of tests