semantic_logger 3.2.1 → 3.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/lib/semantic_logger.rb +22 -2
  4. data/lib/semantic_logger/appender/bugsnag.rb +2 -2
  5. data/lib/semantic_logger/appender/elasticsearch.rb +9 -1
  6. data/lib/semantic_logger/appender/file.rb +1 -1
  7. data/lib/semantic_logger/appender/graylog.rb +18 -21
  8. data/lib/semantic_logger/appender/honeybadger.rb +27 -12
  9. data/lib/semantic_logger/appender/http.rb +19 -11
  10. data/lib/semantic_logger/appender/mongodb.rb +23 -30
  11. data/lib/semantic_logger/appender/new_relic.rb +2 -2
  12. data/lib/semantic_logger/appender/splunk.rb +32 -21
  13. data/lib/semantic_logger/appender/splunk_http.rb +1 -3
  14. data/lib/semantic_logger/appender/syslog.rb +25 -10
  15. data/lib/semantic_logger/appender/tcp.rb +231 -0
  16. data/lib/semantic_logger/appender/udp.rb +106 -0
  17. data/lib/semantic_logger/appender/wrapper.rb +1 -1
  18. data/lib/semantic_logger/base.rb +9 -3
  19. data/lib/semantic_logger/formatters/base.rb +36 -0
  20. data/lib/semantic_logger/formatters/color.rb +13 -10
  21. data/lib/semantic_logger/formatters/default.rb +8 -5
  22. data/lib/semantic_logger/formatters/json.rb +10 -3
  23. data/lib/semantic_logger/formatters/raw.rb +13 -0
  24. data/lib/semantic_logger/formatters/syslog.rb +119 -0
  25. data/lib/semantic_logger/log.rb +7 -5
  26. data/lib/semantic_logger/loggable.rb +5 -0
  27. data/lib/semantic_logger/logger.rb +45 -10
  28. data/lib/semantic_logger/metrics/new_relic.rb +1 -1
  29. data/lib/semantic_logger/metrics/statsd.rb +5 -1
  30. data/lib/semantic_logger/metrics/udp.rb +80 -0
  31. data/lib/semantic_logger/semantic_logger.rb +23 -27
  32. data/lib/semantic_logger/subscriber.rb +127 -0
  33. data/lib/semantic_logger/version.rb +1 -1
  34. data/test/appender/elasticsearch_test.rb +6 -4
  35. data/test/appender/file_test.rb +12 -12
  36. data/test/appender/honeybadger_test.rb +7 -1
  37. data/test/appender/http_test.rb +4 -2
  38. data/test/appender/mongodb_test.rb +1 -2
  39. data/test/appender/splunk_http_test.rb +8 -6
  40. data/test/appender/splunk_test.rb +48 -45
  41. data/test/appender/syslog_test.rb +3 -3
  42. data/test/appender/tcp_test.rb +68 -0
  43. data/test/appender/udp_test.rb +61 -0
  44. data/test/appender/wrapper_test.rb +5 -5
  45. data/test/concerns/compatibility_test.rb +6 -6
  46. data/test/debug_as_trace_logger_test.rb +2 -2
  47. data/test/loggable_test.rb +2 -2
  48. data/test/logger_test.rb +48 -45
  49. metadata +13 -3
  50. data/lib/semantic_logger/appender/base.rb +0 -101
@@ -7,8 +7,10 @@ module Appender
7
7
 
8
8
  describe SemanticLogger::Appender::Http do
9
9
  before do
10
- @appender = SemanticLogger::Appender::Http.new(url: 'http://localhost:8088/path')
11
- @message = 'AppenderHttpTest log message'
10
+ Net::HTTP.stub_any_instance(:start, true) do
11
+ @appender = SemanticLogger::Appender::Http.new(url: 'http://localhost:8088/path')
12
+ end
13
+ @message = 'AppenderHttpTest log message'
12
14
  end
13
15
 
14
16
  SemanticLogger::LEVELS.each do |level|
@@ -67,7 +67,6 @@ module Appender
67
67
  end
68
68
 
69
69
  it 'handle message without payload' do
70
- log = SemanticLogger::Log.new(:debug)
71
70
  @appender.debug('hello world')
72
71
 
73
72
  document = @appender.collection.find_one
@@ -94,7 +93,7 @@ module Appender
94
93
  assert_equal 12345, document['tracking_number']
95
94
  assert_equal 'HSSKLEU@JDK767', document['session_id']
96
95
  assert_equal $$, document['pid']
97
- assert_equal 'test', document['host']
96
+ assert_equal 'test', document['host'], document.ai
98
97
  assert_equal 'test_application', document['application']
99
98
  end
100
99
  end
@@ -7,10 +7,12 @@ module Appender
7
7
 
8
8
  describe SemanticLogger::Appender::SplunkHttp do
9
9
  before do
10
- @appender = SemanticLogger::Appender::SplunkHttp.new(
11
- url: 'http://localhost:8088/path',
12
- token: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
13
- )
10
+ Net::HTTP.stub_any_instance(:start, true) do
11
+ @appender = SemanticLogger::Appender::SplunkHttp.new(
12
+ url: 'http://localhost:8088/path',
13
+ token: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
14
+ )
15
+ end
14
16
  @message = 'AppenderSplunkHttpTest log message'
15
17
  end
16
18
 
@@ -20,7 +22,7 @@ module Appender
20
22
  @appender.http.stub(:request, -> r { request = r; response_mock.new('200', 'ok') }) do
21
23
  @appender.send(level, @message)
22
24
  end
23
- body = decompress_data(request.body)
25
+ body = decompress_data(request.body)
24
26
  message = JSON.parse(body)
25
27
  assert_equal @message, message['event']['message']
26
28
  assert_equal level.to_s, message['event']['level']
@@ -53,7 +55,7 @@ module Appender
53
55
  @appender.http.stub(:request, -> r { request = r; response_mock.new('200', 'ok') }) do
54
56
  @appender.send(level, @message, {key1: 1, key2: 'a'})
55
57
  end
56
- body = decompress_data(request.body)
58
+ body = decompress_data(request.body)
57
59
  message = JSON.parse(body)
58
60
  assert message['event'], message.ai
59
61
  assert_equal @message, message['event']['message']
@@ -17,65 +17,68 @@ module Appender
17
17
  describe SemanticLogger::Appender::Splunk do
18
18
  before do
19
19
  SemanticLogger::Appender::Splunk.stub_any_instance(:reopen, nil) do
20
- @appender = SemanticLogger::Appender::Splunk.new(level: :info)
20
+ @appender = SemanticLogger::Appender::Splunk.new
21
21
  end
22
22
  @message = 'AppenderSplunkTest log message'
23
23
  end
24
24
 
25
- it 'not send :trace notifications to Splunk when set to :error' do
26
- mock = Mock.new
27
- @appender.stub(:service_index, mock) do
28
- @appender.trace('AppenderSplunkTest trace message')
25
+ SemanticLogger::LEVELS.each do |level|
26
+ it "send #{level}" do
27
+ mock = Mock.new
28
+ @appender.stub(:service_index, mock) do
29
+ @appender.send(level, @message)
30
+ end
31
+ assert_equal @message, mock.message
32
+ assert_equal level, mock.event[:event][:level]
33
+ refute mock.event[:event][:exception]
29
34
  end
30
- assert_nil mock.event
31
- assert_nil mock.message
32
- end
33
35
 
34
- it 'send exception notifications to Splunk with severity' do
35
- hash = nil
36
- exc = nil
37
- begin
38
- Uh oh
39
- rescue Exception => e
40
- exc = e
41
- end
42
- mock = Mock.new
43
- @appender.stub(:service_index, mock) do
44
- @appender.error 'Reading File', exc
36
+ it "sends #{level} exceptions" do
37
+ exc = nil
38
+ begin
39
+ Uh oh
40
+ rescue Exception => e
41
+ exc = e
42
+ end
43
+
44
+ mock = Mock.new
45
+ @appender.stub(:service_index, mock) do
46
+ @appender.send(level, @message, exc)
47
+ end
48
+ assert_equal @message, mock.message
49
+
50
+ assert exception = mock.event[:event][:exception]
51
+ assert 'NameError', exception[:name]
52
+ assert 'undefined local variable or method', exception[:message]
53
+ assert_equal level, mock.event[:event][:level]
54
+ assert exception[:stack_trace].first.include?(__FILE__), exception
45
55
  end
46
- assert_equal 'Reading File', mock.message
47
- hash = mock.event
48
- refute hash[:message]
49
- assert 'NameError', hash[:exception][:name]
50
- assert 'undefined local variable or method', hash[:exception][:message]
51
- assert_equal 4, hash[:level_index], 'Should be error level (4)'
52
- assert_equal :error, hash[:level]
53
- assert hash[:exception][:stack_trace].first.include?(__FILE__), hash[:exception]
54
- end
55
56
 
56
- it 'send error notifications to Splunk with severity' do
57
- mock = Mock.new
58
- @appender.stub(:service_index, mock) do
59
- @appender.error @message
57
+ it "sends #{level} custom attributes" do
58
+ mock = Mock.new
59
+ @appender.stub(:service_index, mock) do
60
+ @appender.send(level, @message, {key1: 1, key2: 'a'})
61
+ end
62
+ assert_equal @message, mock.message
63
+
64
+ assert mock.event[:event], mock.event.ai
65
+ assert_equal level, mock.event[:event][:level]
66
+ refute mock.event[:event][:stack_trace]
67
+ assert_equal(1, mock.event[:event][:key1], mock.event)
68
+ assert_equal('a', mock.event[:event][:key2], mock.event)
60
69
  end
61
- assert_equal @message, mock.message
62
- assert_equal :error, mock.event[:level]
63
- refute mock.event[:stack_trace]
64
70
  end
65
71
 
66
- it 'send notification to Splunk with custom attributes' do
67
- mock = Mock.new
72
+ it 'does not send :trace notifications to Splunk when set to :error' do
73
+ mock = Mock.new
74
+ @appender.level = :error
68
75
  @appender.stub(:service_index, mock) do
69
- @appender.error @message, {key1: 1, key2: 'a'}
76
+ @appender.trace('AppenderSplunkTest trace message')
70
77
  end
71
- assert_equal @message, mock.message
72
- hash = mock.event
73
- assert_equal :error, hash[:level]
74
- refute hash[:stack_trace]
75
- assert_equal(1, hash[:key1], hash)
76
- assert_equal('a', hash[:key2], hash)
78
+ assert_nil mock.event
79
+ assert_nil mock.message
77
80
  end
78
-
79
81
  end
82
+
80
83
  end
81
84
  end
@@ -15,7 +15,7 @@ module Appender
15
15
  syslog_appender.debug 'AppenderSyslogTest log message'
16
16
  end
17
17
  end
18
- assert_match /D (.*?) SemanticLogger::Appender::Syslog -- AppenderSyslogTest log message/, message
18
+ assert_match(/D (.*?) SemanticLogger::Appender::Syslog -- AppenderSyslogTest log message/, message)
19
19
  end
20
20
 
21
21
  it 'handle remote syslog over TCP' do
@@ -28,7 +28,7 @@ module Appender
28
28
  end
29
29
  end
30
30
  end
31
- assert_match /<70>(.*?)SemanticLogger::Appender::Syslog -- AppenderSyslogTest log message\r\n/, message
31
+ assert_match(/<70>(.*?)SemanticLogger::Appender::Syslog -- AppenderSyslogTest log message\r\n/, message)
32
32
  end
33
33
 
34
34
  it 'handle remote syslog over UDP' do
@@ -37,7 +37,7 @@ module Appender
37
37
  UDPSocket.stub_any_instance(:send, -> msg, num, host, port { message = msg }) do
38
38
  syslog_appender.debug 'AppenderSyslogTest log message'
39
39
  end
40
- assert_match /<70>(.*?)SemanticLogger::Appender::Syslog -- AppenderSyslogTest log message/, message
40
+ assert_match(/<70>(.*?)SemanticLogger::Appender::Syslog -- AppenderSyslogTest log message/, message)
41
41
  end
42
42
 
43
43
  # Should be able to log each level.
@@ -0,0 +1,68 @@
1
+ require_relative '../test_helper'
2
+
3
+ # Unit Test for SemanticLogger::Appender::Tcp
4
+ module Appender
5
+ class TcpTest < Minitest::Test
6
+ response_mock = Struct.new(:code, :body)
7
+
8
+ describe SemanticLogger::Appender::Tcp do
9
+ before do
10
+ Net::TCPClient.stub_any_instance(:connect, true) do
11
+ @appender = SemanticLogger::Appender::Tcp.new(server: 'localhost:8088')
12
+ end
13
+ @appender.tcp_client.instance_eval do
14
+ def retry_on_connection_failure
15
+ yield
16
+ end
17
+ end
18
+ @message = 'AppenderTcpTest log message'
19
+ end
20
+
21
+ SemanticLogger::LEVELS.each do |level|
22
+ it "send #{level}" do
23
+ data = nil
24
+ @appender.tcp_client.stub(:write, -> d { data = d }) do
25
+ @appender.send(level, @message)
26
+ end
27
+ hash = JSON.parse(data)
28
+ assert_equal @message, hash['message']
29
+ assert_equal level.to_s, hash['level']
30
+ refute hash['stack_trace']
31
+ end
32
+
33
+ it "send #{level} exceptions" do
34
+ exc = nil
35
+ begin
36
+ Uh oh
37
+ rescue Exception => e
38
+ exc = e
39
+ end
40
+ data = nil
41
+ @appender.tcp_client.stub(:write, -> d { data = d }) do
42
+ @appender.send(level, 'Reading File', exc)
43
+ end
44
+ hash = JSON.parse(data)
45
+ assert 'Reading File', hash['message']
46
+ assert 'NameError', hash['exception']['name']
47
+ assert 'undefined local variable or method', hash['exception']['message']
48
+ assert_equal level.to_s, hash['level'], 'Should be error level (3)'
49
+ assert hash['exception']['stack_trace'].first.include?(__FILE__), hash['exception']
50
+ end
51
+
52
+ it "send #{level} custom attributes" do
53
+ data = nil
54
+ @appender.tcp_client.stub(:write, -> d { data = d }) do
55
+ @appender.send(level, @message, {key1: 1, key2: 'a'})
56
+ end
57
+ hash = JSON.parse(data)
58
+ assert_equal @message, hash['message']
59
+ assert_equal level.to_s, hash['level']
60
+ refute hash['stack_trace']
61
+ assert_equal 1, hash['key1'], hash
62
+ assert_equal 'a', hash['key2'], hash
63
+ end
64
+
65
+ end
66
+ end
67
+ end
68
+ end
@@ -0,0 +1,61 @@
1
+ require_relative '../test_helper'
2
+
3
+ # Unit Test for SemanticLogger::Appender::Tcp
4
+ module Appender
5
+ class UdpTest < Minitest::Test
6
+ response_mock = Struct.new(:code, :body)
7
+
8
+ describe SemanticLogger::Appender::Udp do
9
+ before do
10
+ @appender = SemanticLogger::Appender::Udp.new(server: 'localhost:8088')
11
+ @message = 'AppenderUdpTest log message'
12
+ end
13
+
14
+ SemanticLogger::LEVELS.each do |level|
15
+ it "send #{level}" do
16
+ data = nil
17
+ @appender.socket.stub(:send, -> d, flags { data = d }) do
18
+ @appender.send(level, @message)
19
+ end
20
+ hash = JSON.parse(data)
21
+ assert_equal @message, hash['message']
22
+ assert_equal level.to_s, hash['level']
23
+ refute hash['stack_trace']
24
+ end
25
+
26
+ it "send #{level} exceptions" do
27
+ exc = nil
28
+ begin
29
+ Uh oh
30
+ rescue Exception => e
31
+ exc = e
32
+ end
33
+ data = nil
34
+ @appender.socket.stub(:send, -> d, flags { data = d }) do
35
+ @appender.send(level, 'Reading File', exc)
36
+ end
37
+ hash = JSON.parse(data)
38
+ assert 'Reading File', hash['message']
39
+ assert 'NameError', hash['exception']['name']
40
+ assert 'undefined local variable or method', hash['exception']['message']
41
+ assert_equal level.to_s, hash['level'], 'Should be error level (3)'
42
+ assert hash['exception']['stack_trace'].first.include?(__FILE__), hash['exception']
43
+ end
44
+
45
+ it "send #{level} custom attributes" do
46
+ data = nil
47
+ @appender.socket.stub(:send, -> d, flags { data = d }) do
48
+ @appender.send(level, @message, {key1: 1, key2: 'a'})
49
+ end
50
+ hash = JSON.parse(data)
51
+ assert_equal @message, hash['message']
52
+ assert_equal level.to_s, hash['level']
53
+ refute hash['stack_trace']
54
+ assert_equal 1, hash['key1'], hash
55
+ assert_equal 'a', hash['key2'], hash
56
+ end
57
+
58
+ end
59
+ end
60
+ end
61
+ end
@@ -19,7 +19,7 @@ module Appender
19
19
  log.time = Time.now
20
20
  log.level = :debug
21
21
  @appender.log(log)
22
- assert_match /\d+-\d+-\d+ \d+:\d+:\d+.\d+ D \[\d+:\] /, @mock_logger.message
22
+ assert_match(/\d+-\d+-\d+ \d+:\d+:\d+.\d+ D \[\d+:\] /, @mock_logger.message)
23
23
  end
24
24
 
25
25
  it 'handle nil message and payload' do
@@ -28,7 +28,7 @@ module Appender
28
28
  log.level = :debug
29
29
  log.name = 'class'
30
30
  @appender.log(log)
31
- assert_match /\d+-\d+-\d+ \d+:\d+:\d+.\d+ D \[\d+:\] class/, @mock_logger.message
31
+ assert_match(/\d+-\d+-\d+ \d+:\d+:\d+.\d+ D \[\d+:\] class/, @mock_logger.message)
32
32
  end
33
33
 
34
34
  it 'handle nil payload' do
@@ -38,7 +38,7 @@ module Appender
38
38
  log.name = 'class'
39
39
  log.message = 'hello world'
40
40
  @appender.log(log)
41
- assert_match /\d+-\d+-\d+ \d+:\d+:\d+.\d+ D \[\d+:\] class -- hello world/, @mock_logger.message
41
+ assert_match(/\d+-\d+-\d+ \d+:\d+:\d+.\d+ D \[\d+:\] class -- hello world/, @mock_logger.message)
42
42
  end
43
43
 
44
44
  it 'handle payload' do
@@ -49,7 +49,7 @@ module Appender
49
49
  log.message = 'hello world'
50
50
  log.payload = @hash
51
51
  @appender.log(log)
52
- assert_match /\d+-\d+-\d+ \d+:\d+:\d+.\d+ D \[\d+:\] class -- hello world -- #{@hash_str}/, @mock_logger.message
52
+ assert_match(/\d+-\d+-\d+ \d+:\d+:\d+.\d+ D \[\d+:\] class -- hello world -- #{@hash_str}/, @mock_logger.message)
53
53
  end
54
54
  end
55
55
 
@@ -58,7 +58,7 @@ module Appender
58
58
  Logger::Severity.constants.each do |level|
59
59
  it "log #{level.downcase.to_sym} info" do
60
60
  @appender.log SemanticLogger::Log.new(level.downcase.to_sym, 'thread', 'class', 'hello world', @hash, Time.now)
61
- assert_match /\d+-\d+-\d+ \d+:\d+:\d+.\d+ \w \[\d+:thread\] class -- hello world -- #{@hash_str}/, @mock_logger.message
61
+ assert_match(/\d+-\d+-\d+ \d+:\d+:\d+.\d+ \w \[\d+:thread\] class -- hello world -- #{@hash_str}/, @mock_logger.message)
62
62
  end
63
63
  end
64
64
  end
@@ -23,19 +23,19 @@ class CompatibilityTest < Minitest::Test
23
23
  it '#add' do
24
24
  @logger.add(Logger::INFO, 'hello world', 'progname') { 'Data' }
25
25
  SemanticLogger.flush
26
- assert_match /\d+-\d+-\d+ \d+:\d+:\d+.\d+ I \[\d+:#{@thread_name}\] CompatibilityTest -- hello world -- Data -- \"progname\"/, @mock_logger.message
26
+ assert_match(/\d+-\d+-\d+ \d+:\d+:\d+.\d+ I \[\d+:#{@thread_name}\] CompatibilityTest -- hello world -- Data -- \"progname\"/, @mock_logger.message)
27
27
  end
28
28
 
29
29
  it '#log' do
30
30
  @logger.log(Logger::FATAL, 'hello world', 'progname') { 'Data' }
31
31
  SemanticLogger.flush
32
- assert_match /\d+-\d+-\d+ \d+:\d+:\d+.\d+ F \[\d+:#{@thread_name}\] CompatibilityTest -- hello world -- Data -- \"progname\"/, @mock_logger.message
32
+ assert_match(/\d+-\d+-\d+ \d+:\d+:\d+.\d+ F \[\d+:#{@thread_name}\] CompatibilityTest -- hello world -- Data -- \"progname\"/, @mock_logger.message)
33
33
  end
34
34
 
35
35
  it '#unknown' do
36
36
  @logger.unknown('hello world') { 'Data' }
37
37
  SemanticLogger.flush
38
- assert_match /\d+-\d+-\d+ \d+:\d+:\d+.\d+ E \[\d+:#{@thread_name}\] CompatibilityTest -- hello world -- Data/, @mock_logger.message
38
+ assert_match(/\d+-\d+-\d+ \d+:\d+:\d+.\d+ E \[\d+:#{@thread_name}\] CompatibilityTest -- hello world -- Data/, @mock_logger.message)
39
39
  end
40
40
 
41
41
  it '#unknown? as error?' do
@@ -51,7 +51,7 @@ class CompatibilityTest < Minitest::Test
51
51
  it '#<< as info' do
52
52
  @logger << 'hello world'
53
53
  SemanticLogger.flush
54
- assert_match /\d+-\d+-\d+ \d+:\d+:\d+.\d+ I \[\d+:#{@thread_name}\] CompatibilityTest -- hello world/, @mock_logger.message
54
+ assert_match(/\d+-\d+-\d+ \d+:\d+:\d+.\d+ I \[\d+:#{@thread_name}\] CompatibilityTest -- hello world/, @mock_logger.message)
55
55
  end
56
56
 
57
57
  it '#progname= as #name=' do
@@ -92,14 +92,14 @@ class CompatibilityTest < Minitest::Test
92
92
  @logger.close
93
93
  @logger.info('hello world') { 'Data' }
94
94
  SemanticLogger.flush
95
- assert_match /\d+-\d+-\d+ \d+:\d+:\d+.\d+ I \[\d+:#{@thread_name}\] CompatibilityTest -- hello world -- Data/, @mock_logger.message
95
+ assert_match(/\d+-\d+-\d+ \d+:\d+:\d+.\d+ I \[\d+:#{@thread_name}\] CompatibilityTest -- hello world -- Data/, @mock_logger.message)
96
96
  end
97
97
 
98
98
  it '#reopen NOOP' do
99
99
  @logger.reopen
100
100
  @logger.info('hello world') { 'Data' }
101
101
  SemanticLogger.flush
102
- assert_match /\d+-\d+-\d+ \d+:\d+:\d+.\d+ I \[\d+:#{@thread_name}\] CompatibilityTest -- hello world -- Data/, @mock_logger.message
102
+ assert_match(/\d+-\d+-\d+ \d+:\d+:\d+.\d+ I \[\d+:#{@thread_name}\] CompatibilityTest -- hello world -- Data/, @mock_logger.message)
103
103
  end
104
104
 
105
105
  end
@@ -81,14 +81,14 @@ class DebugAsTraceLoggerTest < Minitest::Test
81
81
  @logger.level = :trace
82
82
  @logger.debug('hello world', @hash) { "Calculations" }
83
83
  SemanticLogger.flush
84
- assert_match /\d+-\d+-\d+ \d+:\d+:\d+.\d+ T \[\d+:.+\] DebugAsTraceLoggerTest -- hello world -- Calculations -- #{@hash_str}/, @mock_logger.message
84
+ assert_match(/\d+-\d+-\d+ \d+:\d+:\d+.\d+ T \[\d+:.+\] DebugAsTraceLoggerTest -- hello world -- Calculations -- #{@hash_str}/, @mock_logger.message)
85
85
  end
86
86
 
87
87
  it 'log trace as trace' do
88
88
  @logger.level = :trace
89
89
  @logger.trace('hello world', @hash) { "Calculations" }
90
90
  SemanticLogger.flush
91
- assert_match /\d+-\d+-\d+ \d+:\d+:\d+.\d+ T \[\d+:.+\] DebugAsTraceLoggerTest -- hello world -- Calculations -- #{@hash_str}/, @mock_logger.message
91
+ assert_match(/\d+-\d+-\d+ \d+:\d+:\d+.\d+ T \[\d+:.+\] DebugAsTraceLoggerTest -- hello world -- Calculations -- #{@hash_str}/, @mock_logger.message)
92
92
  end
93
93
  end
94
94
  end
@@ -97,7 +97,7 @@ class AppenderFileTest < Minitest::Test
97
97
  SemanticLogger.stub(:appenders, [@appender]) do
98
98
  TestAttribute.logger.send(level, "hello #{level}", @hash)
99
99
  SemanticLogger.flush
100
- assert_match /\d+-\d+-\d+ \d+:\d+:\d+.\d+ \w \[\d+:#{@thread_name} loggable_test.rb:\d+\] TestAttribute -- hello #{level} -- #{@hash_str}/, @mock_logger.message
100
+ assert_match(/\d+-\d+-\d+ \d+:\d+:\d+.\d+ \w \[\d+:#{@thread_name} loggable_test.rb:\d+\] TestAttribute -- hello #{level} -- #{@hash_str}/, @mock_logger.message)
101
101
  end
102
102
  end
103
103
  end
@@ -107,7 +107,7 @@ class AppenderFileTest < Minitest::Test
107
107
  SemanticLogger.stub(:appenders, [@appender]) do
108
108
  TestAttribute.new.logger.send(level, "hello #{level}", @hash)
109
109
  SemanticLogger.flush
110
- assert_match /\d+-\d+-\d+ \d+:\d+:\d+.\d+ \w \[\d+:#{@thread_name} loggable_test.rb:\d+\] TestAttribute -- hello #{level} -- #{@hash_str}/, @mock_logger.message
110
+ assert_match(/\d+-\d+-\d+ \d+:\d+:\d+.\d+ \w \[\d+:#{@thread_name} loggable_test.rb:\d+\] TestAttribute -- hello #{level} -- #{@hash_str}/, @mock_logger.message)
111
111
  end
112
112
  end
113
113
  end