Bug 1044206 - Revert the global logger in mochitest's runtests to use python stdlib logging for compatibility with mozharness regex.;r=ahal
authorChris Manchester <cmanchester@mozilla.com>
Wed, 30 Jul 2014 09:55:45 -0400
changeset 196859 327f8728d818337a842480181089598e65adc655
parent 196858 1528900bd8cfcb5cebaa9e7fca8c6eaea5771cb8
child 196860 c58acbd01f322b2aec5f4b3bf9ec785e613c7175
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersahal
bugs1044206
milestone34.0a1
Bug 1044206 - Revert the global logger in mochitest's runtests to use python stdlib logging for compatibility with mozharness regex.;r=ahal
testing/mochitest/runtests.py
--- a/testing/mochitest/runtests.py
+++ b/testing/mochitest/runtests.py
@@ -203,21 +203,16 @@ class MessageLogger(object):
         # Cleaning the list of buffered messages
         self.buffered_messages = []
 
     def finish(self):
         self.dump_buffered()
         self.buffering = False
         self.logger.suite_end()
 
-# Global logger
-log = StructuredLogger('mochitest')
-stream_handler = StreamHandler(stream=sys.stdout, formatter=MochitestFormatter())
-log.add_handler(stream_handler)
-
 ####################
 # PROCESS HANDLING #
 ####################
 
 def call(*args, **kwargs):
   """front-end function to mozprocess.ProcessHandler"""
   # TODO: upstream -> mozprocess
   # https://bugzilla.mozilla.org/show_bug.cgi?id=791383
@@ -989,18 +984,23 @@ class Mochitest(MochitestUtilsMixin):
 
   # XXX use automation.py for test name to avoid breaking legacy
   # TODO: replace this with 'runtests.py' or 'mochitest' or the like
   test_name = 'automation.py'
 
   def __init__(self):
     super(Mochitest, self).__init__()
 
+    # Structured logger
+    structured_log = StructuredLogger('mochitest')
+    stream_handler = StreamHandler(stream=sys.stdout, formatter=MochitestFormatter())
+    structured_log.add_handler(stream_handler)
+
     # Structured logs parser
-    self.message_logger = MessageLogger(logger=log)
+    self.message_logger = MessageLogger(logger=structured_log)
 
     # environment function for browserEnv
     self.environment = environment
 
     # Max time in seconds to wait for server startup before tests will fail -- if
     # this seems big, it's mostly for debug machines where cold startup
     # (particularly after a build) takes forever.
     self.SERVER_STARTUP_TIMEOUT = 180 if mozinfo.info.get('debug') else 90