umbrellio-utils 0.7.5 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +1 -1
- data/.rubocop.yml +2 -1
- data/Gemfile +1 -1
- data/Gemfile.lock +166 -138
- data/lib/umbrellio_utils/checks.rb +2 -2
- data/lib/umbrellio_utils/parsing.rb +1 -1
- data/lib/umbrellio_utils/request_wrapper.rb +1 -0
- data/lib/umbrellio_utils/semantic_logger/tiny_json_formatter.rb +19 -8
- data/lib/umbrellio_utils/version.rb +1 -1
- data/umbrellio_utils.gemspec +3 -3
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 69008a465e6cb9232b9e2ae595e519b04358ca1b6c39a140cb63e3f2c94b4d07
|
4
|
+
data.tar.gz: aff52ed04ae02ff06788f5d7cf990e9d55043411f59ed8e45866c4234b968225
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3f832a358b8517c3a9679a777eafd8488047488f8df5d451f395b0704213b994b1354d24346204e1bb63ff9e1e5eb135dc933905c53c12e18a2e6eda9ee81912
|
7
|
+
data.tar.gz: a89452771f674065a78c1a64cb41466938bb2e42e681d5fa1a3c8f4c786be608f4ed6afb56ecd2f84de343a95036d673cde68352bf8225d3dee807a81d47e019
|
data/.github/workflows/test.yml
CHANGED
data/.rubocop.yml
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,125 +1,141 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
umbrellio-utils (
|
4
|
+
umbrellio-utils (1.1.0)
|
5
5
|
memery (~> 1)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
actioncable (7.
|
11
|
-
actionpack (= 7.
|
12
|
-
activesupport (= 7.
|
10
|
+
actioncable (7.1.3.2)
|
11
|
+
actionpack (= 7.1.3.2)
|
12
|
+
activesupport (= 7.1.3.2)
|
13
13
|
nio4r (~> 2.0)
|
14
14
|
websocket-driver (>= 0.6.1)
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
15
|
+
zeitwerk (~> 2.6)
|
16
|
+
actionmailbox (7.1.3.2)
|
17
|
+
actionpack (= 7.1.3.2)
|
18
|
+
activejob (= 7.1.3.2)
|
19
|
+
activerecord (= 7.1.3.2)
|
20
|
+
activestorage (= 7.1.3.2)
|
21
|
+
activesupport (= 7.1.3.2)
|
21
22
|
mail (>= 2.7.1)
|
22
23
|
net-imap
|
23
24
|
net-pop
|
24
25
|
net-smtp
|
25
|
-
actionmailer (7.
|
26
|
-
actionpack (= 7.
|
27
|
-
actionview (= 7.
|
28
|
-
activejob (= 7.
|
29
|
-
activesupport (= 7.
|
26
|
+
actionmailer (7.1.3.2)
|
27
|
+
actionpack (= 7.1.3.2)
|
28
|
+
actionview (= 7.1.3.2)
|
29
|
+
activejob (= 7.1.3.2)
|
30
|
+
activesupport (= 7.1.3.2)
|
30
31
|
mail (~> 2.5, >= 2.5.4)
|
31
32
|
net-imap
|
32
33
|
net-pop
|
33
34
|
net-smtp
|
34
|
-
rails-dom-testing (~> 2.
|
35
|
-
actionpack (7.
|
36
|
-
actionview (= 7.
|
37
|
-
activesupport (= 7.
|
38
|
-
|
35
|
+
rails-dom-testing (~> 2.2)
|
36
|
+
actionpack (7.1.3.2)
|
37
|
+
actionview (= 7.1.3.2)
|
38
|
+
activesupport (= 7.1.3.2)
|
39
|
+
nokogiri (>= 1.8.5)
|
40
|
+
racc
|
41
|
+
rack (>= 2.2.4)
|
42
|
+
rack-session (>= 1.0.1)
|
39
43
|
rack-test (>= 0.6.3)
|
40
|
-
rails-dom-testing (~> 2.
|
41
|
-
rails-html-sanitizer (~> 1.
|
42
|
-
actiontext (7.
|
43
|
-
actionpack (= 7.
|
44
|
-
activerecord (= 7.
|
45
|
-
activestorage (= 7.
|
46
|
-
activesupport (= 7.
|
44
|
+
rails-dom-testing (~> 2.2)
|
45
|
+
rails-html-sanitizer (~> 1.6)
|
46
|
+
actiontext (7.1.3.2)
|
47
|
+
actionpack (= 7.1.3.2)
|
48
|
+
activerecord (= 7.1.3.2)
|
49
|
+
activestorage (= 7.1.3.2)
|
50
|
+
activesupport (= 7.1.3.2)
|
47
51
|
globalid (>= 0.6.0)
|
48
52
|
nokogiri (>= 1.8.5)
|
49
|
-
actionview (7.
|
50
|
-
activesupport (= 7.
|
53
|
+
actionview (7.1.3.2)
|
54
|
+
activesupport (= 7.1.3.2)
|
51
55
|
builder (~> 3.1)
|
52
|
-
erubi (~> 1.
|
53
|
-
rails-dom-testing (~> 2.
|
54
|
-
rails-html-sanitizer (~> 1.
|
55
|
-
activejob (7.
|
56
|
-
activesupport (= 7.
|
56
|
+
erubi (~> 1.11)
|
57
|
+
rails-dom-testing (~> 2.2)
|
58
|
+
rails-html-sanitizer (~> 1.6)
|
59
|
+
activejob (7.1.3.2)
|
60
|
+
activesupport (= 7.1.3.2)
|
57
61
|
globalid (>= 0.3.6)
|
58
|
-
activemodel (7.
|
59
|
-
activesupport (= 7.
|
60
|
-
activerecord (7.
|
61
|
-
activemodel (= 7.
|
62
|
-
activesupport (= 7.
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
62
|
+
activemodel (7.1.3.2)
|
63
|
+
activesupport (= 7.1.3.2)
|
64
|
+
activerecord (7.1.3.2)
|
65
|
+
activemodel (= 7.1.3.2)
|
66
|
+
activesupport (= 7.1.3.2)
|
67
|
+
timeout (>= 0.4.0)
|
68
|
+
activestorage (7.1.3.2)
|
69
|
+
actionpack (= 7.1.3.2)
|
70
|
+
activejob (= 7.1.3.2)
|
71
|
+
activerecord (= 7.1.3.2)
|
72
|
+
activesupport (= 7.1.3.2)
|
68
73
|
marcel (~> 1.0)
|
69
|
-
|
70
|
-
|
74
|
+
activesupport (7.1.3.2)
|
75
|
+
base64
|
76
|
+
bigdecimal
|
71
77
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
78
|
+
connection_pool (>= 2.2.5)
|
79
|
+
drb
|
72
80
|
i18n (>= 1.6, < 2)
|
73
81
|
minitest (>= 5.1)
|
82
|
+
mutex_m
|
74
83
|
tzinfo (~> 2.0)
|
75
|
-
addressable (2.8.
|
84
|
+
addressable (2.8.6)
|
76
85
|
public_suffix (>= 2.0.2, < 6.0)
|
77
|
-
amazing_print (1.
|
86
|
+
amazing_print (1.6.0)
|
78
87
|
amq-protocol (2.3.2)
|
79
88
|
ast (2.4.2)
|
80
|
-
|
89
|
+
base64 (0.2.0)
|
90
|
+
bigdecimal (3.1.7)
|
81
91
|
builder (3.2.4)
|
82
92
|
bunny (2.22.0)
|
83
93
|
amq-protocol (~> 2.3, >= 2.3.1)
|
84
94
|
sorted_set (~> 1, >= 1.0.2)
|
85
|
-
ci-helper (0.
|
86
|
-
colorize (~>
|
87
|
-
dry-inflector (~> 0
|
88
|
-
umbrellio-sequel-plugins (~> 0.
|
95
|
+
ci-helper (0.6.0)
|
96
|
+
colorize (~> 1.1)
|
97
|
+
dry-inflector (~> 1.0)
|
98
|
+
umbrellio-sequel-plugins (~> 0.14)
|
89
99
|
coderay (1.1.3)
|
90
|
-
colorize (
|
91
|
-
concurrent-ruby (1.2.
|
100
|
+
colorize (1.1.0)
|
101
|
+
concurrent-ruby (1.2.3)
|
102
|
+
connection_pool (2.4.1)
|
92
103
|
crass (1.0.6)
|
93
|
-
date (3.3.
|
94
|
-
diff-lcs (1.5.
|
104
|
+
date (3.3.4)
|
105
|
+
diff-lcs (1.5.1)
|
95
106
|
docile (1.4.0)
|
96
|
-
domain_name (0.
|
97
|
-
|
98
|
-
dry-inflector (0.
|
107
|
+
domain_name (0.6.20240107)
|
108
|
+
drb (2.2.1)
|
109
|
+
dry-inflector (1.0.0)
|
99
110
|
erubi (1.12.0)
|
100
|
-
ffi (1.
|
101
|
-
ffi-compiler (1.
|
102
|
-
ffi (>= 1.
|
111
|
+
ffi (1.16.3)
|
112
|
+
ffi-compiler (1.3.2)
|
113
|
+
ffi (>= 1.15.5)
|
103
114
|
rake
|
104
115
|
globalid (1.2.1)
|
105
116
|
activesupport (>= 6.1)
|
106
|
-
http (5.
|
117
|
+
http (5.2.0)
|
107
118
|
addressable (~> 2.8)
|
119
|
+
base64 (~> 0.1)
|
108
120
|
http-cookie (~> 1.0)
|
109
121
|
http-form_data (~> 2.2)
|
110
|
-
llhttp-ffi (~> 0.
|
122
|
+
llhttp-ffi (~> 0.5.0)
|
111
123
|
http-cookie (1.0.5)
|
112
124
|
domain_name (~> 0.5)
|
113
125
|
http-form_data (2.3.0)
|
114
|
-
i18n (1.14.
|
126
|
+
i18n (1.14.4)
|
115
127
|
concurrent-ruby (~> 1.0)
|
116
|
-
|
117
|
-
|
128
|
+
io-console (0.7.2)
|
129
|
+
irb (1.12.0)
|
130
|
+
rdoc
|
131
|
+
reline (>= 0.4.2)
|
132
|
+
json (2.7.2)
|
133
|
+
lamian (1.8.0)
|
118
134
|
rails (>= 4.2)
|
119
|
-
llhttp-ffi (0.
|
135
|
+
llhttp-ffi (0.5.0)
|
120
136
|
ffi-compiler (~> 1.0)
|
121
137
|
rake (~> 13.0)
|
122
|
-
loofah (2.
|
138
|
+
loofah (2.22.0)
|
123
139
|
crass (~> 1.0.2)
|
124
140
|
nokogiri (>= 1.12.0)
|
125
141
|
mail (2.8.1)
|
@@ -127,38 +143,40 @@ GEM
|
|
127
143
|
net-imap
|
128
144
|
net-pop
|
129
145
|
net-smtp
|
130
|
-
marcel (1.0.
|
146
|
+
marcel (1.0.4)
|
131
147
|
memery (1.5.0)
|
132
148
|
ruby2_keywords (~> 0.0.2)
|
133
|
-
method_source (1.
|
149
|
+
method_source (1.1.0)
|
134
150
|
mini_mime (1.1.5)
|
135
|
-
|
136
|
-
|
151
|
+
mini_portile2 (2.8.6)
|
152
|
+
minitest (5.22.3)
|
153
|
+
mutex_m (0.2.0)
|
154
|
+
net-imap (0.4.10)
|
137
155
|
date
|
138
156
|
net-protocol
|
139
157
|
net-pop (0.1.2)
|
140
158
|
net-protocol
|
141
|
-
net-protocol (0.2.
|
159
|
+
net-protocol (0.2.2)
|
142
160
|
timeout
|
143
|
-
net-smtp (0.
|
161
|
+
net-smtp (0.5.0)
|
144
162
|
net-protocol
|
145
|
-
nio4r (2.
|
146
|
-
nokogiri (1.
|
163
|
+
nio4r (2.7.1)
|
164
|
+
nokogiri (1.15.6)
|
165
|
+
mini_portile2 (~> 2.8.2)
|
147
166
|
racc (~> 1.4)
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
nori (2.6.0)
|
153
|
-
parallel (1.23.0)
|
154
|
-
parser (3.2.2.3)
|
167
|
+
nori (2.7.0)
|
168
|
+
bigdecimal
|
169
|
+
parallel (1.24.0)
|
170
|
+
parser (3.3.0.5)
|
155
171
|
ast (~> 2.4.1)
|
156
172
|
racc
|
157
|
-
pg (1.5.
|
173
|
+
pg (1.5.6)
|
158
174
|
pry (0.14.2)
|
159
175
|
coderay (~> 1.1)
|
160
176
|
method_source (~> 1.0)
|
161
|
-
|
177
|
+
psych (5.1.2)
|
178
|
+
stringio
|
179
|
+
public_suffix (5.0.5)
|
162
180
|
rabbit_messaging (0.13.0)
|
163
181
|
bunny (~> 2.0)
|
164
182
|
lamian
|
@@ -166,23 +184,28 @@ GEM
|
|
166
184
|
sneakers (~> 2.0)
|
167
185
|
tainbox
|
168
186
|
racc (1.7.3)
|
169
|
-
rack (
|
187
|
+
rack (3.0.10)
|
188
|
+
rack-session (2.0.0)
|
189
|
+
rack (>= 3.0.0)
|
170
190
|
rack-test (2.1.0)
|
171
191
|
rack (>= 1.3)
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
192
|
+
rackup (2.1.0)
|
193
|
+
rack (>= 3)
|
194
|
+
webrick (~> 1.8)
|
195
|
+
rails (7.1.3.2)
|
196
|
+
actioncable (= 7.1.3.2)
|
197
|
+
actionmailbox (= 7.1.3.2)
|
198
|
+
actionmailer (= 7.1.3.2)
|
199
|
+
actionpack (= 7.1.3.2)
|
200
|
+
actiontext (= 7.1.3.2)
|
201
|
+
actionview (= 7.1.3.2)
|
202
|
+
activejob (= 7.1.3.2)
|
203
|
+
activemodel (= 7.1.3.2)
|
204
|
+
activerecord (= 7.1.3.2)
|
205
|
+
activestorage (= 7.1.3.2)
|
206
|
+
activesupport (= 7.1.3.2)
|
184
207
|
bundler (>= 1.15.0)
|
185
|
-
railties (= 7.
|
208
|
+
railties (= 7.1.3.2)
|
186
209
|
rails-dom-testing (2.2.0)
|
187
210
|
activesupport (>= 5.0.0)
|
188
211
|
minitest
|
@@ -190,34 +213,39 @@ GEM
|
|
190
213
|
rails-html-sanitizer (1.6.0)
|
191
214
|
loofah (~> 2.21)
|
192
215
|
nokogiri (~> 1.14)
|
193
|
-
railties (7.
|
194
|
-
actionpack (= 7.
|
195
|
-
activesupport (= 7.
|
196
|
-
|
216
|
+
railties (7.1.3.2)
|
217
|
+
actionpack (= 7.1.3.2)
|
218
|
+
activesupport (= 7.1.3.2)
|
219
|
+
irb
|
220
|
+
rackup (>= 1.0.0)
|
197
221
|
rake (>= 12.2)
|
198
|
-
thor (~> 1.0)
|
199
|
-
zeitwerk (~> 2.
|
222
|
+
thor (~> 1.0, >= 1.2.2)
|
223
|
+
zeitwerk (~> 2.6)
|
200
224
|
rainbow (3.1.1)
|
201
|
-
rake (13.
|
225
|
+
rake (13.2.1)
|
202
226
|
rbtree (0.4.6)
|
203
|
-
|
227
|
+
rdoc (6.6.3.1)
|
228
|
+
psych (>= 4.0.0)
|
229
|
+
regexp_parser (2.9.0)
|
230
|
+
reline (0.5.1)
|
231
|
+
io-console (~> 0.5)
|
204
232
|
rexml (3.2.6)
|
205
|
-
rspec (3.
|
206
|
-
rspec-core (~> 3.
|
207
|
-
rspec-expectations (~> 3.
|
208
|
-
rspec-mocks (~> 3.
|
209
|
-
rspec-core (3.
|
210
|
-
rspec-support (~> 3.
|
211
|
-
rspec-expectations (3.
|
233
|
+
rspec (3.13.0)
|
234
|
+
rspec-core (~> 3.13.0)
|
235
|
+
rspec-expectations (~> 3.13.0)
|
236
|
+
rspec-mocks (~> 3.13.0)
|
237
|
+
rspec-core (3.13.0)
|
238
|
+
rspec-support (~> 3.13.0)
|
239
|
+
rspec-expectations (3.13.0)
|
212
240
|
diff-lcs (>= 1.2.0, < 2.0)
|
213
|
-
rspec-support (~> 3.
|
241
|
+
rspec-support (~> 3.13.0)
|
214
242
|
rspec-json_matcher (0.2.0)
|
215
243
|
amazing_print
|
216
244
|
json
|
217
|
-
rspec-mocks (3.
|
245
|
+
rspec-mocks (3.13.0)
|
218
246
|
diff-lcs (>= 1.2.0, < 2.0)
|
219
|
-
rspec-support (~> 3.
|
220
|
-
rspec-support (3.
|
247
|
+
rspec-support (~> 3.13.0)
|
248
|
+
rspec-support (3.13.1)
|
221
249
|
rubocop (1.50.2)
|
222
250
|
json (~> 2.3)
|
223
251
|
parallel (~> 1.10)
|
@@ -228,9 +256,9 @@ GEM
|
|
228
256
|
rubocop-ast (>= 1.28.0, < 2.0)
|
229
257
|
ruby-progressbar (~> 1.7)
|
230
258
|
unicode-display_width (>= 2.4.0, < 3.0)
|
231
|
-
rubocop-ast (1.
|
232
|
-
parser (>= 3.
|
233
|
-
rubocop-capybara (2.
|
259
|
+
rubocop-ast (1.31.2)
|
260
|
+
parser (>= 3.3.0.4)
|
261
|
+
rubocop-capybara (2.20.0)
|
234
262
|
rubocop (~> 1.41)
|
235
263
|
rubocop-config-umbrellio (1.50.0.85)
|
236
264
|
rubocop (~> 1.50.0)
|
@@ -256,15 +284,15 @@ GEM
|
|
256
284
|
ruby-progressbar (1.13.0)
|
257
285
|
ruby2_keywords (0.0.5)
|
258
286
|
self_data (1.3.0)
|
259
|
-
semantic_logger (4.
|
287
|
+
semantic_logger (4.15.0)
|
260
288
|
concurrent-ruby (~> 1.0)
|
261
|
-
sequel (5.
|
289
|
+
sequel (5.79.0)
|
262
290
|
bigdecimal
|
263
291
|
sequel-batches (2.0.2)
|
264
292
|
sequel
|
265
293
|
serverengine (2.0.7)
|
266
294
|
sigdump (~> 0.2.2)
|
267
|
-
set (1.0
|
295
|
+
set (1.1.0)
|
268
296
|
sigdump (0.2.5)
|
269
297
|
simplecov (0.22.0)
|
270
298
|
docile (~> 1.1)
|
@@ -282,36 +310,36 @@ GEM
|
|
282
310
|
sorted_set (1.0.3)
|
283
311
|
rbtree
|
284
312
|
set (~> 1.0)
|
313
|
+
stringio (3.1.0)
|
285
314
|
symbiont-ruby (0.7.0)
|
286
|
-
table_sync (6.
|
315
|
+
table_sync (6.5.0)
|
287
316
|
memery
|
288
317
|
rabbit_messaging (~> 0.13)
|
289
318
|
rails
|
290
319
|
self_data
|
291
320
|
tainbox (2.1.2)
|
292
321
|
activesupport
|
293
|
-
thor (1.
|
322
|
+
thor (1.3.1)
|
294
323
|
timecop (0.9.8)
|
295
|
-
timeout (0.4.
|
324
|
+
timeout (0.4.1)
|
296
325
|
tzinfo (2.0.6)
|
297
326
|
concurrent-ruby (~> 1.0)
|
298
|
-
umbrellio-sequel-plugins (0.14.0.
|
327
|
+
umbrellio-sequel-plugins (0.14.0.192)
|
299
328
|
sequel
|
300
329
|
symbiont-ruby
|
301
|
-
|
302
|
-
|
303
|
-
unf_ext (0.0.8.2)
|
304
|
-
unicode-display_width (2.4.2)
|
330
|
+
unicode-display_width (2.5.0)
|
331
|
+
webrick (1.8.1)
|
305
332
|
websocket-driver (0.7.6)
|
306
333
|
websocket-extensions (>= 0.1.0)
|
307
334
|
websocket-extensions (0.1.5)
|
308
|
-
yard (0.9.
|
309
|
-
zeitwerk (2.6.
|
335
|
+
yard (0.9.36)
|
336
|
+
zeitwerk (2.6.13)
|
310
337
|
|
311
338
|
PLATFORMS
|
312
339
|
arm64-darwin-20
|
313
340
|
arm64-darwin-21
|
314
341
|
arm64-darwin-23
|
342
|
+
ruby
|
315
343
|
x86_64-darwin-20
|
316
344
|
x86_64-linux
|
317
345
|
|
@@ -320,7 +348,7 @@ DEPENDENCIES
|
|
320
348
|
bundler
|
321
349
|
ci-helper
|
322
350
|
http
|
323
|
-
nokogiri
|
351
|
+
nokogiri (~> 1.15.0)
|
324
352
|
nori
|
325
353
|
pg
|
326
354
|
pry
|
@@ -339,4 +367,4 @@ DEPENDENCIES
|
|
339
367
|
yard
|
340
368
|
|
341
369
|
BUNDLED WITH
|
342
|
-
2.
|
370
|
+
2.5.9
|
@@ -4,8 +4,8 @@ module UmbrellioUtils
|
|
4
4
|
module Checks
|
5
5
|
extend self
|
6
6
|
|
7
|
-
EMAIL_REGEXP = /\A([\w+-].?)+@[a-z\d-]+(\.[a-z]+)*\.[a-z]+\z/i
|
8
|
-
HOLDER_NAME_REGEXP = /\A([A-Za-z0-9.'-]+ ?)+\z
|
7
|
+
EMAIL_REGEXP = /\A([\w+-].?)+@[a-z\d-]+(\.[a-z]+)*\.[a-z]+\z/i
|
8
|
+
HOLDER_NAME_REGEXP = /\A([A-Za-z0-9.'-]+ ?)+\z/
|
9
9
|
|
10
10
|
def secure_compare(src, dest)
|
11
11
|
ActiveSupport::SecurityUtils.secure_compare(
|
@@ -9,7 +9,7 @@ module UmbrellioUtils
|
|
9
9
|
HTTP_X_HTTP_AUTHORIZATION
|
10
10
|
HTTP_REDIRECT_X_HTTP_AUTHORIZATION
|
11
11
|
].freeze
|
12
|
-
CARD_TRUNCATED_PAN_REGEX = /\A(\d{6}).*(\d{4})\z
|
12
|
+
CARD_TRUNCATED_PAN_REGEX = /\A(\d{6}).*(\d{4})\z/
|
13
13
|
|
14
14
|
def try_to_parse_as_json(data)
|
15
15
|
JSON.parse(data) rescue data
|
@@ -21,7 +21,8 @@ module UmbrellioUtils
|
|
21
21
|
}.freeze
|
22
22
|
|
23
23
|
# Returns a new instance of the {UmbrellioUtils::SemanticLogger::TinyJsonFormatter}.
|
24
|
-
# @
|
24
|
+
# @option [Integer] message_size_limit maximum number of characters in a log message
|
25
|
+
# @option [Hash] custom_names_mapping mapping from default field names to custom ones.
|
25
26
|
# @option custom_names_mapping [Symbol] :severity custom name for the `severity` field.
|
26
27
|
# @option custom_names_mapping [Symbol] :name custom name for the `name` field.
|
27
28
|
# @option custom_names_mapping [Symbol] :thread_fingerprint
|
@@ -36,7 +37,8 @@ module UmbrellioUtils
|
|
36
37
|
# ) #=> <UmbrellioUtils::SemanticLogger::TinyJsonFormatter:0x000>
|
37
38
|
# @return [UmbrellioUtils::SemanticLogger::TinyJsonFormatter]
|
38
39
|
# a new instance of the {UmbrellioUtils::SemanticLogger::TinyJsonFormatter}
|
39
|
-
def initialize(
|
40
|
+
def initialize(message_size_limit: 10_000, custom_names_mapping: {})
|
41
|
+
self.message_size_limit = message_size_limit
|
40
42
|
self.field_names = { **DEFAULT_NAMES_MAPPING, **custom_names_mapping }.freeze
|
41
43
|
end
|
42
44
|
|
@@ -53,7 +55,7 @@ module UmbrellioUtils
|
|
53
55
|
|
54
56
|
# @!attribute field_names
|
55
57
|
# @return [Hash<Symbol, Symbol>] the mapping from default field names to the new ones.
|
56
|
-
attr_accessor :field_names
|
58
|
+
attr_accessor :message_size_limit, :field_names
|
57
59
|
|
58
60
|
# Builds hash with data from log.
|
59
61
|
# @return [Hash] the hash, which will be converted to the JSON later.
|
@@ -69,8 +71,8 @@ module UmbrellioUtils
|
|
69
71
|
[
|
70
72
|
log.level.upcase,
|
71
73
|
log.name,
|
72
|
-
|
73
|
-
log_to_message(log),
|
74
|
+
thread_fingerprint,
|
75
|
+
truncate(log_to_message(log)),
|
74
76
|
log.tags,
|
75
77
|
log.named_tags,
|
76
78
|
log.time.utc.iso8601(9),
|
@@ -79,8 +81,8 @@ module UmbrellioUtils
|
|
79
81
|
|
80
82
|
# Calculates MD5 fingerprint for the thread in which the log was made.
|
81
83
|
# @return [String] truncated `MD5` hash.
|
82
|
-
def
|
83
|
-
Digest::MD5.hexdigest("#{
|
84
|
+
def thread_fingerprint
|
85
|
+
Digest::MD5.hexdigest("#{Thread.current.object_id}-#{Process.pid}")[0...8]
|
84
86
|
end
|
85
87
|
|
86
88
|
# Renders either exception or message of the log.
|
@@ -91,9 +93,18 @@ module UmbrellioUtils
|
|
91
93
|
msg << "\n#{e.backtrace.join("\n")}" if e.backtrace
|
92
94
|
msg
|
93
95
|
else
|
94
|
-
log.message
|
96
|
+
log.message.to_s
|
95
97
|
end
|
96
98
|
end
|
99
|
+
|
100
|
+
def truncate(msg)
|
101
|
+
return msg unless msg.size > message_size_limit
|
102
|
+
|
103
|
+
suffix = "..."
|
104
|
+
msg = msg[0, message_size_limit - suffix.size]
|
105
|
+
|
106
|
+
"#{msg}#{suffix}"
|
107
|
+
end
|
97
108
|
end
|
98
109
|
end
|
99
110
|
end
|
data/umbrellio_utils.gemspec
CHANGED
@@ -5,14 +5,14 @@ require_relative "lib/umbrellio_utils/version"
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "umbrellio-utils"
|
7
7
|
spec.version = UmbrellioUtils::VERSION
|
8
|
-
spec.authors = ["
|
9
|
-
spec.email = ["
|
8
|
+
spec.authors = ["Team Umbrellio"]
|
9
|
+
spec.email = ["oss@umbrellio.biz"]
|
10
10
|
|
11
11
|
spec.summary = "A set of utilities that speed up development"
|
12
12
|
spec.description = "UmbrellioUtils is collection of utility classes and helpers"
|
13
13
|
spec.homepage = "https://github.com/umbrellio/utils"
|
14
14
|
spec.license = "MIT"
|
15
|
-
spec.required_ruby_version = Gem::Requirement.new(">=
|
15
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 3.0.0")
|
16
16
|
|
17
17
|
spec.metadata["homepage_uri"] = spec.homepage
|
18
18
|
spec.metadata["source_code_uri"] = "https://github.com/umbrellio/utils"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: umbrellio-utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- Team Umbrellio
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-02
|
11
|
+
date: 2024-05-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: memery
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
version: '1'
|
27
27
|
description: UmbrellioUtils is collection of utility classes and helpers
|
28
28
|
email:
|
29
|
-
-
|
29
|
+
- oss@umbrellio.biz
|
30
30
|
executables: []
|
31
31
|
extensions: []
|
32
32
|
extra_rdoc_files: []
|
@@ -79,14 +79,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
79
79
|
requirements:
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
82
|
+
version: 3.0.0
|
83
83
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
84
84
|
requirements:
|
85
85
|
- - ">="
|
86
86
|
- !ruby/object:Gem::Version
|
87
87
|
version: '0'
|
88
88
|
requirements: []
|
89
|
-
rubygems_version: 3.5.
|
89
|
+
rubygems_version: 3.5.9
|
90
90
|
signing_key:
|
91
91
|
specification_version: 4
|
92
92
|
summary: A set of utilities that speed up development
|