Skip to content

Commit

Permalink
Merge branch 'rotation' of github.com:AliceLanniste/wickdb into rotation
Browse files Browse the repository at this point in the history
  • Loading branch information
AliceLanniste committed May 6, 2020
2 parents 9a0e1c1 + 56110d8 commit f56480a
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/logger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ use crate::db::filename::{generate_filename, FileType};
use crate::error::Result;
use crate::storage::{File, Storage};


use log::{LevelFilter, Log, Metadata, Record};
use slog::{o, Drain, Level};

Expand Down Expand Up @@ -75,6 +76,8 @@ impl Logger {
};
Self { inner, level }
}


}

impl Log for Logger {
Expand Down Expand Up @@ -116,6 +119,7 @@ impl Log for Logger {
}
}
fn flush(&self) {}

}

fn log_to_slog_level(level: log::Level) -> Level {
Expand Down Expand Up @@ -146,8 +150,10 @@ impl<F: File> FileBasedDrain<F> {
rotators: vec![],
new_file: Box::new(new_file),
}

}


fn add_rotator<R: 'static + Rotator>(mut self, rotator: R) -> Self {
if rotator.is_enabled() {
self.rotators.push(Box::new(rotator));
Expand Down Expand Up @@ -254,8 +260,15 @@ impl Rotator for RotatedFileBySize {
*self.file_size.lock().unwrap() = 0;
Ok(())
}


}






#[cfg(test)]
mod tests {

Expand Down

0 comments on commit f56480a

Please sign in to comment.