Browse Source

puts warnings mod behind a feature gate

master
Jonathan Strong 6 years ago
parent
commit
6541d5ffb9
3 changed files with 15 additions and 11 deletions
  1. +11
    -4
      Cargo.toml
  2. +3
    -1
      src/influx.rs
  3. +1
    -6
      src/lib.rs

+ 11
- 4
Cargo.toml View File

@@ -1,19 +1,25 @@
[package]
name = "logging"
version = "0.4.0"
version = "0.4.1"
authors = ["Jonathan Strong <jstrong@legis.io>"]

[[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 = []

+ 3
- 1
src/influx.rs View File

@@ -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<Warning>) -> 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() {


+ 1
- 6
src/lib.rs View File

@@ -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 {


Loading…
Cancel
Save