Add workaround for python bug to HAQueueHandler (#66541)

This commit is contained in:
Erik Montnemery 2022-02-15 10:49:14 +01:00 committed by GitHub
parent cb03db8df4
commit 2538af4b06
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -33,6 +33,15 @@ class HideSensitiveDataFilter(logging.Filter):
class HomeAssistantQueueHandler(logging.handlers.QueueHandler):
"""Process the log in another thread."""
def prepare(self, record: logging.LogRecord) -> logging.LogRecord:
"""Prepare a record for queuing.
This is added as a workaround for https://bugs.python.org/issue46755
"""
record = super().prepare(record)
record.stack_info = None
return record
def handle(self, record: logging.LogRecord) -> Any:
"""
Conditionally emit the specified logging record.