loga 2.8.0 → 2.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/build-and-test.yml +72 -0
  3. data/.github/workflows/publish-gem.yml +28 -0
  4. data/.rubocop.yml +10 -11
  5. data/.rubocop_todo.yml +265 -0
  6. data/Appraisals +83 -22
  7. data/CHANGELOG.md +14 -0
  8. data/Gemfile +24 -0
  9. data/README.md +1 -1
  10. data/gemfiles/rails52.gemfile +23 -1
  11. data/gemfiles/rails60.gemfile +24 -0
  12. data/gemfiles/rails61.gemfile +24 -0
  13. data/gemfiles/rails70.gemfile +27 -0
  14. data/gemfiles/rails71.gemfile +38 -0
  15. data/gemfiles/rails72.gemfile +38 -0
  16. data/gemfiles/rails80.gemfile +38 -0
  17. data/gemfiles/sidekiq51.gemfile +25 -0
  18. data/gemfiles/sidekiq60.gemfile +25 -0
  19. data/gemfiles/sidekiq61.gemfile +25 -0
  20. data/gemfiles/sidekiq62.gemfile +25 -0
  21. data/gemfiles/sidekiq63.gemfile +25 -0
  22. data/gemfiles/sidekiq64.gemfile +25 -0
  23. data/gemfiles/sidekiq65.gemfile +25 -0
  24. data/gemfiles/sidekiq70.gemfile +25 -0
  25. data/gemfiles/sidekiq71.gemfile +25 -0
  26. data/gemfiles/sidekiq72.gemfile +36 -0
  27. data/gemfiles/sidekiq73.gemfile +36 -0
  28. data/gemfiles/sidekiq80.gemfile +36 -0
  29. data/gemfiles/sinatra14.gemfile +25 -0
  30. data/gemfiles/sinatra2.gemfile +36 -0
  31. data/gemfiles/sinatra3.gemfile +36 -0
  32. data/gemfiles/sinatra4.gemfile +36 -0
  33. data/gemfiles/unit.gemfile +24 -0
  34. data/lib/loga/parameter_filter.rb +0 -2
  35. data/lib/loga/rack/request.rb +2 -2
  36. data/lib/loga/rack/request_id.rb +2 -2
  37. data/lib/loga/railtie.rb +3 -3
  38. data/lib/loga/sidekiq.rb +11 -0
  39. data/lib/loga/sidekiq8/job_logger.rb +13 -0
  40. data/lib/loga/tagged_logging.rb +2 -2
  41. data/lib/loga/version.rb +1 -1
  42. data/loga.gemspec +0 -15
  43. data/spec/fixtures/{rails50.rb → rails71.rb} +1 -1
  44. data/spec/fixtures/{rails42.rb → rails72.rb} +3 -3
  45. data/spec/fixtures/rails80.rb +80 -0
  46. data/spec/integration/rails/action_mailer_spec.rb +2 -0
  47. data/spec/integration/rails/railtie_spec.rb +13 -3
  48. data/spec/integration/rails/request_spec.rb +4 -2
  49. data/spec/integration/sidekiq5_spec.rb +15 -13
  50. data/spec/integration/sidekiq60_spec.rb +3 -3
  51. data/spec/integration/sidekiq61_spec.rb +6 -4
  52. data/spec/integration/sidekiq65_spec.rb +1 -1
  53. data/spec/integration/sidekiq8_spec.rb +193 -0
  54. data/spec/integration/sinatra_spec.rb +18 -8
  55. data/spec/loga/sidekiq5/job_logger_spec.rb +2 -0
  56. data/spec/loga/sidekiq6/job_logger_spec.rb +3 -1
  57. data/spec/loga/sidekiq_latest/job_logger_spec.rb +138 -0
  58. data/spec/loga/sidekiq_spec.rb +17 -3
  59. data/spec/spec_helper.rb +14 -5
  60. data/spec/support/gethostname_shared.rb +3 -1
  61. data/spec/support/helpers.rb +10 -0
  62. data/spec/support/request_spec.rb +90 -81
  63. data/spec/support/timecop_shared.rb +3 -1
  64. data/spec/unit/loga/configuration_spec.rb +11 -9
  65. data/spec/unit/loga/event_spec.rb +4 -2
  66. data/spec/unit/loga/formatters/gelf_formatter_spec.rb +22 -14
  67. data/spec/unit/loga/formatters/simple_formatter_spec.rb +27 -10
  68. data/spec/unit/loga/log_subscribers/action_mailer_spec.rb +6 -4
  69. data/spec/unit/loga/parameter_filter_spec.rb +2 -0
  70. data/spec/unit/loga/rack/logger_spec.rb +18 -16
  71. data/spec/unit/loga/rack/request_spec.rb +2 -0
  72. data/spec/unit/loga/service_version_strategies_spec.rb +2 -0
  73. data/spec/unit/loga/utilities_spec.rb +2 -0
  74. data/spec/unit/loga_spec.rb +3 -1
  75. metadata +26 -212
  76. data/.circleci/config.yml +0 -112
  77. data/gemfiles/rails42.gemfile +0 -11
  78. data/gemfiles/rails50.gemfile +0 -11
  79. data/gemfiles/sidekiq7.gemfile +0 -11
  80. data/spec/loga/sidekiq7/job_logger_spec.rb +0 -125
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  RSpec.shared_examples 'request logger' do
2
4
  describe 'get request' do
3
5
  it 'logs the request' do
@@ -6,23 +8,23 @@ RSpec.shared_examples 'request logger' do
6
8
  'HTTP_USER_AGENT' => 'Chrome', 'HTTP_X_REQUEST_ID' => '471a34dc'
7
9
 
8
10
  expect(last_log_entry).to include(
9
- 'version' => '1.1',
10
- 'host' => 'bird.example.com',
11
- 'short_message' => 'GET /ok?username=yoshi 200 in 0ms',
12
- 'timestamp' => 1_450_150_205.123,
13
- 'level' => 6,
14
- '_type' => 'request',
15
- '_service.name' => 'hello_world_app',
16
- '_service.version' => '1.0',
17
- '_request.method' => 'GET',
18
- '_request.path' => '/ok',
19
- '_request.params' => { 'username' => 'yoshi' },
11
+ 'version' => '1.1',
12
+ 'host' => 'bird.example.com',
13
+ 'short_message' => 'GET /ok?username=yoshi 200 in 0ms',
14
+ 'timestamp' => 1_450_150_205.123,
15
+ 'level' => 6,
16
+ '_type' => 'request',
17
+ '_service.name' => 'hello_world_app',
18
+ '_service.version' => '1.0',
19
+ '_request.method' => 'GET',
20
+ '_request.path' => '/ok',
21
+ '_request.params' => { 'username' => 'yoshi' },
20
22
  '_request.request_ip' => '127.0.0.1',
21
23
  '_request.user_agent' => 'Chrome',
22
- '_request.status' => 200,
24
+ '_request.status' => 200,
23
25
  '_request.request_id' => '471a34dc',
24
- '_request.duration' => 0,
25
- '_tags' => '471a34dc TEST_TAG',
26
+ '_request.duration' => 0,
27
+ '_tags' => '471a34dc TEST_TAG',
26
28
  )
27
29
  end
28
30
  end
@@ -36,23 +38,23 @@ RSpec.shared_examples 'request logger' do
36
38
  'HTTP_USER_AGENT' => 'Chrome', 'HTTP_X_REQUEST_ID' => '471a34dc'
37
39
 
38
40
  expect(last_log_entry).to include(
39
- 'version' => '1.1',
40
- 'host' => 'bird.example.com',
41
- 'short_message' => 'POST /users?username=yoshi 200 in 0ms',
42
- 'timestamp' => 1_450_150_205.123,
43
- 'level' => 6,
44
- '_type' => 'request',
45
- '_service.name' => 'hello_world_app',
46
- '_service.version' => '1.0',
47
- '_request.method' => 'POST',
48
- '_request.path' => '/users',
49
- '_request.params' => { 'username' => 'yoshi', 'email' => 'hello@world.com' },
41
+ 'version' => '1.1',
42
+ 'host' => 'bird.example.com',
43
+ 'short_message' => 'POST /users?username=yoshi 200 in 0ms',
44
+ 'timestamp' => 1_450_150_205.123,
45
+ 'level' => 6,
46
+ '_type' => 'request',
47
+ '_service.name' => 'hello_world_app',
48
+ '_service.version' => '1.0',
49
+ '_request.method' => 'POST',
50
+ '_request.path' => '/users',
51
+ '_request.params' => { 'username' => 'yoshi', 'email' => 'hello@world.com' },
50
52
  '_request.request_ip' => '127.0.0.1',
51
53
  '_request.user_agent' => 'Chrome',
52
- '_request.status' => 200,
54
+ '_request.status' => 200,
53
55
  '_request.request_id' => '471a34dc',
54
- '_request.duration' => 0,
55
- '_tags' => '471a34dc TEST_TAG',
56
+ '_request.duration' => 0,
57
+ '_tags' => '471a34dc TEST_TAG',
56
58
  )
57
59
  end
58
60
 
@@ -68,23 +70,23 @@ RSpec.shared_examples 'request logger' do
68
70
  get '/new', {}, 'HTTP_USER_AGENT' => 'Chrome', 'HTTP_X_REQUEST_ID' => '471a34dc'
69
71
 
70
72
  expect(last_log_entry).to include(
71
- 'version' => '1.1',
72
- 'host' => 'bird.example.com',
73
- 'short_message' => 'GET /new 302 in 0ms',
74
- 'timestamp' => 1_450_150_205.123,
75
- 'level' => 6,
76
- '_type' => 'request',
77
- '_service.name' => 'hello_world_app',
78
- '_service.version' => '1.0',
79
- '_request.method' => 'GET',
80
- '_request.path' => '/new',
81
- '_request.params' => {},
73
+ 'version' => '1.1',
74
+ 'host' => 'bird.example.com',
75
+ 'short_message' => 'GET /new 302 in 0ms',
76
+ 'timestamp' => 1_450_150_205.123,
77
+ 'level' => 6,
78
+ '_type' => 'request',
79
+ '_service.name' => 'hello_world_app',
80
+ '_service.version' => '1.0',
81
+ '_request.method' => 'GET',
82
+ '_request.path' => '/new',
83
+ '_request.params' => {},
82
84
  '_request.request_ip' => '127.0.0.1',
83
85
  '_request.user_agent' => 'Chrome',
84
- '_request.status' => 302,
86
+ '_request.status' => 302,
85
87
  '_request.request_id' => '471a34dc',
86
- '_request.duration' => 0,
87
- '_tags' => '471a34dc TEST_TAG',
88
+ '_request.duration' => 0,
89
+ '_tags' => '471a34dc TEST_TAG',
88
90
  )
89
91
  end
90
92
  end
@@ -95,27 +97,34 @@ RSpec.shared_examples 'request logger' do
95
97
  { username: 'yoshi' },
96
98
  'HTTP_USER_AGENT' => 'Chrome', 'HTTP_X_REQUEST_ID' => '471a34dc'
97
99
 
100
+ method_missing_exception =
101
+ if Gem::Version.new(RUBY_VERSION) > Gem::Version.new('3.4.0dev')
102
+ "undefined method 'name' for nil"
103
+ else
104
+ "undefined method `name' for nil"
105
+ end
106
+
98
107
  expect(last_log_entry).to include(
99
- 'version' => '1.1',
100
- 'host' => 'bird.example.com',
101
- 'short_message' => 'GET /error?username=yoshi 500 in 0ms',
102
- 'timestamp' => 1_450_150_205.123,
103
- 'level' => 3,
104
- '_type' => 'request',
105
- '_service.name' => 'hello_world_app',
106
- '_service.version' => '1.0',
107
- '_request.method' => 'GET',
108
- '_request.path' => '/error',
109
- '_request.params' => { 'username' => 'yoshi' },
110
- '_request.request_ip' => '127.0.0.1',
111
- '_request.user_agent' => 'Chrome',
112
- '_request.status' => 500,
113
- '_request.request_id' => '471a34dc',
114
- '_request.duration' => 0,
115
- '_exception.klass' => 'NoMethodError',
116
- '_exception.message' => "undefined method `name' for nil:NilClass",
108
+ 'version' => '1.1',
109
+ 'host' => 'bird.example.com',
110
+ 'short_message' => 'GET /error?username=yoshi 500 in 0ms',
111
+ 'timestamp' => 1_450_150_205.123,
112
+ 'level' => 3,
113
+ '_type' => 'request',
114
+ '_service.name' => 'hello_world_app',
115
+ '_service.version' => '1.0',
116
+ '_request.method' => 'GET',
117
+ '_request.path' => '/error',
118
+ '_request.params' => { 'username' => 'yoshi' },
119
+ '_request.request_ip' => '127.0.0.1',
120
+ '_request.user_agent' => 'Chrome',
121
+ '_request.status' => 500,
122
+ '_request.request_id' => '471a34dc',
123
+ '_request.duration' => 0,
124
+ '_exception.klass' => 'NoMethodError',
125
+ '_exception.message' => start_with(method_missing_exception),
117
126
  '_exception.backtrace' => be_a(String),
118
- '_tags' => '471a34dc TEST_TAG',
127
+ '_tags' => '471a34dc TEST_TAG',
119
128
  )
120
129
  end
121
130
  end
@@ -125,23 +134,23 @@ RSpec.shared_examples 'request logger' do
125
134
  get '/not_found', {}, 'HTTP_X_REQUEST_ID' => '471a34dc'
126
135
 
127
136
  expect(last_log_entry).to include(
128
- 'version' => '1.1',
129
- 'host' => 'bird.example.com',
130
- 'short_message' => 'GET /not_found 404 in 0ms',
131
- 'timestamp' => 1_450_150_205.123,
132
- 'level' => 6,
133
- '_type' => 'request',
134
- '_service.name' => 'hello_world_app',
135
- '_service.version' => '1.0',
136
- '_request.method' => 'GET',
137
- '_request.path' => '/not_found',
138
- '_request.params' => {},
139
- '_request.request_ip' => '127.0.0.1',
140
- '_request.user_agent' => nil,
141
- '_request.status' => 404,
142
- '_request.request_id' => '471a34dc',
143
- '_request.duration' => 0,
144
- '_tags' => '471a34dc TEST_TAG',
137
+ 'version' => '1.1',
138
+ 'host' => 'bird.example.com',
139
+ 'short_message' => 'GET /not_found 404 in 0ms',
140
+ 'timestamp' => 1_450_150_205.123,
141
+ 'level' => 6,
142
+ '_type' => 'request',
143
+ '_service.name' => 'hello_world_app',
144
+ '_service.version' => '1.0',
145
+ '_request.method' => 'GET',
146
+ '_request.path' => '/not_found',
147
+ '_request.params' => {},
148
+ '_request.request_ip' => '127.0.0.1',
149
+ '_request.user_agent' => nil,
150
+ '_request.status' => 404,
151
+ '_request.request_id' => '471a34dc',
152
+ '_request.duration' => 0,
153
+ '_tags' => '471a34dc TEST_TAG',
145
154
  )
146
155
  end
147
156
  end
@@ -188,9 +197,9 @@ RSpec.shared_examples 'request logger' do
188
197
  bob_file: Rack::Test::UploadedFile.new('spec/fixtures/random_bin')
189
198
 
190
199
  expect(last_log_entry).to include(
191
- 'short_message' => 'POST /users?username=yoshi 200 in 0ms',
192
- 'level' => 6,
193
- '_request.params' => {
200
+ 'short_message' => 'POST /users?username=yoshi 200 in 0ms',
201
+ 'level' => 6,
202
+ '_request.params' => {
194
203
  'username' => 'yoshi',
195
204
  'bob_file' => include(
196
205
  'filename' => 'random_bin',
@@ -1,6 +1,8 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'timecop'
2
4
 
3
- shared_context 'timecop', timecop: true do
5
+ shared_context 'timecop', :timecop do
4
6
  # Allows fixed timestamps
5
7
  before(:all) { Timecop.freeze(time_anchor) }
6
8
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Loga::Configuration do
@@ -20,8 +22,8 @@ describe Loga::Configuration do
20
22
  allow(Loga::ServiceVersionStrategies).to receive(:call).and_return('unknown.sha')
21
23
  end
22
24
 
23
- context 'defaults', with_hostname: true do
24
- specify { expect(subject.device).to eq(STDOUT) }
25
+ context 'defaults', :with_hostname do
26
+ specify { expect(subject.device).to eq($stdout) }
25
27
  specify { expect(subject.filter_exceptions).to eq(framework_exceptions) }
26
28
  specify { expect(subject.filter_parameters).to eq([]) }
27
29
  specify { expect(subject.format).to eq(:simple) }
@@ -29,7 +31,7 @@ describe Loga::Configuration do
29
31
  specify { expect(subject.level).to eq(:info) }
30
32
  specify { expect(subject.service_name).to eq('hello_world_app') }
31
33
  specify { expect(subject.service_version).to eq('unknown.sha') }
32
- specify { expect(subject.sync).to eq(true) }
34
+ specify { expect(subject.sync).to be(true) }
33
35
  specify { expect(subject.tags).to eq([]) }
34
36
  end
35
37
 
@@ -174,11 +176,11 @@ describe Loga::Configuration do
174
176
  let(:logdev) { subject.logger.instance_variable_get(:@logdev) }
175
177
 
176
178
  {
177
- debug: 0,
178
- info: 1,
179
- warn: 2,
180
- error: 3,
181
- fatal: 4,
179
+ debug: 0,
180
+ info: 1,
181
+ warn: 2,
182
+ error: 3,
183
+ fatal: 4,
182
184
  unknown: 5,
183
185
  }.each do |sym, level|
184
186
  context "when log level is #{sym}" do
@@ -194,7 +196,7 @@ describe Loga::Configuration do
194
196
  let(:options) { super().merge(sync: false) }
195
197
 
196
198
  it 'uses warn log level' do
197
- expect(logdev.dev.sync).to eq(false)
199
+ expect(logdev.dev.sync).to be(false)
198
200
  end
199
201
  end
200
202
  end
@@ -1,6 +1,8 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
- RSpec.describe Loga::Event, timecop: true do
5
+ RSpec.describe Loga::Event, :timecop do
4
6
  describe 'initialize' do
5
7
  context 'when no message is passed' do
6
8
  it 'sets message to an empty string' do
@@ -9,7 +11,7 @@ RSpec.describe Loga::Event, timecop: true do
9
11
  end
10
12
 
11
13
  context 'when message is passed' do
12
- let(:message) { "stuff \xC2".force_encoding 'ASCII-8BIT' }
14
+ let(:message) { "stuff \xC2".dup.force_encoding 'ASCII-8BIT' }
13
15
  let(:subject) { described_class.new message: message }
14
16
 
15
17
  it 'sanitizes the input to be UTF-8 convertable' do
@@ -1,4 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
4
+ require 'ostruct'
2
5
 
3
6
  describe Loga::Formatters::GELFFormatter do
4
7
  subject { described_class.new(params) }
@@ -8,25 +11,25 @@ describe Loga::Formatters::GELFFormatter do
8
11
  let(:host) { 'www.example.com' }
9
12
  let(:params) do
10
13
  {
11
- service_name: service_name,
14
+ service_name: service_name,
12
15
  service_version: service_version,
13
- host: host,
16
+ host: host,
14
17
  }
15
18
  end
16
19
 
17
20
  shared_examples 'valid GELF message' do
18
21
  it 'includes the required fields' do
19
- expect(json).to include('version' => '1.1',
20
- 'host' => host,
22
+ expect(json).to include('version' => '1.1',
23
+ 'host' => host,
21
24
  'short_message' => be_a(String),
22
- 'timestamp' => be_a(Float),
23
- 'level' => 6)
25
+ 'timestamp' => be_a(Float),
26
+ 'level' => 6)
24
27
  end
25
28
 
26
29
  it 'includes Loga additional fields' do
27
- expect(json).to include('_service.name' => service_name,
30
+ expect(json).to include('_service.name' => service_name,
28
31
  '_service.version' => service_version,
29
- '_tags' => '')
32
+ '_tags' => '')
30
33
  end
31
34
 
32
35
  it 'outputs the timestamp in seconds since UNIX epoch' do
@@ -63,7 +66,12 @@ describe Loga::Formatters::GELFFormatter do
63
66
  let(:message) { { message: 'Wooden house' } }
64
67
 
65
68
  it 'the short_message is a String reprentation of that Hash' do
66
- expect(json['short_message']).to eq('{:message=>"Wooden house"}')
69
+ expect(json['short_message']).to eq(
70
+ with_new_ruby(
71
+ test: '{message: "Wooden house"}',
72
+ else: '{:message=>"Wooden house"}',
73
+ ),
74
+ )
67
75
  end
68
76
 
69
77
  include_examples 'valid GELF message'
@@ -233,11 +241,11 @@ describe Loga::Formatters::GELFFormatter do
233
241
  end
234
242
 
235
243
  {
236
- 'DEBUG' => 7,
237
- 'INFO' => 6,
238
- 'WARN' => 4,
239
- 'ERROR' => 3,
240
- 'FATAL' => 2,
244
+ 'DEBUG' => 7,
245
+ 'INFO' => 6,
246
+ 'WARN' => 4,
247
+ 'ERROR' => 3,
248
+ 'FATAL' => 2,
241
249
  'UNKNOWN' => 1,
242
250
  }.each do |ruby_severity, syslog_level|
243
251
  context "with severity #{ruby_severity}" do
@@ -1,7 +1,9 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
  require 'loga/formatters/simple_formatter'
3
5
 
4
- # rubocop:disable Metrics/LineLength
6
+ # rubocop:disable Layout/LineLength
5
7
  describe Loga::Formatters::SimpleFormatter do
6
8
  before { allow(Process).to receive(:pid).and_return(999) }
7
9
 
@@ -30,7 +32,12 @@ describe Loga::Formatters::SimpleFormatter do
30
32
  let(:message) { { record: 'Wooden house' } }
31
33
 
32
34
  specify do
33
- expect(subject).to eq("I, #{time_pid} {:record=>\"Wooden house\"}\n")
35
+ expect(subject).to eq(
36
+ with_new_ruby(
37
+ test: "I, #{time_pid} {record: \"Wooden house\"}\n",
38
+ else: "I, #{time_pid} {:record=>\"Wooden house\"}\n",
39
+ ),
40
+ )
34
41
  end
35
42
  end
36
43
 
@@ -78,7 +85,12 @@ describe Loga::Formatters::SimpleFormatter do
78
85
  end
79
86
 
80
87
  specify do
81
- expect(subject).to eq("I, #{time_pid} Hello World data={:admin=>true, :user=>{:email=>\"hello@world.com\"}}\n")
88
+ expect(subject).to eq(
89
+ with_new_ruby(
90
+ test: "I, #{time_pid} Hello World data={admin: true, user: {email: \"hello@world.com\"}}\n",
91
+ else: "I, #{time_pid} Hello World data={:admin=>true, :user=>{:email=>\"hello@world.com\"}}\n",
92
+ ),
93
+ )
82
94
  end
83
95
  end
84
96
 
@@ -92,7 +104,12 @@ describe Loga::Formatters::SimpleFormatter do
92
104
  end
93
105
 
94
106
  specify do
95
- expect(subject).to eq("I, #{time_pid} Hello World type=request data={:ssl=>true}\n")
107
+ expect(subject).to eq(
108
+ with_new_ruby(
109
+ test: "I, #{time_pid} Hello World type=request data={ssl: true}\n",
110
+ else: "I, #{time_pid} Hello World type=request data={:ssl=>true}\n",
111
+ ),
112
+ )
96
113
  end
97
114
  end
98
115
  end
@@ -112,11 +129,11 @@ describe Loga::Formatters::SimpleFormatter do
112
129
  end
113
130
 
114
131
  {
115
- 'DEBUG' => 'D',
116
- 'INFO' => 'I',
117
- 'WARN' => 'W',
118
- 'ERROR' => 'E',
119
- 'FATAL' => 'F',
132
+ 'DEBUG' => 'D',
133
+ 'INFO' => 'I',
134
+ 'WARN' => 'W',
135
+ 'ERROR' => 'E',
136
+ 'FATAL' => 'F',
120
137
  'UNKNOWN' => 'U',
121
138
  }.each do |ruby_severity, formatted_severity|
122
139
  context "with severity #{ruby_severity}" do
@@ -127,4 +144,4 @@ describe Loga::Formatters::SimpleFormatter do
127
144
  end
128
145
  end
129
146
  end
130
- # rubocop:enable Metrics/LineLength
147
+ # rubocop:enable Layout/LineLength
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
  require 'active_support'
3
5
  require 'loga/log_subscribers/action_mailer'
@@ -9,7 +11,7 @@ RSpec.describe Loga::LogSubscribers::ActionMailer do
9
11
 
10
12
  let(:event) do
11
13
  instance_double(
12
- 'ActiveSupport::Notifications::Event',
14
+ ActiveSupport::Notifications::Event,
13
15
  payload: payload,
14
16
  duration: 0.0001,
15
17
  time: Time.now,
@@ -21,7 +23,7 @@ RSpec.describe Loga::LogSubscribers::ActionMailer do
21
23
  let(:payload) do
22
24
  {
23
25
  mailer: 'FakeMailer',
24
- to: ['user@example.com'],
26
+ to: ['user@example.com'],
25
27
  }
26
28
  end
27
29
  let(:config) { instance_double Loga::Configuration, hide_pii: hide_pii }
@@ -82,8 +84,8 @@ RSpec.describe Loga::LogSubscribers::ActionMailer do
82
84
  context 'when an email is sent' do
83
85
  let(:payload) do
84
86
  {
85
- mailer: 'FakeMailer',
86
- from: 'loremipsum@example.com',
87
+ mailer: 'FakeMailer',
88
+ from: 'loremipsum@example.com',
87
89
  subject: 'Lorem ipsum',
88
90
  }
89
91
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  RSpec.describe Loga::ParameterFilter do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
  require 'rack/test'
3
5
 
@@ -40,22 +42,22 @@ describe Loga::Rack::Logger do
40
42
  middleware.call(env, started_at)
41
43
 
42
44
  expect(Loga::Event).to have_received(:new).with(
43
- data: {
45
+ data: {
44
46
  request: {
45
- 'status' => response_status,
46
- 'method' => 'GET',
47
- 'path' => '/about_us',
48
- 'params' => { 'limit' => '1' },
47
+ 'status' => response_status,
48
+ 'method' => 'GET',
49
+ 'path' => '/about_us',
50
+ 'params' => { 'limit' => '1' },
49
51
  'request_id' => nil,
50
52
  'request_ip' => nil,
51
53
  'user_agent' => nil,
52
- 'duration' => 500,
54
+ 'duration' => 500,
53
55
  },
54
56
  },
55
57
  exception: logged_exception,
56
- message: %r{^GET \/about_us\?limit=1 #{response_status} in \d+ms$},
58
+ message: %r{^GET /about_us\?limit=1 #{response_status} in \d+ms$},
57
59
  timestamp: started_at,
58
- type: 'request',
60
+ type: 'request',
59
61
  )
60
62
  end
61
63
 
@@ -82,22 +84,22 @@ describe Loga::Rack::Logger do
82
84
  expect { middleware.call(env, started_at) }.to raise_error(exception_class)
83
85
 
84
86
  expect(Loga::Event).to have_received(:new).with(
85
- data: {
87
+ data: {
86
88
  request: {
87
- 'status' => response_status,
88
- 'method' => 'GET',
89
- 'path' => '/about_us',
90
- 'params' => { 'limit' => '1' },
89
+ 'status' => response_status,
90
+ 'method' => 'GET',
91
+ 'path' => '/about_us',
92
+ 'params' => { 'limit' => '1' },
91
93
  'request_id' => nil,
92
94
  'request_ip' => nil,
93
95
  'user_agent' => nil,
94
- 'duration' => 500,
96
+ 'duration' => 500,
95
97
  },
96
98
  },
97
99
  exception: logged_exception,
98
- message: %r{^GET \/about_us\?limit=1 #{response_status} in \d+ms$},
100
+ message: %r{^GET /about_us\?limit=1 #{response_status} in \d+ms$},
99
101
  timestamp: started_at,
100
- type: 'request',
102
+ type: 'request',
101
103
  )
102
104
  end
103
105
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Loga::Rack::Request do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  RSpec.describe Loga::ServiceVersionStrategies do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Loga::Utilities do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Loga do
@@ -64,7 +66,7 @@ describe Loga do
64
66
  context 'when Loga is configured' do
65
67
  before { subject.configure(options) }
66
68
 
67
- specify { expect(subject.logger).to be_kind_of(Logger) }
69
+ specify { expect(subject.logger).to be_a(Logger) }
68
70
  end
69
71
  end
70
72