code: def pytest_addoption(parser):
      """Add options to control log capturing."""
      group = parser.getgroup("logging")
  
      def add_option_ini(
          option, dest, default=None, type=None, **kwargs
      ):
          parser.addini(
              dest,
              default=default,
              type=type,
              help="default value for " + option,
          )
          group.addoption(option, dest=dest, **kwargs)
  
      add_option_ini(
          "--no-print-logs",
          dest="log_print",
          action="store_const",
          const=False,
          default=True,
          type="bool",
          help="disable printing caught logs on failed tests.",
      )
      add_option_ini(
          "--log-level",
          dest="log_level",
          default=None,
          help="logging level used by the logging module",
      )
      add_option_ini(
          "--log-format",
          dest="log_format",
          default=DEFAULT_LOG_FORMAT,
          help="log format as used by the logging module.",
      )
      add_option_ini(
          "--log-date-format",
          dest="log_date_format",
          default=DEFAULT_LOG_DATE_FORMAT,
          help="log date format as used by the logging module.",
      )
      parser.addini(
          "log_cli",
          default=False,
          type="bool",
          help='enable log display during test run (also known as "live logging").',
      )
      add_option_ini(
          "--log-cli-level",
          dest="log_cli_level",
          default=None,
          help="cli logging level.",
      )
      add_option_ini(
          "--log-cli-format",
          dest="log_cli_format",
          default=None,
          help="log format as used by the logging module.",
      )
      add_option_ini(
          "--log-cli-date-format",
          dest="log_cli_date_format",
          default=None,
          help="log date format as used by the logging module.",
      )
      add_option_ini(
          "--log-file",
          dest="log_file",
          default=None,
          help="path to a file when logging will be written to.",
      )
      add_option_ini(
          "--log-file-level",
          dest="log_file_level",
          default=None,
          help="log file logging level.",
      )
      add_option_ini(
          "--log-file-format",
          dest="log_file_format",
          default=DEFAULT_LOG_FORMAT,
          help="log format as used by the logging module.",
      )
      add_option_ini(
          "--log-file-date-format",
          dest="log_file_date_format",
          default=DEFAULT_LOG_DATE_FORMAT,
          help="log date format as used by the logging module.",
      )
  
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 3 for calling a global function with example usage: pytest_addoption(parser) without return types