def capture_logging(assertion, *assertionArgs, **assertionKwargs):
    def decorator(function):
        @validate_logging(assertion, *assertionArgs, **assertionKwargs)
        @wraps(function)
        def wrapper(self, *args, **kwargs):
            logger = kwargs["logger"]
            current_logger = _output._DEFAULT_LOGGER
            _output._DEFAULT_LOGGER = logger

            def cleanup():
                _output._DEFAULT_LOGGER = current_logger
            self.addCleanup(cleanup)
            return function(self, logger)
        return wrapper
    return decorator
Capture and validate all logging that doesn't specify a L{Logger}.
dataset/ETHPy150Open ClusterHQ/eliot/eliot/testing.py/capture_logging