logger: improve error handling
This commit is contained in:
parent
0e0ad400c2
commit
d7ff3c2798
|
@ -33,5 +33,8 @@ class CustomFormatter(logging.Formatter):
|
|||
return super().format(record)
|
||||
|
||||
def highlight_args(self, message, args, color):
|
||||
highlighted_args = tuple(f"{color}{arg}{RESET}" for arg in args)
|
||||
return message % highlighted_args
|
||||
try:
|
||||
highlighted_args = tuple(f"{color}{arg}{RESET}" for arg in args)
|
||||
return message % highlighted_args
|
||||
except (TypeError, ValueError):
|
||||
return f"{color}{message}{RESET}"
|
||||
|
|
Loading…
Reference in a new issue