diff options
Diffstat (limited to 'activesupport')
-rw-r--r-- | activesupport/CHANGELOG | 5 | ||||
-rw-r--r-- | activesupport/lib/active_support/clean_logger.rb | 10 |
2 files changed, 15 insertions, 0 deletions
diff --git a/activesupport/CHANGELOG b/activesupport/CHANGELOG index 13bff74524..e9e3895a69 100644 --- a/activesupport/CHANGELOG +++ b/activesupport/CHANGELOG @@ -1,3 +1,8 @@ +*SVN* + +* Added silencing to the default Logger class + + *1.0.4* (19th April, 2005) * Fixed that in some circumstances controllers outside of modules may have hidden ones inside modules. For example, admin/content might have been hidden by /content. #1075 [Nicholas Seckar] diff --git a/activesupport/lib/active_support/clean_logger.rb b/activesupport/lib/active_support/clean_logger.rb index 1a36562892..df9a6867ec 100644 --- a/activesupport/lib/active_support/clean_logger.rb +++ b/activesupport/lib/active_support/clean_logger.rb @@ -1,6 +1,16 @@ 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 + self.level = old_logger_level + return result + end + private remove_const "Format" Format = "%s\n" |