Exemple #1
0
    def processLine(self, line):
        # Total number of line
        self.total_line += 1
        if self.max_nb_line \
        and self.max_nb_line[0] <= self.total_line:
            score = self.max_nb_line[1]
            log = scoreLogFunc(self, score)
            log("More than %s lines written: increment score by %.1f%%"
                % (self.total_line, score*100))
            self.score += score
            self.max_nb_line = None
            self.send('session_rename', 'long_output')

        # Ignore this line?
        if self.cleanup_func:
            if not line:
                return
            line = self.cleanup_func(line)
        if not line:
            return
        for ignore_func in self.ignore:
            if ignore_func(line):
                return

        # Number of line
        self.nb_line += 1

        # Search the matching pattern with the highest score
        found = None
        for pattern, score, match in self.compiled_patterns:
            if found and abs(score) < abs(found[1]):
                continue
            if not match(line):
                continue
            found = (pattern, score)
        if not found:
            message = "Not matching line: %r" % line
            if self.show_not_matching:
                self.error(message)
            elif self.log_not_matching:
                self.info(message)
            return

        pattern, score = found
        if self.show_matching:
            log = self.error
        else:
            log = self.warning
        log("Match pattern %r (score %.1f%%) in %r" % (
            pattern, score*100, line))
        self.score += score
Exemple #2
0
 def scoreLogFunc(self):
     score = self.getScore()
     return scoreLogFunc(self, score)
Exemple #3
0
 def scoreLogFunc(self):
     score = self.getScore()
     return scoreLogFunc(self, score)