mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
ActiveSupport::BufferedLogger can be subclassed
This commit is contained in:
parent
501175e3ad
commit
433ebbdc4c
2 changed files with 20 additions and 2 deletions
|
@ -2,6 +2,10 @@ require 'active_support/deprecation'
|
||||||
require 'active_support/logger'
|
require 'active_support/logger'
|
||||||
|
|
||||||
module ActiveSupport
|
module ActiveSupport
|
||||||
BufferedLogger = ActiveSupport::Deprecation::DeprecatedConstantProxy.new(
|
class BufferedLogger < Logger
|
||||||
'BufferedLogger', '::ActiveSupport::Logger')
|
def self.inherited(*)
|
||||||
|
::ActiveSupport::Deprecation.warn 'ActiveSupport::BufferedLogger is deprecated! Use ActiveSupport::Logger instead.'
|
||||||
|
super
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
14
activesupport/test/deprecation/buffered_logger_test.rb
Normal file
14
activesupport/test/deprecation/buffered_logger_test.rb
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
require 'abstract_unit'
|
||||||
|
require 'active_support/buffered_logger'
|
||||||
|
|
||||||
|
class BufferedLoggerTest < ActiveSupport::TestCase
|
||||||
|
|
||||||
|
def test_can_be_subclassed
|
||||||
|
warn = 'ActiveSupport::BufferedLogger is deprecated! Use ActiveSupport::Logger instead.'
|
||||||
|
|
||||||
|
ActiveSupport::Deprecation.expects(:warn).with(warn).once
|
||||||
|
|
||||||
|
Class.new(ActiveSupport::BufferedLogger)
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
Loading…
Reference in a new issue