Bug 1285299 - Disable stdout logging by default in pytest-mozlog; r?maja_zf
In the pytest-mozlog plugin, disable logging to stdout by
default when setting up the mozlog logger, so that the
output when using the plugin is just the default
Pytest stdout output. The user can specify a mozlog
logger to write to stdout by using the '--log-* -' option,
in which case both Pytest and pytest-mozlog will write
log data to stdout.
MozReview-Commit-ID: FEbAWWq8x3f
--- a/testing/mozbase/mozlog/mozlog/pytest_mozlog/plugin.py
+++ b/testing/mozbase/mozlog/mozlog/pytest_mozlog/plugin.py
@@ -42,17 +42,19 @@ class MozLog(object):
formatter_options = mozlog.commandline.fmt_options.iteritems()
for name, (_class, _help, formatters, action) in formatter_options:
for formatter in formatters:
if formatter in mozlog.commandline.log_formatters:
argname = 'log_{0}_{1}'.format(formatter, name)
if config.getoption(argname):
args[argname] = config.getoption(argname)
- mozlog.commandline.setup_logging('pytest', args)
+ # Prevent mozlog from logging to stdout by default with `defaults={}`
+ # (User can specify stdout logger using `--log-* -` option)
+ mozlog.commandline.setup_logging('pytest', args, defaults={})
self.logger = mozlog.get_default_logger(component='pytest')
def pytest_sessionstart(self, session):
self.logger.suite_start([])
def pytest_sessionfinish(self, session, exitstatus):
self.logger.suite_end()