Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #8607 from senny/8576_cant_inherit_from_deprecated…

…_buffered_logger

ActiveSupport::BufferedLogger can be subclassed
  • Loading branch information...
commit 95fa0e69de373e741d3797617950c0e2ed76f950 2 parents 501175e + 433ebbd
@rafaelfranca rafaelfranca authored
View
8 activesupport/lib/active_support/buffered_logger.rb
@@ -2,6 +2,10 @@
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
View
14 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
Please sign in to comment.
Something went wrong with that request. Please try again.