From a5a27829de8c8d7a86b5517e8d27e8376262df85 Mon Sep 17 00:00:00 2001 From: vvzvlad Date: Sun, 19 Jan 2025 11:37:27 +0300 Subject: [PATCH] Refactor check_logs function in checker.py to simplify log handling. Removed subscription message detection logic and replaced it with a basic line printing mechanism. The function now returns a default status of "Idle", streamlining the process and reducing complexity in log analysis. --- checker.py | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/checker.py b/checker.py index 8b15309..eaba1e7 100644 --- a/checker.py +++ b/checker.py @@ -138,24 +138,11 @@ def check_logs(log_handler): except subprocess.CalledProcessError as e: raise RuntimeError(f"Error running docker logs: {e}") - subscription_pattern = r'\[info\s*\].*Ignored subscription creation.*id=(\d+).*err=(.+?)(?=\s+\[|$)' - matches = list(re.finditer(subscription_pattern, log_content)) - - if not matches: - log_handler.info("No subscription messages found") - return {"status": "Idle"} - - last_match = matches[-1] - last_id = last_match.group(1) - error_type = last_match.group(2).strip() - - if error_type == "Container-set not supported": - status = f"Container error (id: {last_id})" - else: - status = f"Subscription {last_id}" - - log_handler.info(f"Found subscription message: id={last_id}, error={error_type}") - return {"status": status} + for line in log_content.splitlines(): + print(line) + + return {"status": "Idle"} + if __name__ == "__main__": colorama.init(autoreset=True)