def debug_logger(): handler = logging.StreamHandler() logger.addHandler(handler) logger.setLevel(logging.DEBUG) yield logger.removeHandler(handler)
def finish(self): logger.removeHandler(self.handler)