aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
authorYves Senn <yves.senn@gmail.com>2012-12-25 20:21:14 +0100
committerYves Senn <yves.senn@gmail.com>2012-12-25 20:21:14 +0100
commit8787c6e0e581315c8d3d33b6bb65a6640835456e (patch)
tree0690034028af6c968c0500c8ecb3486dc35778d0 /activesupport
parent95fa0e69de373e741d3797617950c0e2ed76f950 (diff)
downloadrails-8787c6e0e581315c8d3d33b6bb65a6640835456e.tar.gz
rails-8787c6e0e581315c8d3d33b6bb65a6640835456e.tar.bz2
rails-8787c6e0e581315c8d3d33b6bb65a6640835456e.zip
deprecation warning when BufferedLogger is instantiated
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/lib/active_support/buffered_logger.rb12
-rw-r--r--activesupport/test/deprecation/buffered_logger_test.rb8
2 files changed, 19 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/buffered_logger.rb b/activesupport/lib/active_support/buffered_logger.rb
index 2e63e67262..1cd0c2f790 100644
--- a/activesupport/lib/active_support/buffered_logger.rb
+++ b/activesupport/lib/active_support/buffered_logger.rb
@@ -3,9 +3,19 @@ require 'active_support/logger'
module ActiveSupport
class BufferedLogger < Logger
+
+ def initialize(*args)
+ self.class._deprecation_warning
+ super
+ end
+
def self.inherited(*)
- ::ActiveSupport::Deprecation.warn 'ActiveSupport::BufferedLogger is deprecated! Use ActiveSupport::Logger instead.'
+ _deprecation_warning
super
end
+
+ def self._deprecation_warning
+ ::ActiveSupport::Deprecation.warn 'ActiveSupport::BufferedLogger is deprecated! Use ActiveSupport::Logger instead.'
+ end
end
end
diff --git a/activesupport/test/deprecation/buffered_logger_test.rb b/activesupport/test/deprecation/buffered_logger_test.rb
index 1082ecef23..bf11a4732c 100644
--- a/activesupport/test/deprecation/buffered_logger_test.rb
+++ b/activesupport/test/deprecation/buffered_logger_test.rb
@@ -11,4 +11,12 @@ class BufferedLoggerTest < ActiveSupport::TestCase
Class.new(ActiveSupport::BufferedLogger)
end
+ def test_issues_deprecation_when_instantiated
+ warn = 'ActiveSupport::BufferedLogger is deprecated! Use ActiveSupport::Logger instead.'
+
+ ActiveSupport::Deprecation.expects(:warn).with(warn).once
+
+ ActiveSupport::BufferedLogger.new(STDOUT)
+ end
+
end