Bug 1285299 - Disable stdout logging by default in pytest-mozlog; r?maja_zf draft
authorAnjana Vakil <anjanavakil@gmail.com>
Mon, 05 Sep 2016 14:02:14 +0200
changeset 409914 0a531e32d9816b2cc5634ba2b65153b81df3a340
parent 409913 1d963bcf6153c13d14b6397cee1f150a1ae8ddbd
child 409915 40d39ad7793de3837b06824e2499e36889e4258c
push id28611
push userbmo:anjanavakil@gmail.com
push dateMon, 05 Sep 2016 17:25:40 +0000
reviewersmaja_zf
bugs1285299
milestone51.0a1
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
testing/mozbase/mozlog/mozlog/pytest_mozlog/plugin.py
--- 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()