From 0fe88d60acd64956c896aa72555c3b91faeddc70 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Mon, 11 Sep 2023 11:39:10 -0500 Subject: [PATCH] Guard expensive debug logging with isEnabledFor in alexa (#100137) --- homeassistant/components/alexa/state_report.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/alexa/state_report.py b/homeassistant/components/alexa/state_report.py index 786b2ee5227..f1cf13a0a7e 100644 --- a/homeassistant/components/alexa/state_report.py +++ b/homeassistant/components/alexa/state_report.py @@ -378,8 +378,9 @@ async def async_send_changereport_message( response_text = await response.text() - _LOGGER.debug("Sent: %s", json.dumps(message_serialized)) - _LOGGER.debug("Received (%s): %s", response.status, response_text) + if _LOGGER.isEnabledFor(logging.DEBUG): + _LOGGER.debug("Sent: %s", json.dumps(message_serialized)) + _LOGGER.debug("Received (%s): %s", response.status, response_text) if response.status == HTTPStatus.ACCEPTED: return @@ -531,8 +532,9 @@ async def async_send_doorbell_event_message( response_text = await response.text() - _LOGGER.debug("Sent: %s", json.dumps(message_serialized)) - _LOGGER.debug("Received (%s): %s", response.status, response_text) + if _LOGGER.isEnabledFor(logging.DEBUG): + _LOGGER.debug("Sent: %s", json.dumps(message_serialized)) + _LOGGER.debug("Received (%s): %s", response.status, response_text) if response.status == HTTPStatus.ACCEPTED: return