lamian 1.9.0 → 1.11.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 881a6090b7433a7073865fad6fbf0717e1d756f654d0be3d41d4c239d396cd81
4
- data.tar.gz: 262e942fb2c73fbb80d42882d0fa9d8502df4067613ba5530f998659efe687b1
3
+ metadata.gz: 8cbf9f277d6cc58672d1b5485e487706f3012248baf8b1fb4b2d5a41a2aad9a8
4
+ data.tar.gz: 24e5b5983e7b12b2f1a5c735a49a30df3d0498b59ef666f4da4c527f1a0fcf65
5
5
  SHA512:
6
- metadata.gz: '040108c81012fb27273d2a185b7cc7c2ed4563d4881908c4c50a8c54ce160f04c97a00043a9f2f3b96c0bcf63105d7a88c3bef6b94caa2970557b1e3a0f9cf51'
7
- data.tar.gz: 6cecfa1411d0891061161577d8f60dd8052a8a6e25224c0b50f8202ba2635c6cf88aae437b4718653a257c58e9441f162c90a470c55df6f1ca8adb657467e404
6
+ metadata.gz: 93ef8987fe9b89fff2af5d165821f8d2b1b86196be58c7a5bb399af76a82c478e2e6c48bd2fc7aadd348f8c38bba07d7b504658365475cb4503b70f49b68466c
7
+ data.tar.gz: 19d94ade4699a4a2d762ebb6d09a05b9d5cd081b3d8f23a88af6f9823bb7f94508d137737edd9ebb13f8be02d6b148b3b2a47a815c8e4e3f6b42270e5a5ae856
@@ -24,8 +24,6 @@ jobs:
24
24
  run: bundle exec ci-helper CheckSpecSuffixes --extra-paths spec/*.rb --ignored-paths spec/*_helper.rb
25
25
  - name: Run specs
26
26
  run: bundle exec ci-helper RunSpecs
27
- - name: Audit
28
- run: bundle exec ci-helper BundlerAudit
29
27
  - name: Documentation coverage
30
28
  run: bundle exec rake doc:coverage
31
29
  - name: Coveralls
@@ -44,7 +42,7 @@ jobs:
44
42
  strategy:
45
43
  fail-fast: false
46
44
  matrix:
47
- ruby: ["3.0", "3.1", "3.2"]
45
+ ruby: ["3.1", "3.2", "3.3"]
48
46
 
49
47
  steps:
50
48
  - uses: actions/checkout@v2
data/.rubocop.yml CHANGED
@@ -3,7 +3,7 @@ inherit_gem:
3
3
 
4
4
  AllCops:
5
5
  DisplayCopNames: true
6
- TargetRubyVersion: 2.7
6
+ TargetRubyVersion: 3.1
7
7
  SuggestExtensions: false
8
8
 
9
9
  RSpec/EmptyLineAfterHook:
data/Gemfile CHANGED
@@ -5,7 +5,6 @@ source "https://rubygems.org"
5
5
  # Specify your gem's dependencies in lamian.gemspec
6
6
  gemspec
7
7
 
8
- gem "bundler-audit"
9
8
  gem "ci-helper"
10
9
  gem "launchy"
11
10
  gem "pry"
data/Gemfile.lock CHANGED
@@ -1,129 +1,128 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- lamian (1.9.0)
4
+ lamian (1.11.0)
5
5
  rails (>= 4.2)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- actioncable (7.1.3.4)
11
- actionpack (= 7.1.3.4)
12
- activesupport (= 7.1.3.4)
10
+ actioncable (7.2.2.1)
11
+ actionpack (= 7.2.2.1)
12
+ activesupport (= 7.2.2.1)
13
13
  nio4r (~> 2.0)
14
14
  websocket-driver (>= 0.6.1)
15
15
  zeitwerk (~> 2.6)
16
- actionmailbox (7.1.3.4)
17
- actionpack (= 7.1.3.4)
18
- activejob (= 7.1.3.4)
19
- activerecord (= 7.1.3.4)
20
- activestorage (= 7.1.3.4)
21
- activesupport (= 7.1.3.4)
22
- mail (>= 2.7.1)
23
- net-imap
24
- net-pop
25
- net-smtp
26
- actionmailer (7.1.3.4)
27
- actionpack (= 7.1.3.4)
28
- actionview (= 7.1.3.4)
29
- activejob (= 7.1.3.4)
30
- activesupport (= 7.1.3.4)
31
- mail (~> 2.5, >= 2.5.4)
32
- net-imap
33
- net-pop
34
- net-smtp
16
+ actionmailbox (7.2.2.1)
17
+ actionpack (= 7.2.2.1)
18
+ activejob (= 7.2.2.1)
19
+ activerecord (= 7.2.2.1)
20
+ activestorage (= 7.2.2.1)
21
+ activesupport (= 7.2.2.1)
22
+ mail (>= 2.8.0)
23
+ actionmailer (7.2.2.1)
24
+ actionpack (= 7.2.2.1)
25
+ actionview (= 7.2.2.1)
26
+ activejob (= 7.2.2.1)
27
+ activesupport (= 7.2.2.1)
28
+ mail (>= 2.8.0)
35
29
  rails-dom-testing (~> 2.2)
36
- actionpack (7.1.3.4)
37
- actionview (= 7.1.3.4)
38
- activesupport (= 7.1.3.4)
30
+ actionpack (7.2.2.1)
31
+ actionview (= 7.2.2.1)
32
+ activesupport (= 7.2.2.1)
39
33
  nokogiri (>= 1.8.5)
40
34
  racc
41
- rack (>= 2.2.4)
35
+ rack (>= 2.2.4, < 3.2)
42
36
  rack-session (>= 1.0.1)
43
37
  rack-test (>= 0.6.3)
44
38
  rails-dom-testing (~> 2.2)
45
39
  rails-html-sanitizer (~> 1.6)
46
- actiontext (7.1.3.4)
47
- actionpack (= 7.1.3.4)
48
- activerecord (= 7.1.3.4)
49
- activestorage (= 7.1.3.4)
50
- activesupport (= 7.1.3.4)
40
+ useragent (~> 0.16)
41
+ actiontext (7.2.2.1)
42
+ actionpack (= 7.2.2.1)
43
+ activerecord (= 7.2.2.1)
44
+ activestorage (= 7.2.2.1)
45
+ activesupport (= 7.2.2.1)
51
46
  globalid (>= 0.6.0)
52
47
  nokogiri (>= 1.8.5)
53
- actionview (7.1.3.4)
54
- activesupport (= 7.1.3.4)
48
+ actionview (7.2.2.1)
49
+ activesupport (= 7.2.2.1)
55
50
  builder (~> 3.1)
56
51
  erubi (~> 1.11)
57
52
  rails-dom-testing (~> 2.2)
58
53
  rails-html-sanitizer (~> 1.6)
59
- activejob (7.1.3.4)
60
- activesupport (= 7.1.3.4)
54
+ activejob (7.2.2.1)
55
+ activesupport (= 7.2.2.1)
61
56
  globalid (>= 0.3.6)
62
- activemodel (7.1.3.4)
63
- activesupport (= 7.1.3.4)
64
- activerecord (7.1.3.4)
65
- activemodel (= 7.1.3.4)
66
- activesupport (= 7.1.3.4)
57
+ activemodel (7.2.2.1)
58
+ activesupport (= 7.2.2.1)
59
+ activerecord (7.2.2.1)
60
+ activemodel (= 7.2.2.1)
61
+ activesupport (= 7.2.2.1)
67
62
  timeout (>= 0.4.0)
68
- activestorage (7.1.3.4)
69
- actionpack (= 7.1.3.4)
70
- activejob (= 7.1.3.4)
71
- activerecord (= 7.1.3.4)
72
- activesupport (= 7.1.3.4)
63
+ activestorage (7.2.2.1)
64
+ actionpack (= 7.2.2.1)
65
+ activejob (= 7.2.2.1)
66
+ activerecord (= 7.2.2.1)
67
+ activesupport (= 7.2.2.1)
73
68
  marcel (~> 1.0)
74
- activesupport (7.1.3.4)
69
+ activesupport (7.2.2.1)
75
70
  base64
71
+ benchmark (>= 0.3)
76
72
  bigdecimal
77
- concurrent-ruby (~> 1.0, >= 1.0.2)
73
+ concurrent-ruby (~> 1.0, >= 1.3.1)
78
74
  connection_pool (>= 2.2.5)
79
75
  drb
80
76
  i18n (>= 1.6, < 2)
77
+ logger (>= 1.4.2)
81
78
  minitest (>= 5.1)
82
- mutex_m
83
- tzinfo (~> 2.0)
79
+ securerandom (>= 0.3)
80
+ tzinfo (~> 2.0, >= 2.0.5)
84
81
  addressable (2.8.7)
85
82
  public_suffix (>= 2.0.2, < 7.0)
86
83
  ast (2.4.2)
87
84
  base64 (0.2.0)
85
+ benchmark (0.4.0)
88
86
  bigdecimal (3.1.8)
89
87
  builder (3.3.0)
90
- bundler-audit (0.9.1)
91
- bundler (>= 1.2.0, < 3)
92
- thor (~> 1.0)
93
- childprocess (5.0.0)
94
- ci-helper (0.6.0)
88
+ childprocess (5.1.0)
89
+ logger (~> 1.5)
90
+ ci-helper (0.7.0)
95
91
  colorize (~> 1.1)
96
92
  dry-inflector (~> 1.0)
97
93
  umbrellio-sequel-plugins (~> 0.14)
98
94
  coderay (1.1.3)
99
95
  colorize (1.1.0)
100
- concurrent-ruby (1.3.3)
96
+ concurrent-ruby (1.3.4)
101
97
  connection_pool (2.4.1)
102
98
  crass (1.0.6)
103
- date (3.3.4)
99
+ date (3.4.1)
104
100
  diff-lcs (1.5.1)
105
- docile (1.4.0)
101
+ docile (1.4.1)
106
102
  drb (2.2.1)
107
- dry-inflector (1.0.0)
103
+ dry-inflector (1.1.0)
108
104
  erubi (1.13.0)
109
- faraday (2.9.2)
110
- faraday-net_http (>= 2.0, < 3.2)
111
- faraday-net_http (3.1.0)
112
- net-http
105
+ faraday (2.12.2)
106
+ faraday-net_http (>= 2.0, < 3.5)
107
+ json
108
+ logger
109
+ faraday-net_http (3.4.0)
110
+ net-http (>= 0.5.0)
113
111
  globalid (1.2.1)
114
112
  activesupport (>= 6.1)
115
- i18n (1.14.5)
113
+ i18n (1.14.6)
116
114
  concurrent-ruby (~> 1.0)
117
- io-console (0.7.2)
118
- irb (1.13.2)
115
+ io-console (0.8.0)
116
+ irb (1.14.1)
119
117
  rdoc (>= 4.0.0)
120
118
  reline (>= 0.4.2)
121
- json (2.7.2)
119
+ json (2.9.0)
122
120
  language_server-protocol (3.17.0.3)
123
121
  launchy (3.0.1)
124
122
  addressable (~> 2.8)
125
123
  childprocess (~> 5.0)
126
- loofah (2.22.0)
124
+ logger (1.6.2)
125
+ loofah (2.23.1)
127
126
  crass (~> 1.0.2)
128
127
  nokogiri (>= 1.12.0)
129
128
  mail (2.8.1)
@@ -134,12 +133,11 @@ GEM
134
133
  marcel (1.0.4)
135
134
  method_source (1.1.0)
136
135
  mini_mime (1.1.5)
137
- mini_portile2 (2.8.7)
138
- minitest (5.24.0)
139
- mutex_m (0.2.0)
140
- net-http (0.4.1)
136
+ mini_portile2 (2.8.8)
137
+ minitest (5.25.4)
138
+ net-http (0.6.0)
141
139
  uri
142
- net-imap (0.4.14)
140
+ net-imap (0.5.1)
143
141
  date
144
142
  net-protocol
145
143
  net-pop (0.1.2)
@@ -148,162 +146,151 @@ GEM
148
146
  timeout
149
147
  net-smtp (0.5.0)
150
148
  net-protocol
151
- nio4r (2.7.3)
152
- nokogiri (1.16.6)
149
+ nio4r (2.7.4)
150
+ nokogiri (1.17.1)
153
151
  mini_portile2 (~> 2.8.2)
154
152
  racc (~> 1.4)
155
- nokogiri (1.16.6-x86_64-darwin)
153
+ nokogiri (1.17.1-x86_64-darwin)
156
154
  racc (~> 1.4)
157
- nokogiri (1.16.6-x86_64-linux)
155
+ nokogiri (1.17.1-x86_64-linux)
158
156
  racc (~> 1.4)
159
- parallel (1.25.1)
160
- parser (3.3.3.0)
157
+ parallel (1.26.3)
158
+ parser (3.3.6.0)
161
159
  ast (~> 2.4.1)
162
160
  racc
163
- pry (0.14.2)
161
+ pry (0.15.0)
164
162
  coderay (~> 1.1)
165
163
  method_source (~> 1.0)
166
- psych (5.1.2)
164
+ psych (5.2.1)
165
+ date
167
166
  stringio
168
- public_suffix (6.0.0)
169
- racc (1.8.0)
170
- rack (3.1.4)
167
+ public_suffix (6.0.1)
168
+ racc (1.8.1)
169
+ rack (3.1.8)
171
170
  rack-session (2.0.0)
172
171
  rack (>= 3.0.0)
173
172
  rack-test (2.1.0)
174
173
  rack (>= 1.3)
175
- rackup (2.1.0)
174
+ rackup (2.2.1)
176
175
  rack (>= 3)
177
- webrick (~> 1.8)
178
- rails (7.1.3.4)
179
- actioncable (= 7.1.3.4)
180
- actionmailbox (= 7.1.3.4)
181
- actionmailer (= 7.1.3.4)
182
- actionpack (= 7.1.3.4)
183
- actiontext (= 7.1.3.4)
184
- actionview (= 7.1.3.4)
185
- activejob (= 7.1.3.4)
186
- activemodel (= 7.1.3.4)
187
- activerecord (= 7.1.3.4)
188
- activestorage (= 7.1.3.4)
189
- activesupport (= 7.1.3.4)
176
+ rails (7.2.2.1)
177
+ actioncable (= 7.2.2.1)
178
+ actionmailbox (= 7.2.2.1)
179
+ actionmailer (= 7.2.2.1)
180
+ actionpack (= 7.2.2.1)
181
+ actiontext (= 7.2.2.1)
182
+ actionview (= 7.2.2.1)
183
+ activejob (= 7.2.2.1)
184
+ activemodel (= 7.2.2.1)
185
+ activerecord (= 7.2.2.1)
186
+ activestorage (= 7.2.2.1)
187
+ activesupport (= 7.2.2.1)
190
188
  bundler (>= 1.15.0)
191
- railties (= 7.1.3.4)
189
+ railties (= 7.2.2.1)
192
190
  rails-dom-testing (2.2.0)
193
191
  activesupport (>= 5.0.0)
194
192
  minitest
195
193
  nokogiri (>= 1.6)
196
- rails-html-sanitizer (1.6.0)
194
+ rails-html-sanitizer (1.6.1)
197
195
  loofah (~> 2.21)
198
- nokogiri (~> 1.14)
199
- railties (7.1.3.4)
200
- actionpack (= 7.1.3.4)
201
- activesupport (= 7.1.3.4)
202
- irb
196
+ nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
197
+ railties (7.2.2.1)
198
+ actionpack (= 7.2.2.1)
199
+ activesupport (= 7.2.2.1)
200
+ irb (~> 1.13)
203
201
  rackup (>= 1.0.0)
204
202
  rake (>= 12.2)
205
203
  thor (~> 1.0, >= 1.2.2)
206
204
  zeitwerk (~> 2.6)
207
205
  rainbow (3.1.1)
208
206
  rake (13.2.1)
209
- rdoc (6.7.0)
207
+ rdoc (6.8.1)
210
208
  psych (>= 4.0.0)
211
- regexp_parser (2.9.2)
212
- reline (0.5.9)
209
+ regexp_parser (2.9.3)
210
+ reline (0.5.12)
213
211
  io-console (~> 0.5)
214
- rexml (3.3.1)
215
- strscan
216
212
  rspec (3.13.0)
217
213
  rspec-core (~> 3.13.0)
218
214
  rspec-expectations (~> 3.13.0)
219
215
  rspec-mocks (~> 3.13.0)
220
- rspec-core (3.13.0)
216
+ rspec-core (3.13.2)
221
217
  rspec-support (~> 3.13.0)
222
- rspec-expectations (3.13.1)
218
+ rspec-expectations (3.13.3)
223
219
  diff-lcs (>= 1.2.0, < 2.0)
224
220
  rspec-support (~> 3.13.0)
225
- rspec-mocks (3.13.1)
221
+ rspec-mocks (3.13.2)
226
222
  diff-lcs (>= 1.2.0, < 2.0)
227
223
  rspec-support (~> 3.13.0)
228
- rspec-support (3.13.1)
229
- rubocop (1.63.5)
224
+ rspec-support (3.13.2)
225
+ rubocop (1.66.1)
230
226
  json (~> 2.3)
231
227
  language_server-protocol (>= 3.17.0)
232
228
  parallel (~> 1.10)
233
229
  parser (>= 3.3.0.2)
234
230
  rainbow (>= 2.2.2, < 4.0)
235
- regexp_parser (>= 1.8, < 3.0)
236
- rexml (>= 3.2.5, < 4.0)
237
- rubocop-ast (>= 1.31.1, < 2.0)
231
+ regexp_parser (>= 2.4, < 3.0)
232
+ rubocop-ast (>= 1.32.2, < 2.0)
238
233
  ruby-progressbar (~> 1.7)
239
234
  unicode-display_width (>= 2.4.0, < 3.0)
240
- rubocop-ast (1.31.3)
235
+ rubocop-ast (1.36.2)
241
236
  parser (>= 3.3.1.0)
242
- rubocop-capybara (2.21.0)
243
- rubocop (~> 1.41)
244
- rubocop-config-umbrellio (1.63.0.93)
245
- rubocop (~> 1.63.0)
246
- rubocop-performance (~> 1.21.0)
247
- rubocop-rails (~> 2.24.0)
237
+ rubocop-config-umbrellio (1.66.0.99)
238
+ rubocop (~> 1.66.0)
239
+ rubocop-factory_bot (~> 2.26.0)
240
+ rubocop-performance (~> 1.22.0)
241
+ rubocop-rails (~> 2.26.0)
248
242
  rubocop-rake (~> 0.6.0)
249
- rubocop-rspec (~> 2.29.0)
243
+ rubocop-rspec (~> 3.0.0)
250
244
  rubocop-sequel (~> 0.3.3)
251
245
  rubocop-factory_bot (2.26.1)
252
246
  rubocop (~> 1.61)
253
- rubocop-performance (1.21.1)
247
+ rubocop-performance (1.22.1)
254
248
  rubocop (>= 1.48.1, < 2.0)
255
249
  rubocop-ast (>= 1.31.1, < 2.0)
256
- rubocop-rails (2.24.1)
250
+ rubocop-rails (2.26.2)
257
251
  activesupport (>= 4.2.0)
258
252
  rack (>= 1.1)
259
- rubocop (>= 1.33.0, < 2.0)
253
+ rubocop (>= 1.52.0, < 2.0)
260
254
  rubocop-ast (>= 1.31.1, < 2.0)
261
255
  rubocop-rake (0.6.0)
262
256
  rubocop (~> 1.0)
263
- rubocop-rspec (2.29.2)
264
- rubocop (~> 1.40)
265
- rubocop-capybara (~> 2.17)
266
- rubocop-factory_bot (~> 2.22)
267
- rubocop-rspec_rails (~> 2.28)
268
- rubocop-rspec_rails (2.29.1)
257
+ rubocop-rspec (3.0.5)
269
258
  rubocop (~> 1.61)
270
- rubocop-sequel (0.3.4)
259
+ rubocop-sequel (0.3.7)
271
260
  rubocop (~> 1.0)
272
261
  ruby-progressbar (1.13.0)
273
- semantic_logger (4.15.0)
262
+ securerandom (0.4.0)
263
+ semantic_logger (4.16.1)
274
264
  concurrent-ruby (~> 1.0)
275
265
  sentry-raven (3.1.2)
276
266
  faraday (>= 1.0)
277
- sentry-ruby (5.18.0)
267
+ sentry-ruby (5.22.0)
278
268
  bigdecimal
279
269
  concurrent-ruby (~> 1.0, >= 1.0.2)
280
- sequel (5.81.0)
270
+ sequel (5.87.0)
281
271
  bigdecimal
282
272
  simplecov (0.22.0)
283
273
  docile (~> 1.1)
284
274
  simplecov-html (~> 0.11)
285
275
  simplecov_json_formatter (~> 0.1)
286
- simplecov-html (0.12.3)
276
+ simplecov-html (0.13.1)
287
277
  simplecov-lcov (0.8.0)
288
278
  simplecov_json_formatter (0.1.4)
289
- stringio (3.1.1)
290
- strscan (3.1.0)
291
- symbiont-ruby (0.7.0)
292
- thor (1.3.1)
293
- timeout (0.4.1)
279
+ stringio (3.1.2)
280
+ thor (1.3.2)
281
+ timeout (0.4.2)
294
282
  tzinfo (2.0.6)
295
283
  concurrent-ruby (~> 1.0)
296
- umbrellio-sequel-plugins (0.15.0.198)
284
+ umbrellio-sequel-plugins (0.17.0)
297
285
  sequel
298
- symbiont-ruby
299
- unicode-display_width (2.5.0)
300
- uri (0.13.0)
301
- webrick (1.8.1)
286
+ unicode-display_width (2.6.0)
287
+ uri (1.0.2)
288
+ useragent (0.16.11)
302
289
  websocket-driver (0.7.6)
303
290
  websocket-extensions (>= 0.1.0)
304
291
  websocket-extensions (0.1.5)
305
- yard (0.9.36)
306
- zeitwerk (2.6.16)
292
+ yard (0.9.37)
293
+ zeitwerk (2.6.18)
307
294
 
308
295
  PLATFORMS
309
296
  ruby
@@ -312,7 +299,6 @@ PLATFORMS
312
299
  x86_64-linux
313
300
 
314
301
  DEPENDENCIES
315
- bundler-audit
316
302
  ci-helper
317
303
  lamian!
318
304
  launchy
data/README.md CHANGED
@@ -29,6 +29,19 @@ It automatically redefines `Sentry.configuration.before_send` callback
29
29
  if Sentry initialization is completed. If `before_send` is already defined
30
30
  it wraps custom callback.
31
31
 
32
+ If you work with rails the `Lamian::Engine` will be automatically initialized, that additionally
33
+ adds `Lamian::Middleware` in the first position in your Rails Application middleware stack.
34
+
35
+ If you need to manually configure the middleware stack use `Lamian.config.middleware_autoset=false.
36
+
37
+ ```ruby
38
+ Lamian.configure do |config|
39
+ config.middleware_autoset = false
40
+ end
41
+
42
+ Rails.configuration.middleware.use_after(YourSignificantMiddlewareInStack, Lamian::Middleware)
43
+ ```
44
+
32
45
  ### Usage with Sidekiq
33
46
 
34
47
  You should add Lamian middleware to the Sidekiq initializer like this:
data/lib/lamian/config.rb CHANGED
@@ -8,11 +8,21 @@ module Lamian
8
8
  # max number of most recent log lines to store, defaults to 5000
9
9
  # @attr raven_log_size_limit [Integer]
10
10
  # size limit when sending lamian log to sentry, defaults to +500_000+
11
- Config = Struct.new(:formatter, :max_log_lines, :raven_log_size_limit) do
11
+ # @attr middleware_autoset [BOolean]
12
+ # automatically setup a middleware module during rails initialization process
13
+ Config = Struct.new(
14
+ :formatter,
15
+ :max_log_lines,
16
+ :max_log_length,
17
+ :raven_log_size_limit,
18
+ :middleware_autoset,
19
+ ) do
12
20
  def initialize
13
21
  self.formatter = ::Logger::Formatter.new
14
22
  self.max_log_lines = 5000
23
+ self.max_log_length = 10_000
15
24
  self.raven_log_size_limit = 500_000
25
+ self.middleware_autoset = true
16
26
  end
17
27
  end
18
28
  end
data/lib/lamian/engine.rb CHANGED
@@ -11,7 +11,9 @@ module Lamian
11
11
 
12
12
  initializer "lamian.use_rack_middleware" do |app|
13
13
  # :nocov:
14
- app.config.middleware.unshift(Lamian::Middleware)
14
+ if Lamian.config.middleware_autoset
15
+ app.config.middleware.unshift(Lamian::Middleware)
16
+ end
15
17
  # :nocov:
16
18
  end
17
19
 
@@ -2,14 +2,16 @@
2
2
 
3
3
  module Lamian
4
4
  class LogDevice # :nodoc:
5
- def initialize(size = Lamian.config.max_log_lines)
6
- self.size = size
5
+ def initialize(max_log_lines: Lamian.config.max_log_lines,
6
+ max_log_length: Lamian.config.max_log_length)
7
+ self.max_log_lines = max_log_lines
8
+ self.max_log_length = max_log_length
7
9
  self.lines = []
8
10
  end
9
11
 
10
- def write(string) # :nodoc:
11
- lines << string
12
- lines.shift if lines.size > size
12
+ def write(msg) # :nodoc:
13
+ lines << truncate(msg)
14
+ lines.shift if lines.size > max_log_lines
13
15
  true
14
16
  end
15
17
 
@@ -19,6 +21,16 @@ module Lamian
19
21
 
20
22
  private
21
23
 
22
- attr_accessor :size, :lines
24
+ attr_accessor :lines, :max_log_lines, :max_log_length
25
+
26
+ def truncate(msg) # :nodoc:
27
+ return msg unless msg.size > max_log_length
28
+
29
+ suffix = +"..."
30
+ suffix << "\n" if msg.end_with?("\n")
31
+ msg = msg[0, max_log_length - suffix.size]
32
+
33
+ "#{msg}#{suffix}"
34
+ end
23
35
  end
24
36
  end
data/lib/lamian/logger.rb CHANGED
@@ -31,7 +31,7 @@ module Lamian
31
31
 
32
32
  # Part of Logger api, entry point for all logs
33
33
  # extened to run on each log device in stack
34
- def add(*args, &block)
34
+ def add(*args, &)
35
35
  @formatter = Lamian.config.formatter
36
36
 
37
37
  logdevs.each do |logdev|
@@ -13,5 +13,5 @@ module Lamian
13
13
  # According to this, it is enough to specify '~> a.b'
14
14
  # if private API was not used and to specify '~> a.b.c' if it was
15
15
 
16
- VERSION = "1.9.0"
16
+ VERSION = "1.11.0"
17
17
  end
data/lib/lamian.rb CHANGED
@@ -52,8 +52,8 @@ module Lamian
52
52
  end
53
53
 
54
54
  # Collects logs sent inside block
55
- def run(&block)
56
- logger.run(&block)
55
+ def run(&)
56
+ logger.run(&)
57
57
  end
58
58
 
59
59
  # Dumps log collected in this run
@@ -63,7 +63,7 @@ module Lamian
63
63
  # value given (for now)
64
64
  # @return formatted log (String by default)
65
65
  def dump(format: nil)
66
- logger.dump(format: format)
66
+ logger.dump(format:)
67
67
  end
68
68
 
69
69
  # Truncates the collected log to the specified limit and dumps it.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lamian
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.0
4
+ version: 1.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - JelF
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-06-28 00:00:00.000000000 Z
11
+ date: 2024-12-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -35,7 +35,6 @@ files:
35
35
  - ".github/workflows/test.yml"
36
36
  - ".gitignore"
37
37
  - ".rubocop.yml"
38
- - Changelog.md
39
38
  - Gemfile
40
39
  - Gemfile.lock
41
40
  - LICENSE.txt
@@ -72,14 +71,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
72
71
  requirements:
73
72
  - - ">="
74
73
  - !ruby/object:Gem::Version
75
- version: 2.7.0
74
+ version: 3.1.0
76
75
  required_rubygems_version: !ruby/object:Gem::Requirement
77
76
  requirements:
78
77
  - - ">="
79
78
  - !ruby/object:Gem::Version
80
79
  version: '0'
81
80
  requirements: []
82
- rubygems_version: 3.5.11
81
+ rubygems_version: 3.5.23
83
82
  signing_key:
84
83
  specification_version: 4
85
84
  summary: Add logs to your error messages
data/Changelog.md DELETED
@@ -1,58 +0,0 @@
1
- ## 1.9.0
2
-
3
- * Add `max_log_lines` config option to limit number of most recent log lines stored in the log device
4
-
5
- ## 1.8.0
6
-
7
- * Minor dependency updates;
8
-
9
- ## 1.3.0
10
-
11
- * Add support for the (new sentry gem)[https://github.com/getsentry/sentry-ruby].
12
-
13
- ## 1.2.0
14
-
15
- * Add `raven_log_size_limit` config option for limiting amount of data sent to sentry (defaults to `500_000`)
16
-
17
- ## 1.1.0
18
-
19
- * Add support for sentry and sidekiq
20
-
21
- ## 1.0.0
22
-
23
- * `6d8fee8` fixed a bug when ::Logger#log was not prepended. `::Logger#log` is an alias for `::Logger#add`,
24
- which ruins concept of single entry point :(. Also tied it to lamian instance
25
-
26
- ## 0.3.3
27
-
28
- * `8136689` fixed crashes when dump used outside lamian context
29
-
30
-
31
- ## 0.3.2
32
-
33
- * `e57e6cec` Changed rails dependency from `~> 4.2` to `>= 4.2`
34
-
35
- ## 0.3.1
36
-
37
- * 34ca83b5 Fixed formatting
38
-
39
- Stabilized formatting api, which removes control sequences from loggers data.
40
- E.g. `"[23mNice, lol[0m\n"` becomes `"Nice, lol\n"`
41
-
42
- ## 0.3.0
43
-
44
- * `d24f895b` API update
45
-
46
- Updated API, so lamian is now forced to be used with block.
47
- It also simplified usage outside a middleware
48
-
49
- ## 0.2.0
50
-
51
- * `3166517e` Added integrtation with rails
52
-
53
- Injected middleware before `ExceptionNotification`, so `ExceptionNotification`
54
- can use current log without any configuration. Also added some views
55
-
56
- ## 0.1.0
57
-
58
- * `62eb8685` Made test version to check it's integration with rails application