Move src/logger.rs into logger/ crate to unify logging across the workspace

This commit is contained in:
Michael Vines
2018-12-14 12:36:50 -08:00
committed by Grimes
parent d45fcc4381
commit 6ac466c0a4
55 changed files with 158 additions and 178 deletions

16
logger/src/lib.rs Normal file
View File

@ -0,0 +1,16 @@
//! The `logger` module provides a setup function for `env_logger`. Its only function,
//! `setup()` may be called multiple times.
use env_logger;
use std::sync::{Once, ONCE_INIT};
static INIT: Once = ONCE_INIT;
/// Setup function that is only run once, even if called multiple times.
pub fn setup() {
INIT.call_once(|| {
env_logger::Builder::from_default_env()
.default_format_timestamp_nanos(true)
.init();
});
}