@contextmanager<EOL>def _create_logger(name: str, level: int) -> Generator[logging.Logger, None, None]:
<EOL>logger = logging.getLogger(name)<EOL>old_level = logger.level<EOL>logger.setLevel(level)<EOL>handler = logging.StreamHandler(sys.stdout)<EOL>formatter = logging.Formatter('<STR_LIT>')<EOL>handler.setFormatter(formatter)<EOL>logger.addHandler(handler)<EOL>yield logger<EOL>logger.setLevel(old_level)<EOL>logger.removeHandler(handler)<EOL>handler.close()<EOL>
Create a context-based logger.
    Parameters
    ----------
    name: str
        Name of logger to use when logging.
    level: int
        Logging level, one of logging's levels (e.g. INFO, ERROR, etc.).

    Returns
    -------
    logging.Logger
        Named logger that may be used for logging.