1#[macro_use]
2extern crate lazy_static;
3
4#[macro_use]
5mod macros;
6
7pub mod fmt;
8pub mod logging;
9
10use chrono::Duration;
11pub use logging::LogLocation;
12pub use logging::Logger;
13use std::env;
14use std::fs;
15use std::sync::RwLock;
16
17lazy_static! {
18 pub static ref LOGGER: RwLock<Logger<fs::File>> = {
19 let qpath = env::temp_dir().join("q");
20 let file = fs::OpenOptions::new()
21 .write(true)
22 .create(true)
23 .append(true)
24 .open(&qpath)
25 .expect(&format!("Unable to open log file {:?}", qpath));
26 RwLock::new(Logger::new(file))
27 };
28}
29
30pub fn set_header_interval(d: Duration) {
35 LOGGER.write().unwrap().header_interval = d;
36}