pub fn archived_path<P: AsRef<Path> + std::fmt::Debug>(&self, path: P) -> PathBuf {
        // build the directory for the archived path
        let dir = match &self.dir {
            None => {
                // extract path from original path. It's safe to unwrap() because all paths should be absolute
                let dir = path.as_ref().parent();
                debug_assert!(dir.is_some());
                dir.unwrap()
            }
            Some(dir) => &dir,
        };
        debug_assert!(dir.is_dir());
        println!("dir={:?}", dir);

        // extract file name
        debug_assert!(path.as_ref().file_name().is_some());
        let file_name = path.as_ref().file_name().unwrap().to_string_lossy();

        // if not archive is specified, just add .1 at the end of the path
        #[cfg(target_family = "windows")]
        let default_path = if self.extension.is_none() {
            format!("{}\\{}.1", dir.to_string_lossy(), file_name)
        } else {
            format!(
                "{}\\{}.{}",
                dir.to_string_lossy(),
                file_name,
                self.extension.as_ref().unwrap()
            )
        };

        // if not archive is specified, just add .1 at the end of the path
        #[cfg(target_family = "unix")]
        let default_path = if self.extension.is_none() {
            format!("{}/{}.1", dir.to_string_lossy(), file_name)
        } else {
            format!(
                "{}/{}.{}",
                dir.to_string_lossy(),
                file_name,
                self.extension.as_ref().unwrap()
            )
        };

        println!(
            "self={:?}, dir={}, file={}, rotated={}",
            path,
            dir.display(),
            file_name,
            default_path
        );

        PathBuf::from(default_path)
    }
// When a LogArchive struct is specified in the config file, build the archive file name
When a LogArchive struct is specified in the config file, build the archive file name
When a LogArchive struct is specified in the config file build the archive file name
pub fn archived_path<P: AsRef<Path> + std::fmt::Debug>(&self, path: P) -> PathBuf {
        // build the directory for the archived path
        let dir = match &self.dir {
            None => {
                // extract path from original path. It's safe to unwrap() because all paths should be absolute
                let dir = path.as_ref().parent();
                debug_assert!(dir.is_some());
                dir.unwrap()
            }
            Some(dir) => &dir,
        };
        debug_assert!(dir.is_dir());
        println!("dir={:?}", dir);
        // extract file name
        debug_assert!(path.as_ref().file_name().is_some());
        let file_name = path.as_ref().file_name().unwrap().to_string_lossy();
        // if not archive is specified, just add .1 at the end of the path
        #[cfg(target_family = "windows")]
        let default_path = if self.extension.is_none() {
            format!("{}\\{}.1", dir.to_string_lossy(), file_name)
        } else {
            format!(
                "{}\\{}.{}",
                dir.to_string_lossy(),
                file_name,
                self.extension.as_ref().unwrap()
            )
        };
        // if not archive is specified, just add .1 at the end of the path
        #[cfg(target_family = "unix")]
        let default_path = if self.extension.is_none() {
            format!("{}/{}.1", dir.to_string_lossy(), file_name)
        } else {
            format!(
                "{}/{}.{}",
                dir.to_string_lossy(),
                file_name,
                self.extension.as_ref().unwrap()
            )
        };
        println!(
            "self={:?}, dir={}, file={}, rotated={}",
            path,
            dir.display(),
            file_name,
            default_path
        );
        PathBuf::from(default_path)
    }
pub fn archived_path < P : AsRef < Path > + std :: fmt :: Debug > ( & self , path : P ) -> PathBuf { // build the directory for the archived path let dir = match & self . dir { None => { // extract path from original path. It's safe to unwrap() because all paths should be absolute let dir = path . as_ref ( ) . parent ( ) ; debug_assert ! ( dir is_some ( ) ) ; dir . unwrap ( ) } Some ( dir ) => & dir , } ; debug_assert ! ( dir is_dir ( ) ) ; println ! ( " " dir ) ; // extract file name debug_assert ! ( path as_ref ( ) file_name ( ) is_some ( ) ) ; let file_name = path . as_ref ( ) . file_name ( ) . unwrap ( ) . to_string_lossy ( ) ; // if not archive is specified, just add .1 at the end of the path # [ cfg ( target_family " " ) ] let default_path = if self . extension . is_none ( ) { format ! ( " \\ " dir to_string_lossy ( ) file_name ) } else { format ! ( " \\ " dir to_string_lossy ( ) file_name self extension as_ref ( ) unwrap ( ) ) } ; // if not archive is specified, just add .1 at the end of the path # [ cfg ( target_family " " ) ] let default_path = if self . extension . is_none ( ) { format ! ( " " dir to_string_lossy ( ) file_name ) } else { format ! ( " " dir to_string_lossy ( ) file_name self extension as_ref ( ) unwrap ( ) ) } ; println ! ( " " path dir display ( ) file_name default_path ) ; PathBuf :: from ( default_path ) }
When a LogArchive struct is specified in the config file, build the archive file name
When a LogArchive struct is specified in the config file build the archive file name
&self
path
P
&self
path
P