提交 95f5f816 编写于 作者: D David Heinemeier Hansson

Revert "Make sure that ActiveSupport::Logger includes the Logger extensions...

Revert "Make sure that ActiveSupport::Logger includes the Logger extensions from core_ext/logger" (some confusion over deprecation)

This reverts commit d00f568a.
上级 d00f568a
## Rails 4.0.0 (unreleased) ##
* Make sure that ActiveSupport::Logger includes the Logger extensions from core_ext/logger.
* Add ActiveSupport::Logger#silence that works the same as the old Logger#silence extension.
*DHH*
......
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 @@ def around_#{level}(before_message, after_message) # def around_debug(before_me
#
# 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
......
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
......
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
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册