diff --git a/checker.py b/checker.py index 9c0c82a..f2fbb4f 100644 --- a/checker.py +++ b/checker.py @@ -130,11 +130,14 @@ class GRIST: return record.Value raise ValueError(f"Setting {key} not found") +def clean_ansi(text): + ansi_escape = re.compile(r'\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])') + return ansi_escape.sub('', text) def check_logs(log_handler): try: - logs = subprocess.run(['docker', 'logs', '--since', '10m', '--no-color', 'infernet-node'], capture_output=True, text=True, check=True) - log_content = logs.stdout + logs = subprocess.run(['docker', 'logs', '--since', '10m', 'infernet-node'], capture_output=True, text=True, check=True) + log_content = clean_ansi(logs.stdout) except subprocess.CalledProcessError as e: raise RuntimeError(f"Error running docker logs: {e}")