Add option to enable HTTP tracing

During development, it's useful sometimes to see an HTTP trace log.
That's controlled by keystoneauth in all cases, so it's easy to turn it
on. Provide a flag for people using simple_logging.

Change-Id: I2f44d6f7fd1268028eeb455341198a704edcaad4
This commit is contained in:
Monty Taylor 2015-12-21 11:58:12 -06:00
parent 8d5abfbf56
commit ea859622fa

View File

@ -32,11 +32,18 @@ if requestsexceptions.SubjectAltNameWarning:
'ignore', category=requestsexceptions.SubjectAltNameWarning)
def simple_logging(debug=False):
def simple_logging(debug=False, http_debug=False):
if http_debug:
debug = True
if debug:
log_level = logging.DEBUG
else:
log_level = logging.INFO
if http_debug:
# Enable HTTP level tracing
log = _log.setup_logging('keystoneauth')
log.addHandler(logging.StreamHandler())
log.setLevel(log_level)
log = _log.setup_logging('shade')
log.addHandler(logging.StreamHandler())
log.setLevel(log_level)