Skip to content

Commit

Permalink
ActiveSupport::BufferedLogger can be subclassed
Browse files Browse the repository at this point in the history
  • Loading branch information
senny committed Dec 25, 2012
1 parent 501175e commit 433ebbd
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
8 changes: 6 additions & 2 deletions activesupport/lib/active_support/buffered_logger.rb
Expand Up @@ -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
14 changes: 14 additions & 0 deletions 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

0 comments on commit 433ebbd

Please sign in to comment.