aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/lib/active_support/clean_logger.rb10
1 files changed, 4 insertions, 6 deletions
diff --git a/activesupport/lib/active_support/clean_logger.rb b/activesupport/lib/active_support/clean_logger.rb
index df9a6867ec..3632a27c40 100644
--- a/activesupport/lib/active_support/clean_logger.rb
+++ b/activesupport/lib/active_support/clean_logger.rb
@@ -2,13 +2,11 @@ require 'logger'
class Logger #:nodoc:
# Silences the logger for the duration of the block.
- def silence
- result = nil
- old_logger_level = level
- self.level = Logger::ERROR
- result = yield
+ def silence(temporary_level = Logger::ERROR)
+ old_logger_level, self.level = level, temporary_level
+ yield
+ ensure
self.level = old_logger_level
- return result
end
private