Browse Source

misc

master
Jonathan Strong 6 years ago
parent
commit
92dd50c2a4
3 changed files with 18 additions and 2 deletions
  1. +4
    -1
      Cargo.toml
  2. +4
    -1
      src/influx.rs
  3. +10
    -0
      src/lib.rs

+ 4
- 1
Cargo.toml View File

@@ -11,7 +11,7 @@ hyper = "0.10"
termion = "1.4.0"
# pub-sub = "2.0"
slog = "2.0.6"
sloggers = "0.2"
# sloggers = "0.2"
slog-term = "2"
# chashmap = "2"
ordermap = "0.3"
@@ -20,6 +20,8 @@ uuid = { version = "0.5", features = ["serde", "v4"] }
hdrhistogram = "6"
slog-async = "2"

sloggers = { path = "../sloggers" }

decimal = { path = "../decimal", version = "2" }

windows = { path = "../windows", version = "0.1" }
@@ -35,3 +37,4 @@ localhost = []
harrison = []
washington = []
scholes = []
no-influx-buffer = []

+ 4
- 1
src/influx.rs View File

@@ -234,7 +234,10 @@ impl InfluxWriter {
pub fn new(host: &'static str, db: &'static str, log_path: &str, buffer_size: u16) -> Self {
let (tx, rx): (Sender<Option<OwnedMeasurement>>, Receiver<Option<OwnedMeasurement>>) = channel();
let logger = file_logger(log_path, LOG_LEVEL); // this needs to be outside the thread
let buffer_size = if cfg!(feature = "trace") { 0u16 } else { buffer_size };

#[cfg(feature = "no-influx-buffer")]
let buffer_size = 0u16;

let thread = thread::Builder::new().name(format!("mm:inflx:{}", db)).spawn(move || {
debug!(logger, "initializing url";
"DB_HOST" => host,


+ 10
- 0
src/lib.rs View File

@@ -62,12 +62,22 @@ pub fn file_logger(path: &str, level: Severity) -> slog::Logger {
builder.build().unwrap()
}

pub fn truncating_file_logger(path: &str, level: Severity) -> slog::Logger {
let mut builder = FileLoggerBuilder::new(path);
builder.level(level);
builder.timezone(TimeZone::Utc);
builder.truncate();
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 {
let drain = file_logger(path, level);
let async_drain =


Loading…
Cancel
Save