[dashboard] Fix logging colors (#8984)

This commit is contained in:
Jonathan Swoboda 2025-06-03 16:48:22 -04:00 committed by GitHub
parent a225d6881f
commit 19ec922e28
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -59,7 +59,13 @@ class ESPHomeLogFormatter(logging.Formatter):
"ERROR": AnsiFore.RED.value, "ERROR": AnsiFore.RED.value,
"CRITICAL": AnsiFore.RED.value, "CRITICAL": AnsiFore.RED.value,
}.get(record.levelname, "") }.get(record.levelname, "")
return f"{prefix}{formatted}{AnsiStyle.RESET_ALL.value}" message = f"{prefix}{formatted}{AnsiStyle.RESET_ALL.value}"
if CORE.dashboard:
try:
message = message.replace("\033", "\\033")
except UnicodeEncodeError:
pass
return message
def setup_log( def setup_log(