adding the unmarkupformatter to all handlers of Appdaemon

This commit is contained in:
John Lancaster
2024-03-09 20:11:54 -06:00
parent 96be16e0bb
commit 1fa0df360c
2 changed files with 9 additions and 9 deletions

View File

@@ -36,9 +36,11 @@ def create_handler() -> RichHandler:
def init_logging(self: ADAPI, level):
stream_handler = logging.getLogger('AppDaemon').handlers[0]
og_formatter = stream_handler.formatter
stream_handler.setFormatter(UnMarkupFormatter(fmt=og_formatter._fmt, datefmt=og_formatter.datefmt, style='{'))
for h in logging.getLogger('AppDaemon').handlers:
og_formatter = h.formatter
h.setFormatter(
UnMarkupFormatter(fmt=og_formatter._fmt, datefmt=og_formatter.datefmt, style='{')
)
if not any(isinstance(h, RichHandler) for h in self.logger.handlers):
self.logger.propagate = False