Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Improved the silence method on the logger to ensure restoring the old…
… level #1240 [bitsweat

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1277 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information
dhh committed May 2, 2005
1 parent ea85fb6 commit 7d42369
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions activesupport/lib/active_support/clean_logger.rb
Expand Up @@ -2,13 +2,11 @@

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
Expand Down

0 comments on commit 7d42369

Please sign in to comment.