1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-01 19:02:18 +01:00

[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

View File

@@ -59,7 +59,13 @@ class ESPHomeLogFormatter(logging.Formatter):
"ERROR": AnsiFore.RED.value,
"CRITICAL": AnsiFore.RED.value,
}.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(