From 81bfde5a79a6c162da08fbd5d69bdce039f92110 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrico=20Tr=C3=B6ger?= Date: Sat, 25 Jan 2020 19:53:27 +0100 Subject: [PATCH] Add log message after remote server request This might be handy to detect remote server problems or debugging timeouts and the like. --- powerdnsadmin/lib/utils.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/powerdnsadmin/lib/utils.py b/powerdnsadmin/lib/utils.py index b6e398f..c4ae41e 100644 --- a/powerdnsadmin/lib/utils.py +++ b/powerdnsadmin/lib/utils.py @@ -1,3 +1,4 @@ +import logging import re import json import requests @@ -48,6 +49,8 @@ def fetch_remote(remote_url, timeout=timeout, data=data, params=params) + logging.debug('Querying remote server "{0}" ({1}) finished with code {2} (took {3:.3f}s)'.format( + remote_url, method, r.status_code, r.elapsed.total_seconds())) try: if r.status_code not in (200, 201, 204, 400, 409, 422): r.raise_for_status()