def disable_logging(logger=None):
    """Context manager to temporarily suppress all logging for a given logger
    or the root logger if no particular logger is specified.

    """
    logger = logger or logging.getLogger()
    disabled = logger.disabled
    logger.disabled = True
    yield
    logger.disabled = disabled
def disable_logging ( logger = None ) : logger = logger or logging . getLogger ( ) disabled = logger . disabled logger . disabled = True yield logger . disabled = disabled
Context manager to temporarily suppress all logging for a given logger
    or the root logger if no particular logger is specified.