Guard expensive debug logging with isEnabledFor in alexa (#100137)

This commit is contained in:
J. Nick Koston 2023-09-11 11:39:10 -05:00 committed by GitHub
parent 18e08bc79f
commit 0fe88d60ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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