diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2012-12-21 19:35:10 +0100 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2012-12-21 19:35:10 +0100 |
commit | 95f5f8167ff86550d7fa9f5f7419cc9b38ef9704 (patch) | |
tree | d30a605ded5ac89a5c95e9e382eaa1cabf52507e /activesupport/lib | |
parent | d00f568a83a5159ed93618b1081bd17858536d1c (diff) | |
download | rails-95f5f8167ff86550d7fa9f5f7419cc9b38ef9704.tar.gz rails-95f5f8167ff86550d7fa9f5f7419cc9b38ef9704.tar.bz2 rails-95f5f8167ff86550d7fa9f5f7419cc9b38ef9704.zip |
Revert "Make sure that ActiveSupport::Logger includes the Logger extensions from core_ext/logger" (some confusion over deprecation)
This reverts commit d00f568a83a5159ed93618b1081bd17858536d1c.
Diffstat (limited to 'activesupport/lib')
-rw-r--r-- | activesupport/lib/active_support/core_ext/logger.rb | 21 | ||||
-rw-r--r-- | activesupport/lib/active_support/logger.rb | 4 | ||||
-rw-r--r-- | activesupport/lib/active_support/logger_silence.rb | 24 |
3 files changed, 29 insertions, 20 deletions
diff --git a/activesupport/lib/active_support/core_ext/logger.rb b/activesupport/lib/active_support/core_ext/logger.rb index 16fce81445..36c8f241b2 100644 --- a/activesupport/lib/active_support/core_ext/logger.rb +++ b/activesupport/lib/active_support/core_ext/logger.rb @@ -1,5 +1,6 @@ require 'active_support/core_ext/class/attribute_accessors' require 'active_support/deprecation' +require 'active_support/logger_silence' ActiveSupport::Deprecation.warn 'this file is deprecated and will be removed' @@ -33,25 +34,7 @@ require 'logger' # # Note: This logger is deprecated in favor of ActiveSupport::BufferedLogger class Logger - ## - # :singleton-method: - # Set to false to disable the silencer - cattr_accessor :silencer - self.silencer = true - - # Silences the logger for the duration of the block. - def silence(temporary_level = Logger::ERROR) - 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 + include LoggerSilence 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/logger.rb b/activesupport/lib/active_support/logger.rb index 023e22e642..4a55bbb350 100644 --- a/activesupport/lib/active_support/logger.rb +++ b/activesupport/lib/active_support/logger.rb @@ -1,9 +1,11 @@ require 'active_support/core_ext/class/attribute_accessors' +require 'active_support/logger_silence' require 'logger' -require 'active_support/core_ext/logger' module ActiveSupport class Logger < ::Logger + include LoggerSilence + # Broadcasts logs to multiple loggers. def self.broadcast(logger) # :nodoc: Module.new do diff --git a/activesupport/lib/active_support/logger_silence.rb b/activesupport/lib/active_support/logger_silence.rb new file mode 100644 index 0000000000..a8efdef944 --- /dev/null +++ b/activesupport/lib/active_support/logger_silence.rb @@ -0,0 +1,24 @@ +require 'active_support/concern' + +module LoggerSilence + extend ActiveSupport::Concern + + included do + cattr_accessor :silencer + self.silencer = true + end + + # Silences the logger for the duration of the block. + def silence(temporary_level = Logger::ERROR) + 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 +end
\ No newline at end of file |