def METHOD_NAME() -> Iterator[list[logging.LogRecord]]:
    """Capture logs from ReactPy
    Any logs produced in this context are cleared afterwards
    """
    original_level = ROOT_LOGGER.level
    ROOT_LOGGER.setLevel(logging.DEBUG)
    try:
        if _LOG_RECORD_CAPTOR in ROOT_LOGGER.handlers:
            start_index = len(_LOG_RECORD_CAPTOR.records)
            try:
                yield _LOG_RECORD_CAPTOR.records
            finally:
                end_index = len(_LOG_RECORD_CAPTOR.records)
                _LOG_RECORD_CAPTOR.records[start_index:end_index] = []
            return None
        ROOT_LOGGER.addHandler(_LOG_RECORD_CAPTOR)
        try:
            yield _LOG_RECORD_CAPTOR.records
        finally:
            ROOT_LOGGER.removeHandler(_LOG_RECORD_CAPTOR)
            _LOG_RECORD_CAPTOR.records.clear()
    finally:
        ROOT_LOGGER.setLevel(original_level)