Skip to content

Commit

Permalink
Fix bug in restoring logging level if exception is raised in context …
Browse files Browse the repository at this point in the history
…manager
  • Loading branch information
pv committed Feb 7, 2015
1 parent cf95250 commit 044b8d6
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions asv/console.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,8 +308,10 @@ def enable(self, verbose=False):
def set_level(self, level):
orig_level = self._logger.level
self._logger.setLevel(level)
yield
self._logger.setLevel(orig_level)
try:
yield
finally:
self._logger.setLevel(orig_level)

def is_debug_enabled(self):
return self._logger.getEffectiveLevel() <= logging.DEBUG
Expand Down

0 comments on commit 044b8d6

Please sign in to comment.