Fix error in log reader
authorChristian Herdtweck <christian.herdtweck@intra2net.com>
Mon, 25 Apr 2022 12:51:19 +0000 (14:51 +0200)
committerChristian Herdtweck <christian.herdtweck@intra2net.com>
Thu, 19 May 2022 09:15:00 +0000 (11:15 +0200)
When receiving several lines, the LogParser would only parse and
return the first. Fixed that.

src/log_read.py

index 1d8bef4..0288dd8 100644 (file)
@@ -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