From: Bill Owen Date: Sun, 9 Feb 2014 21:46:50 +0000 (-0700) Subject: Add method for unit tests to set logging level X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=82cb3c03909bbb9eadeb9eeedfe17b8deb429a9c;p=openstack-build%2Fcinder-build.git Add method for unit tests to set logging level Implements: blueprint cinder-testcase-set-loglevel Change-Id: Id4bb7023659eda593cc5ac451aa580f68a1a6b9d --- diff --git a/cinder/test.py b/cinder/test.py index da3b8a12e..ef9eca2c1 100644 --- a/cinder/test.py +++ b/cinder/test.py @@ -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)