summaryrefslogtreecommitdiff
path: root/openstackclient/common
diff options
context:
space:
mode:
authorFlorent Flament <florent.flament-ext@cloudwatt.com>2013-12-18 15:07:03 +0000
committerFlorent Flament <florent.flament-ext@cloudwatt.com>2014-01-02 11:08:53 +0100
commita5e087e7a9b88e2ce698ddc32d89e1462509fbb5 (patch)
tree223640f85330c5de15b430132125052e42554c56 /openstackclient/common
parentde27c1b455624b6123b26bfdd022d2763c541a25 (diff)
downloadpython-openstackclient-a5e087e7a9b88e2ce698ddc32d89e1462509fbb5.tar.gz
Displaying curl commands for nova and cinder calls
When using the -v option, displays curl equivalent commands and http messages exchanged with the nova and cinder API servers. Displays the same messages as those displayed with the --debug option of python-novaclient and python-cinderclient. Implements: blueprint curl-commands-in-debugging-messages for nova and cinder related calls Change-Id: Ibc8ef79d874334585b81d652b9c7df9e874fffa9
Diffstat (limited to 'openstackclient/common')
-rw-r--r--openstackclient/common/utils.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/openstackclient/common/utils.py b/openstackclient/common/utils.py
index 91a20895..94ea2225 100644
--- a/openstackclient/common/utils.py
+++ b/openstackclient/common/utils.py
@@ -15,6 +15,7 @@
"""Common client utilities"""
+import logging
import os
import six
import sys
@@ -215,3 +216,16 @@ def wait_for_status(status_f,
callback(progress)
time.sleep(sleep_time)
return retval
+
+
+def get_effective_log_level():
+ """Returns the lowest logging level considered by logging handlers
+
+ Retrieve an return the smallest log level set among the root
+ logger's handlers (in case of multiple handlers).
+ """
+ root_log = logging.getLogger()
+ min_log_lvl = logging.CRITICAL
+ for handler in root_log.handlers:
+ min_log_lvl = min(min_log_lvl, handler.level)
+ return min_log_lvl