]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Add method for unit tests to set logging level
authorBill Owen <billowen@us.ibm.com>
Sun, 9 Feb 2014 21:46:50 +0000 (14:46 -0700)
committerBill Owen <billowen@us.ibm.com>
Sun, 9 Feb 2014 21:52:43 +0000 (14:52 -0700)
Implements: blueprint cinder-testcase-set-loglevel
Change-Id: Id4bb7023659eda593cc5ac451aa580f68a1a6b9d

cinder/test.py

index da3b8a12e83dc792867bcdde40997593fb53f360..ef9eca2c153f61d54d5057c399be7f76ffcdc126 100644 (file)
@@ -196,6 +196,11 @@ class TestCase(testtools.TestCase):
         for k, v in kw.iteritems():
             CONF.set_override(k, v)
 
+    def log_level(self, level):
+        """Set logging level to the specified value."""
+        log_root = logging.getLogger(None).logger
+        log_root.setLevel(level)
+
     def start_service(self, name, host=None, **kwargs):
         host = host and host or uuid.uuid4().hex
         kwargs.setdefault('host', host)