diff --git a/example/src/split_log.rs b/example/src/split_log.rs index f851ac8..a29559a 100644 --- a/example/src/split_log.rs +++ b/example/src/split_log.rs @@ -1,4 +1,3 @@ -use std::thread::sleep; use fast_log::config::Config; use fast_log::consts::LogSize; use fast_log::plugin::file_split::{PackType, KeepType}; diff --git a/src/plugin/file_split.rs b/src/plugin/file_split.rs index dda07be..2448852 100644 --- a/src/plugin/file_split.rs +++ b/src/plugin/file_split.rs @@ -169,14 +169,14 @@ impl CanPack for PackType { if dt.day() > date_time.day() { let last_time = date_time.clone(); *date_time = dt; - Some(temp_name.to_string() + &last_time.format("YYYY-MM-DDThh-mm-ss.000000.log")) + Some(temp_name.replace(".log",&last_time.format("YYYY-MM-DDThh-mm-ss.000000.log"))) } else { None } } PackType::BySize(limit) => { if temp_size >= limit.get_len() { - Some(temp_name.to_string() + &DateTime::now().format("YYYY-MM-DDThh-mm-ss.000000.log")) + Some(temp_name.replace(".log",&DateTime::now().format("YYYY-MM-DDThh-mm-ss.000000.log"))) } else { None }