From 751c35b1c8ff0730883a8ccdda9b77a49fff2405 Mon Sep 17 00:00:00 2001 From: Davanum Srinivas Date: Thu, 13 Dec 2012 22:42:33 -0500 Subject: 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 --- tests/unit/test_log.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'tests') 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', -- cgit