diff --git a/Cargo.toml b/Cargo.toml index d17ee84..1d0e182 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,19 +1,25 @@ [package] name = "logging" -version = "0.4.0" +version = "0.4.1" authors = ["Jonathan Strong "] +[[example]] +name = "zmq-logger" +path = "examples/zmq-logger.rs" +required-features = ["warnings"] + +[[example]] +name = "hist-interval" +path = "examples/hist-interval.rs" + [dependencies] zmq = "0.8" influent = "0.4" chrono = { version = "0.4", features = ["serde"] } hyper = "0.10" termion = "1.4.0" -# pub-sub = "2.0" slog = "2.0.6" -# sloggers = "0.2" slog-term = "2" -# chashmap = "2" ordermap = "0.3" fnv = "1" uuid = { version = "0.5", features = ["serde", "v4"] } @@ -39,3 +45,4 @@ washington = [] scholes = [] no-influx-buffer = [] disable-short-uuid = [] +warnings = [] diff --git a/src/influx.rs b/src/influx.rs index e9dd953..b3bb19a 100644 --- a/src/influx.rs +++ b/src/influx.rs @@ -24,6 +24,7 @@ use decimal::d128; use uuid::Uuid; use super::{nanos, file_logger, LOG_LEVEL}; +#[cfg(feature = "warnings")] use warnings::Warning; const WRITER_ADDR: &'static str = "ipc:///tmp/mm/influx"; @@ -511,6 +512,7 @@ pub fn serialize_owned(measurement: &OwnedMeasurement, line: &mut String) { } } +#[cfg(feature = "warnings")] #[deprecated(since="0.4", note="Replace with InfluxWriter")] pub fn writer(warnings: Sender) -> thread::JoinHandle<()> { thread::Builder::new().name("mm:inflx-wtr".into()).spawn(move || { @@ -861,7 +863,7 @@ mod tests { }); } - + #[cfg(feature = "warnings")] #[test] #[ignore] fn it_spawns_a_writer_thread_and_sends_dummy_measurement_to_influxdb() { diff --git a/src/lib.rs b/src/lib.rs index c026570..b487026 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -37,6 +37,7 @@ use sloggers::file::FileLoggerBuilder; use slog::Drain; pub mod influx; +#[cfg(feature = "warnings")] pub mod warnings; pub mod latency; pub mod hist; @@ -74,12 +75,6 @@ pub fn truncating_file_logger(path: &str, level: Severity) -> slog::Logger { builder.build().unwrap() } -// #[cfg(any(test, feature = "test"))] -// pub fn file_logger(_: &str, _: Severity) -> slog::Logger { -// use slog::*; -// Logger::root(Discard, o!()) -// } - #[deprecated(since="0.4.0", note="Turns out the file logger in sloggers uses async, \ making the async here duplicative")] pub fn async_file_logger(path: &str, level: Severity) -> slog::Logger {