fn remove_deprecated_files(&self) -> Result<()> {
        let files = list_metric_files(&self.base_dir, &self.base_filename)?;
        if files.len() >= self.max_file_amount {
            let amount_to_remove = files.len() - self.max_file_amount + 1;
            for i in 0..amount_to_remove {
                let filename = &files[i];
                let idx_filename = form_metric_idx_filename(filename.to_str().unwrap());
                match fs::remove_file(filename) {
                    Ok(_) => {
                        logging::info!("[MetricWriter] Metric log file removed in DefaultMetricLogWriter.remove_deprecated_files(), filename: {:?}", filename);
                    }
                    Err(err) => {
                        logging::error!("Failed to remove metric log file in DefaultMetricLogWriter::remove_deprecated_files(), filename: {:?}, error: {:?}", filename, err);
                    }
                }
                match fs::remove_file(idx_filename) {
                    Ok(_) => {
                        logging::info!("[MetricWriter] Metric index file removed in DefaultMetricLogWriter.remove_deprecated_files(), filename: {:?}", filename);
                    }
                    Err(err) => {
                        logging::error!("Failed to remove metric index log file in DefaultMetricLogWriter::remove_deprecated_files(), filename: {:?}, error: {:?}", filename, err);
                    }
                }
            }
        }
        Ok(())
    }
/// Remove the outdated metric log files and corresponding index files,
/// incase that log files accumulate exceedng the `config::MAX_FILE_AMOUNT`.
Remove the outdated metric log files and corresponding index files,
incase that log files accumulate exceedng the `config::MAX_FILE_AMOUNT`.
Remove the outdated metric log files and corresponding index files incase that log files accumulate exceedng the ` config :: MAX_FILE_AMOUNT ` .
fn remove_deprecated_files(&self) -> Result<()> {
        let files = list_metric_files(&self.base_dir, &self.base_filename)?;
        if files.len() >= self.max_file_amount {
            let amount_to_remove = files.len() - self.max_file_amount + 1;
            for i in 0..amount_to_remove {
                let filename = &files[i];
                let idx_filename = form_metric_idx_filename(filename.to_str().unwrap());
                match fs::remove_file(filename) {
                    Ok(_) => {
                        logging::info!("[MetricWriter] Metric log file removed in DefaultMetricLogWriter.remove_deprecated_files(), filename: {:?}", filename);
                    }
                    Err(err) => {
                        logging::error!("Failed to remove metric log file in DefaultMetricLogWriter::remove_deprecated_files(), filename: {:?}, error: {:?}", filename, err);
                    }
                }
                match fs::remove_file(idx_filename) {
                    Ok(_) => {
                        logging::info!("[MetricWriter] Metric index file removed in DefaultMetricLogWriter.remove_deprecated_files(), filename: {:?}", filename);
                    }
                    Err(err) => {
                        logging::error!("Failed to remove metric index log file in DefaultMetricLogWriter::remove_deprecated_files(), filename: {:?}, error: {:?}", filename, err);
                    }
                }
            }
        }
        Ok(())
    }
fn remove_deprecated_files ( & self ) -> Result < ( ) > { let files = list_metric_files ( & self . base_dir , & self . base_filename ) ? ; if files . len ( ) >= self . max_file_amount { let amount_to_remove = files . len ( ) - self . max_file_amount + 1 ; for i in 0 .. amount_to_remove { let filename = & files [ i ] ; let idx_filename = form_metric_idx_filename ( filename . to_str ( ) . unwrap ( ) ) ; match fs :: remove_file ( filename ) { Ok ( _ ) => { logging :: info ! ( " " filename ) ; } Err ( err ) => { logging :: error ! ( " " filename err ) ; } } match fs :: remove_file ( idx_filename ) { Ok ( _ ) => { logging :: info ! ( " " filename ) ; } Err ( err ) => { logging :: error ! ( " " filename err ) ; } } } } Ok ( ( ) ) }
Remove the outdated metric log files and corresponding index files,
incase that log files accumulate exceedng the `config::MAX_FILE_AMOUNT`.
Remove the outdated metric log files and corresponding index files incase that log files accumulate exceedng the ` config :: MAX_FILE_AMOUNT ` .
&self
&self