diff --git a/Cargo.toml b/Cargo.toml index c8f3b9b..688226b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,3 +27,4 @@ pubsub = { path = "../pubsub" } [features] no-thrash = [] trace = [] +test = [] diff --git a/src/influx.rs b/src/influx.rs index 8624db6..088492c 100644 --- a/src/influx.rs +++ b/src/influx.rs @@ -216,12 +216,12 @@ impl InfluxWriter { let (tx, rx) = channel(); let logger = file_logger(log_path, Severity::Info); let thread = thread::spawn(move || { - info!(logger, "initializing url"; + debug!(logger, "initializing url"; "DB_HOST" => host, "DB_NAME" => db); let url = Url::parse_with_params(&format!("http://{}:8086/write", host), &[("db", db), ("precision", "ns")]).expect("influx writer url should parse"); let client = Client::new(); - info!(logger, "initializing buffers"); + debug!(logger, "initializing buffers"); let mut meas_buf = String::with_capacity(32 * 32 * 32); let mut buf = String::with_capacity(32 * 32 * 32); let mut count = 0; @@ -319,7 +319,7 @@ impl InfluxWriter { } } - crit!(logger, "goodbye"); + debug!(logger, "goodbye"); }); InfluxWriter { diff --git a/src/lib.rs b/src/lib.rs index 1bf90b5..4149355 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -44,7 +44,7 @@ pub fn nanos(t: DateTime) -> u64 { (t.timestamp() as u64) * 1_000_000_000_u64 + (t.timestamp_subsec_nanos() as u64) } -#[cfg(not(test))] +#[cfg(not(any(test, feature = "test")))] pub fn file_logger(path: &str, level: Severity) -> slog::Logger { let mut builder = FileLoggerBuilder::new(path); builder.level(level); @@ -53,7 +53,7 @@ pub fn file_logger(path: &str, level: Severity) -> slog::Logger { } -#[cfg(test)] +#[cfg(any(test, feature = "test"))] pub fn file_logger(path: &str, level: Severity) -> slog::Logger { use slog::*; Logger::root(Discard, o!())