From 70bcaf3ad160951cf99d03b3df30b3707ac3e624 Mon Sep 17 00:00:00 2001 From: Peter Bieringer Date: Tue, 21 Apr 2026 18:55:44 +0200 Subject: [PATCH] change result loglevel depending on status --- radicale/app/__init__.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/radicale/app/__init__.py b/radicale/app/__init__.py index b6d641cd..b7072ba3 100644 --- a/radicale/app/__init__.py +++ b/radicale/app/__init__.py @@ -345,15 +345,23 @@ class Application(ApplicationPartDelete, ApplicationPartHead, else: flags_text = "" if answer is not None: - logger.info("%s response status for %r%s in %.3f seconds %s %s bytes%s: %s", + message = "%s response status for %r%s in %.3f seconds %s %s bytes%s: %s" % ( request_method, unsafe_path, depthinfo, time_delta_seconds, content_encoding, str(len(answer)), flags_text, status_text) else: - logger.info("%s response status for %r%s in %.3f seconds: %s", + message = "%s response status for %r%s in %.3f seconds: %s" % ( request_method, unsafe_path, depthinfo, time_delta_seconds, status_text) + if status < 400: + logger.info(message) + elif status == 401 or status == 404 or status == 412 or status == 409: + logger.notice(message) + elif status < 500: + logger.error(message) + else: + logger.critical(message) # Profiling end if self._profiling_per_request: