test/logger_test.rb in semantic_logger-0.6.1 vs test/logger_test.rb in semantic_logger-0.6.2
- old
+ new
@@ -68,9 +68,29 @@
assert_match /\d+-\d+-\d+ \d+:\d+:\d+.\d+ \w \[\d+:.+\] LoggerTest -- Hello world -- #{hash_str}/, @mock_logger.message
end
end
end
+ context "Ruby Logger" do
+
+ # Ensure that any log level can be logged
+ Logger::Severity.constants.each do |level|
+ should "log Ruby logger #{level} info" do
+ @logger.level = Logger::Severity.const_get(level)
+ #assert_equal level.downcase.to_sym, @logger.level
+ if level == 'UNKNOWN'
+ assert_equal Logger::Severity.const_get('ERROR')+1, @logger.send(:level_index)
+ else
+ assert_equal Logger::Severity.const_get(level)+1, @logger.send(:level_index)
+ end
+ # @logger.send(level, 'hello world', @hash) { "Calculations" }
+ # SemanticLogger::Logger.flush
+ # assert_match /\d+-\d+-\d+ \d+:\d+:\d+.\d+ \w \[\d+:.+\] LoggerTest -- hello world -- Calculations -- #{@hash_str}/, @mock_logger.message
+ end
+ end
+ end
+
+
end
end
end
end
\ No newline at end of file