From 71f528f974c297e527737acf67978e5b9260cc04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Gruszczy=C5=84ski?= Date: Thu, 31 Jul 2025 22:43:31 +0200 Subject: [PATCH] logowanie 304 --- app.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app.py b/app.py index f2d5492..ecbf971 100644 --- a/app.py +++ b/app.py @@ -1109,9 +1109,6 @@ def start_timer(): @app.after_request def log_request(response): - if request.path == "/healthcheck": - return response - ip = get_client_ip() method = request.method path = request.path @@ -1120,9 +1117,12 @@ def log_request(response): start = getattr(request, "_start_time", None) duration = round((time.time() - start) * 1000, 2) if start else "-" agent = request.headers.get("User-Agent", "-") - - log_msg = f'{ip} - "{method} {path}" {status} {length} {duration}ms "{agent}"' - app.logger.info(log_msg) + if status == 304: + app.logger.info(f"REVALIDATED: {ip} - \"{method} {path}\" {status} {length} {duration}ms \"{agent}\"") + else: + app.logger.info(f'{ip} - "{method} {path}" {status} {length} {duration}ms "{agent}"') + app.logger.debug(f"Request headers: {dict(request.headers)}") + app.logger.debug(f"Response headers: {dict(response.headers)}") return response