From 483bc7b09fd50773c6df0df9dff10bd4a9fc82c0 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Thu, 29 Oct 2020 17:30:18 +0100 Subject: [PATCH] improve logging --- custom_components/auth_header/headers.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/custom_components/auth_header/headers.py b/custom_components/auth_header/headers.py index 9759064..9acf09c 100644 --- a/custom_components/auth_header/headers.py +++ b/custom_components/auth_header/headers.py @@ -112,6 +112,7 @@ def async_validate_access(self, ip_addr: IPAddress) -> None: ip_addr in trusted_network for trusted_network in self.hass.http.trusted_proxies ): + _LOGGER.warning("Remote IP not in trusted proxies: %s", ip_addr) raise InvalidAuthError("Not in trusted_proxies") @@ -140,13 +141,13 @@ async def async_step_init( self._ip_address ) - except InvalidAuthError: - _LOGGER.debug("invalid auth") + except InvalidAuthError as exc: + _LOGGER.debug("invalid auth", exc_info=exc) return self.async_abort(reason="not_allowed") for user in self._available_users: if user.name == self._remote_user: return await self.async_finish({"user": user.id}) - _LOGGER.debug("no user") + _LOGGER.debug("no user found") return self.async_abort(reason="not_allowed")