diff options
author | Yves Senn <yves.senn@gmail.com> | 2012-12-25 15:50:35 +0100 |
---|---|---|
committer | Yves Senn <yves.senn@gmail.com> | 2012-12-25 15:50:35 +0100 |
commit | 433ebbdc4c82fbf0fba7851d73f9f963c105f16d (patch) | |
tree | 34ef509491b547e1b3e91605e45d3ed02ee0fa94 | |
parent | 501175e3ad6d17913a4f97df21fc0b4f9568dcac (diff) | |
download | rails-433ebbdc4c82fbf0fba7851d73f9f963c105f16d.tar.gz rails-433ebbdc4c82fbf0fba7851d73f9f963c105f16d.tar.bz2 rails-433ebbdc4c82fbf0fba7851d73f9f963c105f16d.zip |
ActiveSupport::BufferedLogger can be subclassed
-rw-r--r-- | activesupport/lib/active_support/buffered_logger.rb | 8 | ||||
-rw-r--r-- | activesupport/test/deprecation/buffered_logger_test.rb | 14 |
2 files changed, 20 insertions, 2 deletions
diff --git a/activesupport/lib/active_support/buffered_logger.rb b/activesupport/lib/active_support/buffered_logger.rb index 0595446189..2e63e67262 100644 --- a/activesupport/lib/active_support/buffered_logger.rb +++ b/activesupport/lib/active_support/buffered_logger.rb @@ -2,6 +2,10 @@ require 'active_support/deprecation' require 'active_support/logger' module ActiveSupport - BufferedLogger = ActiveSupport::Deprecation::DeprecatedConstantProxy.new( - 'BufferedLogger', '::ActiveSupport::Logger') + class BufferedLogger < Logger + def self.inherited(*) + ::ActiveSupport::Deprecation.warn 'ActiveSupport::BufferedLogger is deprecated! Use ActiveSupport::Logger instead.' + super + end + end end diff --git a/activesupport/test/deprecation/buffered_logger_test.rb b/activesupport/test/deprecation/buffered_logger_test.rb new file mode 100644 index 0000000000..1082ecef23 --- /dev/null +++ b/activesupport/test/deprecation/buffered_logger_test.rb @@ -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 |