Merge "Suppress warnings user can't fix"

This commit is contained in:
Jenkins 2015-04-18 07:12:03 +00:00 committed by Gerrit Code Review
commit 2ea6f10691

@ -1,4 +1,5 @@
# Copyright 2012-2013 OpenStack Foundation # Copyright 2012-2013 OpenStack Foundation
# Copyright 2015 Dean Troyer
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain # not use this file except in compliance with the License. You may obtain
@ -19,6 +20,7 @@ import getpass
import logging import logging
import sys import sys
import traceback import traceback
import warnings
from cliff import app from cliff import app
from cliff import command from cliff import command
@ -111,12 +113,15 @@ class OpenStackShell(app.App):
if self.options.verbose_level == 0: if self.options.verbose_level == 0:
# --quiet # --quiet
root_logger.setLevel(logging.ERROR) root_logger.setLevel(logging.ERROR)
warnings.simplefilter("ignore")
elif self.options.verbose_level == 1: elif self.options.verbose_level == 1:
# This is the default case, no --debug, --verbose or --quiet # This is the default case, no --debug, --verbose or --quiet
root_logger.setLevel(logging.WARNING) root_logger.setLevel(logging.WARNING)
warnings.simplefilter("ignore")
elif self.options.verbose_level == 2: elif self.options.verbose_level == 2:
# One --verbose # One --verbose
root_logger.setLevel(logging.INFO) root_logger.setLevel(logging.INFO)
warnings.simplefilter("once")
elif self.options.verbose_level >= 3: elif self.options.verbose_level >= 3:
# Two or more --verbose # Two or more --verbose
root_logger.setLevel(logging.DEBUG) root_logger.setLevel(logging.DEBUG)