def METHOD_NAME(
    self, result, capture_level=None, attach_log=None, format=None
):
    """Context manager to capture logs, capture the log in the provided result.
    :param result: The result where to inject the log
    :param CaptureLevel capture_level:  The level the log are captured, TESTSUITE (default), TESTPLAN or ROOT
    :param bool attach_log: If True the logs captured to file and then attached to the result
    :param str format: A format string can be passed to the loghandler
    :return: returns the suite level logger
    :rtype: logging.Logger
    """
    info = None
    try:
        info = self._attach_handler(
            result,
            capture_level_override=capture_level,
            attach_log_override=attach_log,
            format_override=format,
        )
        yield self.logger
    finally:
        if info:
            self._detach_handler(info)