From 41a1305555bf5947e442f6970ea93d359d3414ce Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Fri, 21 May 2021 19:10:15 +0200 Subject: [PATCH] policies: improve debug logging Signed-off-by: Jens Langhammer --- authentik/policies/engine.py | 11 ++++++++--- authentik/policies/types.py | 7 ++++++- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/authentik/policies/engine.py b/authentik/policies/engine.py index 492594fad..b8ac67fa2 100644 --- a/authentik/policies/engine.py +++ b/authentik/policies/engine.py @@ -105,16 +105,21 @@ class PolicyEngine: if cached_policy and self.use_cache: self.logger.debug( "P_ENG: Taking result from cache", - policy=binding.policy, + binding=binding, cache_key=key, + request=self.request, ) self.__cached_policies.append(cached_policy) continue - self.logger.debug("P_ENG: Evaluating policy", policy=binding.policy) + self.logger.debug( + "P_ENG: Evaluating policy", binding=binding, request=self.request + ) our_end, task_end = Pipe(False) task = PolicyProcess(binding, self.request, task_end) task.daemon = False - self.logger.debug("P_ENG: Starting Process", policy=binding.policy) + self.logger.debug( + "P_ENG: Starting Process", binding=binding, request=self.request + ) if not CURRENT_PROCESS._config.get("daemon"): task.run() else: diff --git a/authentik/policies/types.py b/authentik/policies/types.py index d69748944..5fec74fe8 100644 --- a/authentik/policies/types.py +++ b/authentik/policies/types.py @@ -51,7 +51,12 @@ class PolicyRequest: LOGGER.warning("failed to get geoip data", exc=exc) def __str__(self): - return f"" + text = f"" @dataclass