From 09375efbbd67d0190be36ebc86fc2eac4237ca64 Mon Sep 17 00:00:00 2001 From: zxj Date: Thu, 19 Oct 2023 18:15:29 +0800 Subject: [PATCH] up fastdate version --- src/plugin/file_split.rs | 18 ------------------ tests/split_test.rs | 8 -------- 2 files changed, 26 deletions(-) diff --git a/src/plugin/file_split.rs b/src/plugin/file_split.rs index 1fddb3c..c0ef0cb 100644 --- a/src/plugin/file_split.rs +++ b/src/plugin/file_split.rs @@ -126,24 +126,6 @@ pub trait Packer: Send + Sync { new_log_name = first_file_path.trim_end_matches(&file_name).to_string() + &new_log_name; return new_log_name; } - - fn log_name_parse_time(&self, file_name: &str, temp_name: &str) -> Result { - let file_name = file_name.extract_file_name(); - let temp_name = temp_name.trim_end_matches(&format!(".{}", self.pack_name())); - if file_name.starts_with(&temp_name) { - let mut time_str = file_name.trim_start_matches(&temp_name).to_string(); - if let Some(v) = time_str.rfind(".") { - time_str = time_str[0..v].to_string(); - } - let time = DateTime::parse("YYYY-MM-DDThh:mm:ss.000000", &time_str); - return time.map_err(|e| LogError::from(e.to_string())); - } else { - return Err(LogError::E(format!( - "file_name={} not an pack file", - file_name - ))); - } - } } /// split log file allow pack compress log diff --git a/tests/split_test.rs b/tests/split_test.rs index ce8d737..72b834c 100644 --- a/tests/split_test.rs +++ b/tests/split_test.rs @@ -38,14 +38,6 @@ mod test { let _ = remove_dir_all("target/test/"); } - #[test] - fn test_parse_log_name() { - let t = LogPacker {} - .log_name_parse_time("temp2023-07-20T10-13-17.452247.log", "temp.log") - .unwrap(); - assert_eq!(t.to_string(), "2023-07-20 10:13:17.452247"); - } - #[test] fn test_log_name_create() { let p = LogPacker {};