From: Christian Herdtweck Date: Mon, 25 Apr 2022 12:51:19 +0000 (+0200) Subject: Fix error in log reader X-Git-Tag: v1.7.1~2^2~4 X-Git-Url: http://developer.intra2net.com/git/?p=pyi2ncommon;a=commitdiff_plain;h=1a537f05e30b494c45f94f12c2d992b1e7dd5eba Fix error in log reader When receiving several lines, the LogParser would only parse and return the first. Fixed that. --- diff --git a/src/log_read.py b/src/log_read.py index 1d8bef4..0288dd8 100644 --- a/src/log_read.py +++ b/src/log_read.py @@ -387,10 +387,12 @@ class LogParser(LineReader): :rtype: [(str, :py:class:`re.Match` OR str, int)] """ # let super class split data into lines + result = [] for description, raw_line, idx in \ super(LogParser, self).prepare_result(*args): - result = re.match(self.pattern, raw_line) - if result: - return description, result, idx + matches = re.match(self.pattern, raw_line) + if matches: + result.append((description, matches, idx)) else: - return description, raw_line, idx + result.append((description, raw_line, idx)) + return result