diff options
author | Davanum Srinivas <dims@linux.vnet.ibm.com> | 2012-12-13 22:42:33 -0500 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2013-01-12 04:35:03 +0000 |
commit | 751c35b1c8ff0730883a8ccdda9b77a49fff2405 (patch) | |
tree | bbe4e6d95b6654ad5c6ba2d50cc6bbbd12c5678b /tests | |
parent | bd1e5a3350305cd6554ba3b0d537d670bf6b4a75 (diff) | |
download | oslo-751c35b1c8ff0730883a8ccdda9b77a49fff2405.tar.gz oslo-751c35b1c8ff0730883a8ccdda9b77a49fff2405.tar.xz oslo-751c35b1c8ff0730883a8ccdda9b77a49fff2405.zip |
Verbose should not enable debug level logging
Fixes LP #989269
Currently setting --verbose in will still allow DEBUG level
message to be logged to python logger object. we need to check
for --debug first (set DEBUG level), then --verbose (set INFO
level) and if neither is set then set default to WARNING
DocImpact
Change-Id: Ic9e3cb5979b2d7283552ad3a461870373f45a239
Diffstat (limited to 'tests')
-rw-r--r-- | tests/unit/test_log.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/tests/unit/test_log.py b/tests/unit/test_log.py index cc032d9..a4a7915 100644 --- a/tests/unit/test_log.py +++ b/tests/unit/test_log.py @@ -52,13 +52,19 @@ class LoggerTestCase(test_utils.BaseTestCase): self.config(verbose=True) log.setup("test_is_verbose") logger = logging.getLogger("test_is_verbose") + self.assertEqual(logging.INFO, logger.getEffectiveLevel()) + + def test_will_be_debug_if_debug_flag_set(self): + self.config(debug=True) + log.setup("test_is_debug") + logger = logging.getLogger("test_is_debug") self.assertEqual(logging.DEBUG, logger.getEffectiveLevel()) def test_will_not_be_verbose_if_verbose_flag_not_set(self): self.config(verbose=False) log.setup("test_is_not_verbose") logger = logging.getLogger("test_is_not_verbose") - self.assertEqual(logging.INFO, logger.getEffectiveLevel()) + self.assertEqual(logging.WARNING, logger.getEffectiveLevel()) def test_no_logging_via_module(self): for func in ('critical', 'error', 'exception', 'warning', 'warn', |