fn reader<R: BufRead + Seeker>(
        &mut self,
        reader: R,
        tag: &Tag,
        _global_options: &GlobalOptions,
    ) -> AppResult<Vec<ChildData>> {
        for (line_number, line) in reader.lines().enumerate() {
            let text = {
                if let Err(e) = line {
                    error!(
                        "error {} reading logfile {} using BypassReader",
                        e,
                        &self.id.canon_path.display()
                    );
                    return Err(AppError::from_error(
                        e,
                        &format!(
                            "error reading logfile {:?} at line {}",
                            self.id.canon_path, line_number
                        ),
                    ));
                }
                line.unwrap()
            };

            // is there a match ?
            if let Some(pattern_match) = tag.is_match(&text) {
                // print out also captures
                let mut vars = RuntimeVars::default();
                vars.insert_captures(pattern_match.regex, &text);

                // cap0 is the whole match, no need to keep it as the full line is printed anyway
                vars.retain(|k, _| k != &String::from("CLF_CAPTURE0"));

                eprintln!(
                    "{}:{}:{}:{}:[{}]:{}",
                    &self.id.canon_path.display(),
                    &tag.name,
                    <&str>::from(&pattern_match.pattern_type),
                    line_number,
                    vars,
                    text
                );
            }
        }

        Ok(Vec::new())
    }
/// In this case, the reader just read each line and prints out the lines matching the regexes.
/// No computation of counters in made
/// TODO: add line number
In this case, the reader just read each line and prints out the lines matching the regexes.
No computation of counters in made
TODO: add line number
In this case the reader just read each line and prints out the lines matching the regexes . No computation of counters in made TODO : add line number
fn reader<R: BufRead + Seeker>(
        &mut self,
        reader: R,
        tag: &Tag,
        _global_options: &GlobalOptions,
    ) -> AppResult<Vec<ChildData>> {
        for (line_number, line) in reader.lines().enumerate() {
            let text = {
                if let Err(e) = line {
                    error!(
                        "error {} reading logfile {} using BypassReader",
                        e,
                        &self.id.canon_path.display()
                    );
                    return Err(AppError::from_error(
                        e,
                        &format!(
                            "error reading logfile {:?} at line {}",
                            self.id.canon_path, line_number
                        ),
                    ));
                }
                line.unwrap()
            };
            // is there a match ?
            if let Some(pattern_match) = tag.is_match(&text) {
                // print out also captures
                let mut vars = RuntimeVars::default();
                vars.insert_captures(pattern_match.regex, &text);
                // cap0 is the whole match, no need to keep it as the full line is printed anyway
                vars.retain(|k, _| k != &String::from("CLF_CAPTURE0"));
                eprintln!(
                    "{}:{}:{}:{}:[{}]:{}",
                    &self.id.canon_path.display(),
                    &tag.name,
                    <&str>::from(&pattern_match.pattern_type),
                    line_number,
                    vars,
                    text
                );
            }
        }
        Ok(Vec::new())
    }
fn reader < R : BufRead + Seeker > ( & mut self , reader : R , tag : & Tag , _global_options : & GlobalOptions , ) -> AppResult < Vec < ChildData > > { for ( line_number , line ) in reader . lines ( ) . enumerate ( ) { let text = { if let Err ( e ) = line { error ! ( " " e self id canon_path display ( ) ) ; return Err ( AppError :: from_error ( e , & format ! ( " " self id canon_path line_number ) , ) ) ; } line . unwrap ( ) } ; // is there a match ? if let Some ( pattern_match ) = tag . is_match ( & text ) { // print out also captures let mut vars = RuntimeVars :: default ( ) ; vars . insert_captures ( pattern_match . regex , & text ) ; // cap0 is the whole match, no need to keep it as the full line is printed anyway vars . retain ( | k , _ | k != & String :: from ( " " ) ) ; eprintln ! ( " " self id canon_path display ( ) tag name str from ( pattern_match pattern_type ) line_number vars text ) ; } } Ok ( Vec :: new ( ) ) }
In this case, the reader just read each line and prints out the lines matching the regexes.
In this case the reader just read each line and prints out the lines matching the regexes .
&mut self
reader
R
tag
&Tag
_global_options
&GlobalOptions
&mut self
reader
R
tag
&Tag
_global_options
&GlobalOptions