diff options
Diffstat (limited to 'openstackclient/common/utils.py')
| -rw-r--r-- | openstackclient/common/utils.py | 14 |
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 |
