diff options
Diffstat (limited to 'openstackclient/common')
| -rw-r--r-- | openstackclient/common/context.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/openstackclient/common/context.py b/openstackclient/common/context.py index b7b16e94..348c5509 100644 --- a/openstackclient/common/context.py +++ b/openstackclient/common/context.py @@ -14,6 +14,7 @@ """Context and Formatter""" import logging +import warnings _LOG_MESSAGE_FORMAT = ('%(asctime)s.%(msecs)03d %(process)d ' '%(levelname)s %(name)s [%(clouds_name)s ' @@ -21,6 +22,15 @@ _LOG_MESSAGE_FORMAT = ('%(asctime)s.%(msecs)03d %(process)d ' _LOG_DATE_FORMAT = '%Y-%m-%d %H:%M:%S' +def set_warning_filter(log_level): + if log_level == logging.ERROR: + warnings.simplefilter("ignore") + elif log_level == logging.WARNING: + warnings.simplefilter("ignore") + elif log_level == logging.INFO: + warnings.simplefilter("once") + + def setup_handler_logging_level(handler_type, level): """Setup of the handler for set the logging level |
