class_docstr: A test case that captures and discards all logging output
  if the test passes.
  
  Some libraries can produce a lot of logging output even when
  the test succeeds, so this class can be useful to minimize the noise.
  Simply use it as a base class for your test case.  It is safe to combine
  with AsyncTestCase via multiple inheritance
  (``class MyTestCase(AsyncHTTPTestCase, LogTrapTestCase):``)
  
  This class assumes that only one log handler is configured and
  that it is a `~logging.StreamHandler`.  This is true for both
  `logging.basicConfig` and the "pretty logging" configured by
  `tornado.options`.  It is not compatible with other log buffering
  mechanisms, such as those provided by some test runners.
  
  .. deprecated:: 4.1
     Use the unittest module's ``--buffer`` option instead, or `.ExpectLog`.
code: def run(self, result=None):
      logger = logging.getLogger()
      if not logger.handlers:
          logging.basicConfig()
      handler = logger.handlers[0]
      if len(logger.handlers) > 1 or not isinstance(
          handler, logging.StreamHandler
      ):
          # Logging has been configured in a way we don't recognize,
          # so just leave it alone.
          super(LogTrapTestCase, self).run(result)
          return
      old_stream = handler.stream
      try:
          handler.stream = StringIO()
          gen_log.info("RUNNING TEST: " + str(self))
          old_error_count = len(result.failures) + len(result.errors)
          super(LogTrapTestCase, self).run(result)
          new_error_count = len(result.failures) + len(result.errors)
          if new_error_count != old_error_count:
              old_stream.write(handler.stream.getvalue())
      finally:
          handler.stream = old_stream
  
imports: from __future__ import absolute_import, division, print_function
  from tornado.log import gen_log, app_log
  from tornado.stack_context import ExceptionStackContext
  from tornado.util import raise_exc_info, basestring_type, PY3
  import functools
  import inspect
  import logging
  import os
  import re
  import signal
  import socket
  import sys
label_desc: Use image node_id 1 for calling the LogTrapTestCase obj's underlying member method code with example usage: obj.run(result) without return types