New log-analysis checker LastLineContains

This commit is contained in:
Robert Schmidt
2026-02-26 14:17:28 +01:00
parent 366df408a1
commit 735058f5c4
3 changed files with 34 additions and 0 deletions
+9
View File
@@ -23,6 +23,7 @@
import re
import os
import logging
from collections import deque
class Default:
def run(file, opt=None):
@@ -44,6 +45,14 @@ class ContainsString:
return True, ""
return False, f"could not find '{needle}' in logs"
class LastLineContains:
def run(file, string):
with open(file, "r") as f:
last_line = deque(f, maxlen=1).pop()
success = string in last_line
log = "" if success else f"could not find '{string}' in last line"
return success, log
class RetxCheck():
def _parseList(s):
if not s: