From 87061df68f2231f4588d129bf07c36ec60b56915 Mon Sep 17 00:00:00 2001 From: Peter Bieringer Date: Mon, 19 Sep 2016 19:59:47 +0200 Subject: [PATCH] add conditional logging of given depth --- radicale/__init__.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/radicale/__init__.py b/radicale/__init__.py index 5ef86f0..798c512 100644 --- a/radicale/__init__.py +++ b/radicale/__init__.py @@ -304,7 +304,7 @@ class Application: # Return response content return [answer] if answer else [] - remote_host = "unkown" + remote_host = "UNKNOWN" if "REMOTE_HOST" in environ: if environ["REMOTE_HOST"]: remote_host = environ["REMOTE_HOST"] @@ -315,9 +315,12 @@ class Application: if "HTTP_USER_AGENT" in environ: if environ["HTTP_USER_AGENT"]: remote_useragent = environ["HTTP_USER_AGENT"] + depthinfo = "" + if environ["HTTP_DEPTH"]: + depthinfo = " with depth " + environ["HTTP_DEPTH"] time_begin = datetime.datetime.now() self.logger.info("%s request for %s received from %s using \"%s\"", - environ["REQUEST_METHOD"], environ["PATH_INFO"], remote_host, remote_useragent) + environ["REQUEST_METHOD"], environ["PATH_INFO"] + depthinfo, remote_host, remote_useragent) headers = pprint.pformat(self.headers_log(environ)) self.logger.debug("Request headers:\n%s", headers)