oslo_log.fixture

oslo_log.fixture.get_logging_handle_error_fixture()

returns a fixture to make logging raise formatting exceptions.

To use:

from oslo_log import fixture as log_fixture

self.useFixture(log_fixture.get_logging_handle_error_fixture())
class oslo_log.fixture.SetLogLevel(logger_names, level)

Override the log level for the named loggers, restoring their previous value at the end of the test.

To use:

from oslo_log import fixture as log_fixture

self.useFixture(log_fixture.SetLogLevel(['myapp.foo'], logging.DEBUG))
Parameters:
  • logger_names (list(str)) – Sequence of logger names, as would be passed to getLogger().
  • level (int) – Logging level, usually one of logging.DEBUG, logging.INFO, etc.