logger: improve error handling

This commit is contained in:
pedro 2024-11-27 00:38:03 +01:00
parent 2793344684
commit e25b8e5994

View file

@ -33,5 +33,8 @@ class CustomFormatter(logging.Formatter):
return super().format(record)
def highlight_args(self, message, args, color):
try:
highlighted_args = tuple(f"{color}{arg}{RESET}" for arg in args)
return message % highlighted_args
except (TypeError, ValueError):
return f"{color}{message}{RESET}"