def __init__(self, config):
self._config = config<EOL>if self._log_cli_enabled() and config.getoption("<STR_LIT>") < <NUM_LIT:1>:<EOL><INDENT>config.option.verbose = <NUM_LIT:1><EOL><DEDENT>self.print_logs = get_option_ini(config, "<STR_LIT>")<EOL>self.formatter = logging.Formatter(<EOL>get_option_ini(config, "<STR_LIT>"),<EOL>get_option_ini(config, "<STR_LIT>"),<EOL>)<EOL>self.log_level = get_actual_log_level(config, "<STR_LIT>")<EOL>self.log_file_level = get_actual_log_level(config, "<STR_LIT>")<EOL>self.log_file_format = get_option_ini(config, "<STR_LIT>", "<STR_LIT>")<EOL>self.log_file_date_format = get_option_ini(<EOL>config, "<STR_LIT>", "<STR_LIT>"<EOL>)<EOL>self.log_file_formatter = logging.Formatter(<EOL>self.log_file_format, datefmt=self.log_file_date_format<EOL>)<EOL>log_file = get_option_ini(config, "<STR_LIT>")<EOL>if log_file:<EOL><INDENT>self.log_file_handler = logging.FileHandler(<EOL>log_file, mode="<STR_LIT:w>", encoding="<STR_LIT>"<EOL>)<EOL>self.log_file_handler.setFormatter(self.log_file_formatter)<EOL><DEDENT>else:<EOL><INDENT>self.log_file_handler = None<EOL><DEDENT>self.log_cli_handler = None<EOL>self.live_logs_context = lambda: dummy_context_manager()<EOL>if self._log_cli_enabled():<EOL><INDENT>self._setup_cli_logging()<EOL><DEDENT>
Creates a new plugin to capture log messages.

        The formatter can be safely shared across all handlers so
        create a single one for the entire test session here.