class ActiveSupport::LogSubscriber::TestHelper::MockLogger
Inherits From
-
module
ActiveSupport::
Logger:: Severity
Attributes
[R] | flush_count |
|
[RW] | level |
Public class methods
Source code GitHub
# File activesupport/lib/active_support/log_subscriber/test_helper.rb, line 60
def initialize(level = DEBUG)
@flush_count = 0
@level = level
@logged = Hash.new { |h, k| h[k] = [] }
end
Public instance methods
Source code GitHub
# File activesupport/lib/active_support/log_subscriber/test_helper.rb, line 78
def flush
@flush_count += 1
end
Source code GitHub
# File activesupport/lib/active_support/log_subscriber/test_helper.rb, line 74
def logged(level)
@logged[level].compact.map { |l| l.to_s.strip }
end
Source code GitHub
# File activesupport/lib/active_support/log_subscriber/test_helper.rb, line 66
def method_missing(level, message = nil)
if block_given?
@logged[level] << yield
else
@logged[level] << message
end
end