pub fn update<P: AsRef<Path>>(&mut self, path: P, hash_buffer_size: usize) -> AppResult<()> {
        // check if we can really use the file
        self.declared_path = PathBuf::from(path.as_ref());

        // canonicalize path: absolute form of the path with all intermediate
        // components normalized and symbolic links resolved.
        let canon = self
            .declared_path
            .canonicalize()
            .map_err(|e| context!(e, "unable to canonicalize file:{:?}", &self.declared_path))?;

        self.directory = canon.parent().map(|p| p.to_path_buf());
        self.extension = canon.extension().map(|x| x.to_string_lossy().to_string());
        self.compression = CompressionScheme::from(self.extension.as_deref());

        // // get inode & dev ID
        self.signature = canon.signature(hash_buffer_size)?;
        trace!(
            "current signature for {:?} is {:?}",
            &canon,
            &self.signature
        );

        // finally save path
        self.canon_path = canon;

        Ok(())
    }
/// Update some logfile fields with up to date path values. This is used when detecting rotation for logfiles
Update some logfile fields with up to date path values. This is used when detecting rotation for logfiles
Update some logfile fields with up to date path values . This is used when detecting rotation for logfiles
pub fn update<P: AsRef<Path>>(&mut self, path: P, hash_buffer_size: usize) -> AppResult<()> {
        // check if we can really use the file
        self.declared_path = PathBuf::from(path.as_ref());
        // canonicalize path: absolute form of the path with all intermediate
        // components normalized and symbolic links resolved.
        let canon = self
            .declared_path
            .canonicalize()
            .map_err(|e| context!(e, "unable to canonicalize file:{:?}", &self.declared_path))?;
        self.directory = canon.parent().map(|p| p.to_path_buf());
        self.extension = canon.extension().map(|x| x.to_string_lossy().to_string());
        self.compression = CompressionScheme::from(self.extension.as_deref());
        // // get inode & dev ID
        self.signature = canon.signature(hash_buffer_size)?;
        trace!(
            "current signature for {:?} is {:?}",
            &canon,
            &self.signature
        );
        // finally save path
        self.canon_path = canon;
        Ok(())
    }
pub fn update < P : AsRef < Path > > ( & mut self , path : P , hash_buffer_size : usize ) -> AppResult < ( ) > { // check if we can really use the file self . declared_path = PathBuf :: from ( path . as_ref ( ) ) ; // canonicalize path: absolute form of the path with all intermediate // components normalized and symbolic links resolved. let canon = self . declared_path . canonicalize ( ) . map_err ( | e | context ! ( e " " self declared_path ) ) ? ; self . directory = canon . parent ( ) . map ( | p | p . to_path_buf ( ) ) ; self . extension = canon . extension ( ) . map ( | x | x . to_string_lossy ( ) . to_string ( ) ) ; self . compression = CompressionScheme :: from ( self . extension . as_deref ( ) ) ; // // get inode & dev ID self . signature = canon . signature ( hash_buffer_size ) ? ; trace ! ( " " canon self signature ) ; // finally save path self . canon_path = canon ; Ok ( ( ) ) }
Update some logfile fields with up to date path values.
Update some logfile fields with up to date path values .
&mut self
path
P
hash_buffer_size
usize
&mut self
path
P
hash_buffer_size
usize