Permalink
Browse files

Correct BufferedLogger#level? checks. Closes #9806.

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7775 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent 2101c25 commit c90d31eb376ebe331394112697ec33a22f61c2d8 @jeremy jeremy committed Oct 7, 2007
View
@@ -1,5 +1,7 @@
*SVN*
+* Correct BufferedLogger#level? checks. #9806 [wildchild, Johan Sorensen]
+
* String#to_xs uses Eric Wong's fast_xs extension, if available, for Builder speedup. http://bogomips.org/fast_xs/ [Jeremy Kemper]
* Introduce BasicObject as Builder::BlankSlate for Ruby 1.9 forward compatibility. [Jeremy Kemper]
@@ -70,7 +70,7 @@ def #{severity.downcase}(message = nil, progname = nil, &block)
end
def #{severity.downcase}?
- @level == #{severity}
+ #{severity} >= @level
end
EOT
end
@@ -85,6 +85,13 @@ def test_should_not_mutate_message
assert !@output.string.empty?, @logger.buffer.size
end
end
+
+ def test_should_know_if_its_loglevel_is_below_a_given_level
+ ActiveSupport::BufferedLogger::Severity.constants.each do |level|
+ @logger.level = ActiveSupport::BufferedLogger::Severity.const_get(level) - 1
+ assert @logger.send("#{level.downcase}?"), "didn't know if it was #{level.downcase}? or below"
+ end
+ end
def test_should_auto_flush_every_n_messages
@logger.auto_flushing = 5

0 comments on commit c90d31e

Please sign in to comment.