From 17042efd366198b2bd6cffdd52e472244c679e8b Mon Sep 17 00:00:00 2001 From: Nicholas Albion Date: Thu, 5 Oct 2023 20:40:04 +1100 Subject: [PATCH] Fixed issue with logging from Peewee - provided tuple as record.msg --- pilot/logger/logger.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pilot/logger/logger.py b/pilot/logger/logger.py index 7094b30..ecc47d6 100644 --- a/pilot/logger/logger.py +++ b/pilot/logger/logger.py @@ -47,7 +47,10 @@ def filter_sensitive_fields(record): record.args = tuple(args_list) # Remove ANSI escape sequences - colours & bold - record.msg = re.sub(r'\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])', '', record.msg) + # Peewee passes a tuple as record.msg + if isinstance(record.msg, str): + record.msg = re.sub(r'\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])', '', record.msg) + return True