From b590fe4892d312cbdde350e7c4f8fbbcaf8c61ee Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Sat, 24 Dec 2011 10:34:54 -0700 Subject: delegating and deprecating logger#silence. fixes #4159 --- activesupport/lib/active_support/core_ext/logger.rb | 2 ++ activesupport/lib/active_support/tagged_logging.rb | 6 ++++++ 2 files changed, 8 insertions(+) (limited to 'activesupport/lib/active_support') diff --git a/activesupport/lib/active_support/core_ext/logger.rb b/activesupport/lib/active_support/core_ext/logger.rb index e63a0a9ed9..ca0f382966 100644 --- a/activesupport/lib/active_support/core_ext/logger.rb +++ b/activesupport/lib/active_support/core_ext/logger.rb @@ -1,4 +1,5 @@ require 'active_support/core_ext/class/attribute_accessors' +require 'active_support/deprecation' # Adds the 'around_level' method to Logger. class Logger #:nodoc: @@ -49,6 +50,7 @@ class Logger yield self end end + deprecate :silence alias :old_datetime_format= :datetime_format= # Logging date-time format (string passed to +strftime+). Ignored if the formatter diff --git a/activesupport/lib/active_support/tagged_logging.rb b/activesupport/lib/active_support/tagged_logging.rb index 0f3ac0c132..a3a2c48817 100644 --- a/activesupport/lib/active_support/tagged_logging.rb +++ b/activesupport/lib/active_support/tagged_logging.rb @@ -1,4 +1,5 @@ require 'active_support/core_ext/object/blank' +require 'active_support/deprecation' require 'logger' module ActiveSupport @@ -26,6 +27,11 @@ module ActiveSupport new_tags.size.times { tags.pop } end + def silence(temporary_level = ERROR, &block) + @logger.silience(temporary_level, &block) + end + deprecate :silence + def add(severity, message = nil, progname = nil, &block) @logger.add(severity, "#{tags_text}#{message}", progname, &block) end -- cgit v1.2.3