test/logger_test.rb in semantic_logger-0.3.2 vs test/logger_test.rb in semantic_logger-0.3.3
- old
+ new
@@ -32,38 +32,38 @@
# Ensure that any log level can be logged
SemanticLogger::Logger::LEVELS.each do |level|
should "log #{level} info" do
@logger.send(level, 'hello world', @hash) { "Calculations" }
@logger.flush
- assert_match /\d+-\d+-\d+ \d+:\d+:\d+.\d+ \w \[\d+:.+\] LoggerTest -- hello world -- Calculations -- \{:session_id=>\"HSSKLEU@JDK767\", :tracking_number=>12345\}\n/, @mock_logger.message
+ assert_match /\d+-\d+-\d+ \d+:\d+:\d+.\d+ \w \[\d+:.+\] LoggerTest -- hello world -- Calculations -- \{:session_id=>\"HSSKLEU@JDK767\", :tracking_number=>12345\}/, @mock_logger.message
end
end
context "with_tags logging" do
should "add tags to log entries" do
@logger.with_tags('12345', 'DJHSFK') do
@logger.info('Hello world')
@logger.flush
- assert_match /\d+-\d+-\d+ \d+:\d+:\d+.\d+ \w \[\d+:.+\] \[12345\] \[DJHSFK\] LoggerTest -- Hello world\n/, @mock_logger.message
+ assert_match /\d+-\d+-\d+ \d+:\d+:\d+.\d+ \w \[\d+:.+\] \[12345\] \[DJHSFK\] LoggerTest -- Hello world/, @mock_logger.message
end
end
should "add embedded tags to log entries" do
@logger.with_tags('First Level', 'tags') do
@logger.with_tags('Second Level') do
@logger.info('Hello world')
@logger.flush
- assert_match /\d+-\d+-\d+ \d+:\d+:\d+.\d+ \w \[\d+:.+\] \[First Level\] \[tags\] \[Second Level\] LoggerTest -- Hello world\n/, @mock_logger.message
+ assert_match /\d+-\d+-\d+ \d+:\d+:\d+.\d+ \w \[\d+:.+\] \[First Level\] \[tags\] \[Second Level\] LoggerTest -- Hello world/, @mock_logger.message
end
end
end
should "add payload to log entries" do
@logger.with_payload(:tracking_number => '123456') do
@logger.with_payload(:more => 'data', :even => 2) do
@logger.info('Hello world')
@logger.flush
- assert_match /\d+-\d+-\d+ \d+:\d+:\d+.\d+ \w \[\d+:.+\] LoggerTest -- Hello world -- \{:more=>\"data\", :even=>2, :tracking_number=>\"123456\"\}\n/, @mock_logger.message
+ assert_match /\d+-\d+-\d+ \d+:\d+:\d+.\d+ \w \[\d+:.+\] LoggerTest -- Hello world -- \{:more=>\"data\", :even=>2, :tracking_number=>\"123456\"\}/, @mock_logger.message
end
end
end
end
\ No newline at end of file