Fixed issue with logging from Peewee - provided tuple as record.msg

This commit is contained in:
Nicholas Albion
2023-10-05 20:40:04 +11:00
parent a38c35fafa
commit 17042efd36

View File

@@ -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