System/Logging - bugfix for 803a2615b3, record should be None when not matched.

(cherry picked from commit 8cf3898282561e55c05849e00db69579bbe520f7)
This commit is contained in:
Ad Schellevis 2025-12-04 13:36:43 +01:00 committed by Franco Fichtner
parent fcc0d7a4c1
commit 0fba32ed25

View File

@ -90,6 +90,7 @@ class LogMatcher:
format_container = FormatContainer(filename)
for rec in reverse_log_reader(filename):
self.row_number += 1
record = None
if self._match_line(rec['line']):
record = self.parse_line(rec['line'], format_container)
if len(self.severity) == 0 or record['severity'] is None or record['severity'] in self.severity:
@ -97,7 +98,7 @@ class LogMatcher:
# exit when data found is older than offered timestamp
try:
if timestamp and isoparse(record['timestamp']).timestamp() < timestamp:
if timestamp and record and isoparse(record['timestamp']).timestamp() < timestamp:
return
except (ValueError, TypeError):
pass