diff --git a/usadelndsoc/__init__.py b/usadelndsoc/__init__.py index 1a7460895cc501522b9cbba04e51b7b7e43745a8..5f6e0cf84fd3e195d3e50fdaa3b12d9971c01802 100644 --- a/usadelndsoc/__init__.py +++ b/usadelndsoc/__init__.py @@ -37,14 +37,13 @@ def _init_logging(): class with_log_level(contextlib.ContextDecorator): - def __init__(self, level, old_level=None): + def __init__(self, level): self._level = level - self._old_level = old_level def __enter__(self): - cm = with_log_level(self._level, int(logger.level)) - logger.setLevel(cm._level) - return cm + self._old_level = int(logger.level) + logger.setLevel(self._level) + return self def __exit__(self, *exc): logger.setLevel(self._old_level)