Namespace
Methods
- S
- T
-
- test_buffer_multibyte,
- test_should_add_message_passed_as_block_when_using_add,
- test_should_add_message_passed_as_block_when_using_shortcut,
- test_should_convert_message_to_string,
- test_should_convert_message_to_string_when_passed_in_block,
- test_should_create_the_log_directory_if_it_doesnt_exist,
- test_should_default_logger_level_to_one_passed_while_creating_it,
- test_should_know_if_its_loglevel_is_below_a_given_level,
- test_should_log_debugging_message_when_debugging,
- test_should_not_evaluate_block_if_message_wont_be_logged,
- test_should_not_log_debug_messages_when_log_level_is_info,
- test_should_not_mutate_message,
- test_write_binary_data_create_file,
- test_write_binary_data_to_existing_file
Included Modules
Constants
| Logger | = | ActiveSupport::BufferedLogger |
Inspired by the buffered logger idea by Ezra |
||
Instance Public methods
setup()
Link
test_buffer_multibyte()
Link
# File activesupport/test/buffered_logger_test.rb, line 136 def test_buffer_multibyte @logger.info(UNICODE_STRING) @logger.info(BYTE_STRING) assert @output.string.include?(UNICODE_STRING) byte_string = @output.string.dup if byte_string.respond_to?(:force_encoding) byte_string.force_encoding("ASCII-8BIT") end assert byte_string.include?(BYTE_STRING) end
test_should_add_message_passed_as_block_when_using_add()
Link
test_should_add_message_passed_as_block_when_using_shortcut()
Link
test_should_convert_message_to_string()
Link
test_should_convert_message_to_string_when_passed_in_block()
Link
test_should_create_the_log_directory_if_it_doesnt_exist()
Link
# File activesupport/test/buffered_logger_test.rb, line 126 def test_should_create_the_log_directory_if_it_doesnt_exist tmp_directory = File.join(File.dirname(__FILE__), "tmp") log_file = File.join(tmp_directory, "development.log") FileUtils.rm_rf(tmp_directory) assert_deprecated do @logger = Logger.new(log_file) end assert File.exist?(tmp_directory) end
test_should_default_logger_level_to_one_passed_while_creating_it()
Link
test_should_know_if_its_loglevel_is_below_a_given_level()
Link
# File activesupport/test/buffered_logger_test.rb, line 119 def test_should_know_if_its_loglevel_is_below_a_given_level Logger::Severity.constants.each do |level| @logger.level = Logger::Severity.const_get(level) - 1 assert @logger.send("#{level.downcase}?"), "didn't know if it was #{level.downcase}? or below" end end
test_should_log_debugging_message_when_debugging()
Link
test_should_not_evaluate_block_if_message_wont_be_logged()
Link
test_should_not_log_debug_messages_when_log_level_is_info()
Link
test_should_not_mutate_message()
Link
test_write_binary_data_create_file()
Link
# File activesupport/test/buffered_logger_test.rb, line 45 def test_write_binary_data_create_file fname = File.join Dir.tmpdir, 'lol', 'rofl.log' FileUtils.mkdir_p File.dirname(fname) f = File.open(fname, 'w') f.binmode logger = Logger.new f logger.level = Logger::DEBUG str = "\x80" if str.respond_to?(:force_encoding) str.force_encoding("ASCII-8BIT") end logger.add Logger::DEBUG, str ensure logger.close File.unlink fname end
test_write_binary_data_to_existing_file()
Link
# File activesupport/test/buffered_logger_test.rb, line 22 def test_write_binary_data_to_existing_file t = Tempfile.new ['development', 'log'] t.binmode t.write 'hi mom!' t.close f = File.open(t.path, 'w') f.binmode logger = Logger.new f logger.level = Logger::DEBUG str = "\x80" if str.respond_to?(:force_encoding) str.force_encoding("ASCII-8BIT") end logger.add Logger::DEBUG, str ensure logger.close t.close true end