summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile6
-rw-r--r--custodia/client.py5
-rw-r--r--custodia/log.py2
3 files changed, 10 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index dc5291f..caf7f31 100644
--- a/Makefile
+++ b/Makefile
@@ -12,8 +12,10 @@ lint:
./custodia
clean:
- rm -fr build dist *.egg-info
- find ./ -name '*.pyc' -exec rm -f {} \;
+ rm -fr build dist *.egg-info .tox
+ rm -f server_socket
+ find ./ -name '*.py[co]' -exec rm -f {} \;
+ find ./ -name __pycache__ -exec rm -rf {} \;
cscope:
git ls-files | xargs pycscope
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
diff --git a/custodia/log.py b/custodia/log.py
index 313a7fc..e175cdb 100644
--- a/custodia/log.py
+++ b/custodia/log.py
@@ -45,7 +45,7 @@ def setup_logging(debug=False, auditfile='custodia.audit.log'):
custodia_logger.setLevel(logging.INFO)
audit_logger = logging.getLogger('custodia.audit')
- if len(audit_logger.handlers) == 0:
+ if auditfile is not None and len(audit_logger.handlers) == 0:
audit_fmt = logging.Formatter(LOGGING_FORMAT, LOGGING_DATEFORMAT)
audit_hdrl = logging.FileHandler(auditfile)
audit_hdrl.setFormatter(audit_fmt)