diff --git a/src/plugin/file_loop.rs b/src/plugin/file_loop.rs index aee7053..309c13e 100644 --- a/src/plugin/file_loop.rs +++ b/src/plugin/file_loop.rs @@ -11,14 +11,17 @@ pub struct FileLoopAppender { impl FileLoopAppender { pub fn new(log_file_path: &str, max_temp_size: LogSize) -> FileLoopAppender { Self { - file: FileSplitAppender::new(log_file_path, max_temp_size, RollingType::KeepNum(0), Box::new(LogPacker {})) + file: FileSplitAppender::new(log_file_path, max_temp_size, RollingType::KeepNum(1), Box::new(LogPacker {})) } } } impl LogAppender for FileLoopAppender { + fn do_logs(&self, records: &[FastLogRecord]) { + self.file.do_logs(records); + } fn do_log(&self, record: &FastLogRecord) { - self.file.do_log(record); + //nothing to do } fn flush(&self) { self.file.flush(); diff --git a/src/plugin/file_split.rs b/src/plugin/file_split.rs index f8ea391..a4769e9 100644 --- a/src/plugin/file_split.rs +++ b/src/plugin/file_split.rs @@ -76,7 +76,7 @@ impl RollingType { RollingType::KeepNum(n) => { let paths_vec = self.read_paths(dir, temp_name); for index in 0..paths_vec.len() { - if index >= *n as usize { + if index >= (*n) as usize { let item = &paths_vec[index]; std::fs::remove_file(item.path()); }