From b017490b19217477f65ee7ef70195bc10ce6e390 Mon Sep 17 00:00:00 2001 From: zxj Date: Wed, 20 Sep 2023 10:36:56 +0800 Subject: [PATCH] fix #25 --- example/src/split_log_date.rs | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/example/src/split_log_date.rs b/example/src/split_log_date.rs index 6e663c1..c26fa7a 100644 --- a/example/src/split_log_date.rs +++ b/example/src/split_log_date.rs @@ -1,7 +1,8 @@ use fast_log::config::Config; use fast_log::consts::LogSize; use fast_log::error::LogError; -use fast_log::plugin::file_split::{Packer, KeepType}; +use fast_log::plugin::file_name::FileName; +use fast_log::plugin::file_split::{KeepType, Packer}; use std::fs::{File, OpenOptions}; use std::io::{Read, Write}; use std::path::Path; @@ -18,13 +19,7 @@ impl DateLogPacker { first_file_path: &str, date: fastdate::DateTime, ) -> String { - let path = Path::new(first_file_path); - let file_name = path - .file_name() - .unwrap_or_default() - .to_str() - .unwrap_or_default() - .to_string(); + let file_name = first_file_path.extract_file_name(); let mut new_log_name = date.to_string().replace(" ", "T").replace(":", "-"); new_log_name.push_str("."); new_log_name.push_str(self.pack_name());