diff options
author | Christian Heimes <christian@python.org> | 2015-11-11 15:25:50 +0100 |
---|---|---|
committer | Simo Sorce <simo@redhat.com> | 2015-11-11 11:35:45 -0500 |
commit | d944441d2a6d0c8619e61ba7ceff16d6b147a76b (patch) | |
tree | 23f598254b17ca39e70bc252f77f0f2a86e2d534 /custodia/client.py | |
parent | 3b7eed15c3f9da7381d240a762b0e557dd18ce96 (diff) | |
download | custodia-review.tar.gz custodia-review.tar.xz custodia-review.zip |
Custodia client loggingreview
custodia.client library now logs requests and responses.
The auditfile argument of setup_logging() can be set to None to
configure client logging without audit file.
Signed-off-by: Christian Heimes <cheimes@redhat.com>
Reviewed-by: Simo Sorce <simo@redhat.com>
Diffstat (limited to 'custodia/client.py')
-rw-r--r-- | custodia/client.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/custodia/client.py b/custodia/client.py index 9647d68..dad1142 100644 --- a/custodia/client.py +++ b/custodia/client.py @@ -1,5 +1,6 @@ # Copyright (C) 2015 Custodia Project Contributors - see LICENSE file +import logging import socket from jwcrypto.common import json_decode @@ -17,6 +18,8 @@ from custodia.message.kem import ( check_kem_claims, decode_enc_kem, make_enc_kem ) +logger = logging.getLogger(__name__) + class HTTPUnixConnection(HTTPConnection): @@ -79,7 +82,9 @@ class CustodiaHTTPClient(object): self._last_response = None url = self._join_url(path) kwargs['headers'] = self._add_headers(**kwargs) + logger.debug("%s %s", cmd.__name__.upper(), url) self._last_response = cmd(url, **kwargs) + logger.debug("Response: %s", self._last_response) return self._last_response @property |