code: def caplog(request):
      """Access and control log capturing.
  
      Captured logs are available through the following properties/methods::
  
      * caplog.text            -> string containing formatted log output
      * caplog.records         -> list of logging.LogRecord instances
      * caplog.record_tuples   -> list of (logger_name, level, message) tuples
      * caplog.clear()         -> clear captured records and formatted log output string
      """
      result = LogCaptureFixture(request.node)
      yield result
      result._finalize()
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import logging
  import re
  from contextlib import contextmanager
  import py
  import six
  import pytest
  from _pytest.compat import dummy_context_manager
  from _pytest.config import create_terminal_writer
  from _pytest.pathlib import Path
label_desc: Use image node_id 5 for calling a global function with example usage: caplog(request) without return types