diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2005-10-23 20:00:05 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2005-10-23 20:00:05 +0000 |
commit | b57c86ae7483246fae3a38283f8a132e1ee6b7bd (patch) | |
tree | 88a6c95a2ffcba3b7a6f05caf46392fdf89935ed /activesupport/lib/active_support/clean_logger.rb | |
parent | a2f0ae76d140236e89e73ac87f79934a65d688ed (diff) | |
download | rails-b57c86ae7483246fae3a38283f8a132e1ee6b7bd.tar.gz rails-b57c86ae7483246fae3a38283f8a132e1ee6b7bd.tar.bz2 rails-b57c86ae7483246fae3a38283f8a132e1ee6b7bd.zip |
r3689@sedna: jeremy | 2005-10-16 10:24:36 -0700
Ticket 2404 - delete fixtures after using them
r3744@sedna: jeremy | 2005-10-23 12:28:28 -0700
track dirty and loaded fixtures more carefully
r3745@sedna: jeremy | 2005-10-23 12:29:39 -0700
fix broken tests
r3756@sedna: jeremy | 2005-10-23 15:51:00 -0700
Global Logger.silencer switch for Logger#silence.
r3757@sedna: jeremy | 2005-10-23 15:51:35 -0700
Correct changelogs
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2715 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport/lib/active_support/clean_logger.rb')
-rw-r--r-- | activesupport/lib/active_support/clean_logger.rb | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/activesupport/lib/active_support/clean_logger.rb b/activesupport/lib/active_support/clean_logger.rb index 330dbb2e46..89dfae8f2f 100644 --- a/activesupport/lib/active_support/clean_logger.rb +++ b/activesupport/lib/active_support/clean_logger.rb @@ -1,12 +1,22 @@ require 'logger' +require File.dirname(__FILE__) + '/class_attribute_accessors' class Logger #:nodoc: + cattr_accessor :silencer + self.silencer = true + # Silences the logger for the duration of the block. def silence(temporary_level = Logger::ERROR) - old_logger_level, self.level = level, temporary_level - yield self - ensure - self.level = old_logger_level + if silencer + begin + old_logger_level, self.level = level, temporary_level + yield self + ensure + self.level = old_logger_level + end + else + yield self + end end private |