def METHOD_NAME(
    self,
    result,
    capture_level_override=None,
    attach_log_override=None,
    format_override=None,
):
    def override(value, _with):
        return value if _with is None else _with
    capture_level = override(
        self.log_capture_config.capture_level, capture_level_override
    )
    save_to_file = override(
        self.log_capture_config.attach_log, attach_log_override
    )
    format_string = override(
        self.log_capture_config.format, format_override
    )
    if save_to_file:
        stream = NamedTemporaryFile(
            "w+t", dir=result._scratch, suffix=".log", delete=False
        )
    else:
        stream = io.StringIO()
    handler = StreamHandler(stream)
    handler.setFormatter(logging.Formatter(format_string))
    for logger in self.select_loggers(capture_level):
        logger.addHandler(handler)
    return self._LogCaptureInfo(
        result, handler, save_to_file, capture_level
    )