1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 04:50:05 +00:00

Log threading exceptions properly (#34789)

This commit is contained in:
Paulus Schoutsen
2020-04-28 14:31:35 -07:00
committed by GitHub
parent 87801d8aca
commit 0246761f94
3 changed files with 32 additions and 0 deletions

View File

@@ -249,6 +249,10 @@ def async_enable_logging(
logging.getLogger("urllib3").setLevel(logging.WARNING)
logging.getLogger("aiohttp.access").setLevel(logging.WARNING)
sys.excepthook = lambda *args: logging.getLogger(None).exception(
"Uncaught exception", exc_info=args # type: ignore
)
# Log errors to a file if we have write access to file or config dir
if log_file is None:
err_log_path = hass.config.path(ERROR_LOG_FILENAME)