memolog 0.5.0 → 0.5.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 396904a701ac8bed9268d19fba38d279e3c20ac3dfbbc434192a3679020bf1dd
4
- data.tar.gz: 55c3c11a25daef636f51559e3aef40c6c4e01f30ab8f785ba9ae3327acc40978
3
+ metadata.gz: 26a1f1133c9b055600c33a91d7c53f59adb80c6d4965d655a5202114d69f770b
4
+ data.tar.gz: bce4c804aec15718d38cb9e73ce9866861676dfa2f2c59d9c3c50e6dd67330de
5
5
  SHA512:
6
- metadata.gz: d5d74c6c740f9e8e5b0aa424b33e3db92f87bf676b0c56d6b6dfd808adcd235c6a0490c05586561d9cc9d12c80b8ed777a3a1bee3a658ede608d14ea8978cd9d
7
- data.tar.gz: '0845879632c8e8c4632bce3a78857df8ade5bd57a4db79ac5d73de5d10476fba5710a00177c8c403bd0bd87a473b0959006f5fa6fe95338ec8a1c426690e0b39'
6
+ metadata.gz: 9ba992c3aae9358737c56c3154d1ebf88007abb26e8b8bcc8225e9a2d9cbc500c01e63b9de6cb4e456e79e067692d36988b87dc30f78fee8ed4abc04f9977ccd
7
+ data.tar.gz: 7c757c5e1b80e846434acc435f4bd5141f483d5c056cb10b837977b62a8acc7795ce5e00bcd6e120a0514c035b6d6dd5cc7d4fe5c586e3831c4b5656362fe30e
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 0.5.1
2
+ - Upgrade dependencies due to vulnerabilities.
3
+
1
4
  ## 0.5.0
2
5
  - Let user decide when to parse json log or not. Default is false.
3
6
  - Sentry data parse json by default.
data/Gemfile CHANGED
@@ -4,3 +4,12 @@ source "https://rubygems.org"
4
4
 
5
5
  # Specify your gem's dependencies in memolog.gemspec
6
6
  gemspec
7
+
8
+ group :development do
9
+ gem "pry"
10
+ gem "rails"
11
+ gem "rake"
12
+ gem "rspec"
13
+ gem "rubocop-config-umbrellio"
14
+ gem "sidekiq"
15
+ end
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- memolog (0.5.0)
4
+ memolog (0.5.2)
5
5
  json (~> 2)
6
6
  logger (~> 1.4.3)
7
7
  securerandom (~> 0.1.0)
@@ -9,67 +9,67 @@ PATH
9
9
  GEM
10
10
  remote: https://rubygems.org/
11
11
  specs:
12
- actioncable (7.0.4.2)
13
- actionpack (= 7.0.4.2)
14
- activesupport (= 7.0.4.2)
12
+ actioncable (7.0.8)
13
+ actionpack (= 7.0.8)
14
+ activesupport (= 7.0.8)
15
15
  nio4r (~> 2.0)
16
16
  websocket-driver (>= 0.6.1)
17
- actionmailbox (7.0.4.2)
18
- actionpack (= 7.0.4.2)
19
- activejob (= 7.0.4.2)
20
- activerecord (= 7.0.4.2)
21
- activestorage (= 7.0.4.2)
22
- activesupport (= 7.0.4.2)
17
+ actionmailbox (7.0.8)
18
+ actionpack (= 7.0.8)
19
+ activejob (= 7.0.8)
20
+ activerecord (= 7.0.8)
21
+ activestorage (= 7.0.8)
22
+ activesupport (= 7.0.8)
23
23
  mail (>= 2.7.1)
24
24
  net-imap
25
25
  net-pop
26
26
  net-smtp
27
- actionmailer (7.0.4.2)
28
- actionpack (= 7.0.4.2)
29
- actionview (= 7.0.4.2)
30
- activejob (= 7.0.4.2)
31
- activesupport (= 7.0.4.2)
27
+ actionmailer (7.0.8)
28
+ actionpack (= 7.0.8)
29
+ actionview (= 7.0.8)
30
+ activejob (= 7.0.8)
31
+ activesupport (= 7.0.8)
32
32
  mail (~> 2.5, >= 2.5.4)
33
33
  net-imap
34
34
  net-pop
35
35
  net-smtp
36
36
  rails-dom-testing (~> 2.0)
37
- actionpack (7.0.4.2)
38
- actionview (= 7.0.4.2)
39
- activesupport (= 7.0.4.2)
40
- rack (~> 2.0, >= 2.2.0)
37
+ actionpack (7.0.8)
38
+ actionview (= 7.0.8)
39
+ activesupport (= 7.0.8)
40
+ rack (~> 2.0, >= 2.2.4)
41
41
  rack-test (>= 0.6.3)
42
42
  rails-dom-testing (~> 2.0)
43
43
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
44
- actiontext (7.0.4.2)
45
- actionpack (= 7.0.4.2)
46
- activerecord (= 7.0.4.2)
47
- activestorage (= 7.0.4.2)
48
- activesupport (= 7.0.4.2)
44
+ actiontext (7.0.8)
45
+ actionpack (= 7.0.8)
46
+ activerecord (= 7.0.8)
47
+ activestorage (= 7.0.8)
48
+ activesupport (= 7.0.8)
49
49
  globalid (>= 0.6.0)
50
50
  nokogiri (>= 1.8.5)
51
- actionview (7.0.4.2)
52
- activesupport (= 7.0.4.2)
51
+ actionview (7.0.8)
52
+ activesupport (= 7.0.8)
53
53
  builder (~> 3.1)
54
54
  erubi (~> 1.4)
55
55
  rails-dom-testing (~> 2.0)
56
56
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
57
- activejob (7.0.4.2)
58
- activesupport (= 7.0.4.2)
57
+ activejob (7.0.8)
58
+ activesupport (= 7.0.8)
59
59
  globalid (>= 0.3.6)
60
- activemodel (7.0.4.2)
61
- activesupport (= 7.0.4.2)
62
- activerecord (7.0.4.2)
63
- activemodel (= 7.0.4.2)
64
- activesupport (= 7.0.4.2)
65
- activestorage (7.0.4.2)
66
- actionpack (= 7.0.4.2)
67
- activejob (= 7.0.4.2)
68
- activerecord (= 7.0.4.2)
69
- activesupport (= 7.0.4.2)
60
+ activemodel (7.0.8)
61
+ activesupport (= 7.0.8)
62
+ activerecord (7.0.8)
63
+ activemodel (= 7.0.8)
64
+ activesupport (= 7.0.8)
65
+ activestorage (7.0.8)
66
+ actionpack (= 7.0.8)
67
+ activejob (= 7.0.8)
68
+ activerecord (= 7.0.8)
69
+ activesupport (= 7.0.8)
70
70
  marcel (~> 1.0)
71
71
  mini_mime (>= 1.1.0)
72
- activesupport (7.0.4.2)
72
+ activesupport (7.0.8)
73
73
  concurrent-ruby (~> 1.0, >= 1.0.2)
74
74
  i18n (>= 1.6, < 2)
75
75
  minitest (>= 5.1)
@@ -77,21 +77,21 @@ GEM
77
77
  ast (2.4.2)
78
78
  builder (3.2.4)
79
79
  coderay (1.1.3)
80
- concurrent-ruby (1.2.0)
81
- connection_pool (2.3.0)
80
+ concurrent-ruby (1.2.2)
81
+ connection_pool (2.4.1)
82
82
  crass (1.0.6)
83
83
  date (3.3.3)
84
84
  diff-lcs (1.5.0)
85
85
  erubi (1.12.0)
86
- globalid (1.1.0)
87
- activesupport (>= 5.0)
88
- i18n (1.12.0)
86
+ globalid (1.2.1)
87
+ activesupport (>= 6.1)
88
+ i18n (1.14.1)
89
89
  concurrent-ruby (~> 1.0)
90
90
  json (2.6.3)
91
91
  logger (1.4.4)
92
- loofah (2.19.1)
92
+ loofah (2.21.3)
93
93
  crass (~> 1.0.2)
94
- nokogiri (>= 1.5.9)
94
+ nokogiri (>= 1.12.0)
95
95
  mail (2.8.1)
96
96
  mini_mime (>= 0.1.1)
97
97
  net-imap
@@ -99,127 +99,133 @@ GEM
99
99
  net-smtp
100
100
  marcel (1.0.2)
101
101
  method_source (1.0.0)
102
- mini_mime (1.1.2)
103
- minitest (5.17.0)
104
- net-imap (0.3.4)
102
+ mini_mime (1.1.5)
103
+ minitest (5.20.0)
104
+ net-imap (0.3.7)
105
105
  date
106
106
  net-protocol
107
107
  net-pop (0.1.2)
108
108
  net-protocol
109
109
  net-protocol (0.2.1)
110
110
  timeout
111
- net-smtp (0.3.3)
111
+ net-smtp (0.4.0)
112
112
  net-protocol
113
- nio4r (2.5.8)
114
- nokogiri (1.14.2-arm64-darwin)
113
+ nio4r (2.5.9)
114
+ nokogiri (1.15.4-arm64-darwin)
115
115
  racc (~> 1.4)
116
- nokogiri (1.14.2-x86_64-darwin)
116
+ nokogiri (1.15.4-x86_64-darwin)
117
117
  racc (~> 1.4)
118
- nokogiri (1.14.2-x86_64-linux)
118
+ nokogiri (1.15.4-x86_64-linux)
119
119
  racc (~> 1.4)
120
- parallel (1.22.1)
121
- parser (3.2.1.0)
120
+ parallel (1.23.0)
121
+ parser (3.2.2.3)
122
122
  ast (~> 2.4.1)
123
+ racc
123
124
  pry (0.14.2)
124
125
  coderay (~> 1.1)
125
126
  method_source (~> 1.0)
126
- racc (1.6.2)
127
- rack (2.2.6.2)
128
- rack-test (2.0.2)
127
+ racc (1.7.1)
128
+ rack (2.2.8)
129
+ rack-test (2.1.0)
129
130
  rack (>= 1.3)
130
- rails (7.0.4.2)
131
- actioncable (= 7.0.4.2)
132
- actionmailbox (= 7.0.4.2)
133
- actionmailer (= 7.0.4.2)
134
- actionpack (= 7.0.4.2)
135
- actiontext (= 7.0.4.2)
136
- actionview (= 7.0.4.2)
137
- activejob (= 7.0.4.2)
138
- activemodel (= 7.0.4.2)
139
- activerecord (= 7.0.4.2)
140
- activestorage (= 7.0.4.2)
141
- activesupport (= 7.0.4.2)
131
+ rails (7.0.8)
132
+ actioncable (= 7.0.8)
133
+ actionmailbox (= 7.0.8)
134
+ actionmailer (= 7.0.8)
135
+ actionpack (= 7.0.8)
136
+ actiontext (= 7.0.8)
137
+ actionview (= 7.0.8)
138
+ activejob (= 7.0.8)
139
+ activemodel (= 7.0.8)
140
+ activerecord (= 7.0.8)
141
+ activestorage (= 7.0.8)
142
+ activesupport (= 7.0.8)
142
143
  bundler (>= 1.15.0)
143
- railties (= 7.0.4.2)
144
- rails-dom-testing (2.0.3)
145
- activesupport (>= 4.2.0)
144
+ railties (= 7.0.8)
145
+ rails-dom-testing (2.2.0)
146
+ activesupport (>= 5.0.0)
147
+ minitest
146
148
  nokogiri (>= 1.6)
147
- rails-html-sanitizer (1.5.0)
148
- loofah (~> 2.19, >= 2.19.1)
149
- railties (7.0.4.2)
150
- actionpack (= 7.0.4.2)
151
- activesupport (= 7.0.4.2)
149
+ rails-html-sanitizer (1.6.0)
150
+ loofah (~> 2.21)
151
+ nokogiri (~> 1.14)
152
+ railties (7.0.8)
153
+ actionpack (= 7.0.8)
154
+ activesupport (= 7.0.8)
152
155
  method_source
153
156
  rake (>= 12.2)
154
157
  thor (~> 1.0)
155
158
  zeitwerk (~> 2.5)
156
159
  rainbow (3.1.1)
157
160
  rake (13.0.6)
158
- redis-client (0.12.2)
161
+ redis-client (0.17.0)
159
162
  connection_pool
160
- regexp_parser (2.7.0)
161
- rexml (3.2.5)
163
+ regexp_parser (2.8.1)
164
+ rexml (3.2.6)
162
165
  rspec (3.12.0)
163
166
  rspec-core (~> 3.12.0)
164
167
  rspec-expectations (~> 3.12.0)
165
168
  rspec-mocks (~> 3.12.0)
166
- rspec-core (3.12.1)
169
+ rspec-core (3.12.2)
167
170
  rspec-support (~> 3.12.0)
168
- rspec-expectations (3.12.2)
171
+ rspec-expectations (3.12.3)
169
172
  diff-lcs (>= 1.2.0, < 2.0)
170
173
  rspec-support (~> 3.12.0)
171
- rspec-mocks (3.12.3)
174
+ rspec-mocks (3.12.6)
172
175
  diff-lcs (>= 1.2.0, < 2.0)
173
176
  rspec-support (~> 3.12.0)
174
- rspec-support (3.12.0)
175
- rubocop (1.43.0)
177
+ rspec-support (3.12.1)
178
+ rubocop (1.50.2)
176
179
  json (~> 2.3)
177
180
  parallel (~> 1.10)
178
181
  parser (>= 3.2.0.0)
179
182
  rainbow (>= 2.2.2, < 4.0)
180
183
  regexp_parser (>= 1.8, < 3.0)
181
184
  rexml (>= 3.2.5, < 4.0)
182
- rubocop-ast (>= 1.24.1, < 2.0)
185
+ rubocop-ast (>= 1.28.0, < 2.0)
183
186
  ruby-progressbar (~> 1.7)
184
187
  unicode-display_width (>= 2.4.0, < 3.0)
185
- rubocop-ast (1.26.0)
188
+ rubocop-ast (1.29.0)
186
189
  parser (>= 3.2.1.0)
187
- rubocop-config-umbrellio (1.43.0.81)
188
- rubocop (~> 1.43.0)
189
- rubocop-performance (~> 1.15.0)
190
- rubocop-rails (~> 2.17.0)
190
+ rubocop-capybara (2.19.0)
191
+ rubocop (~> 1.41)
192
+ rubocop-config-umbrellio (1.50.0.85)
193
+ rubocop (~> 1.50.0)
194
+ rubocop-performance (~> 1.17.0)
195
+ rubocop-rails (~> 2.19.0)
191
196
  rubocop-rake (~> 0.6.0)
192
- rubocop-rspec (~> 2.16.0)
197
+ rubocop-rspec (~> 2.20.0)
193
198
  rubocop-sequel (~> 0.3.3)
194
- rubocop-performance (1.15.2)
199
+ rubocop-performance (1.17.1)
195
200
  rubocop (>= 1.7.0, < 2.0)
196
201
  rubocop-ast (>= 0.4.0)
197
- rubocop-rails (2.17.4)
202
+ rubocop-rails (2.19.1)
198
203
  activesupport (>= 4.2.0)
199
204
  rack (>= 1.1)
200
205
  rubocop (>= 1.33.0, < 2.0)
201
206
  rubocop-rake (0.6.0)
202
207
  rubocop (~> 1.0)
203
- rubocop-rspec (2.16.0)
208
+ rubocop-rspec (2.20.0)
204
209
  rubocop (~> 1.33)
210
+ rubocop-capybara (~> 2.17)
205
211
  rubocop-sequel (0.3.4)
206
212
  rubocop (~> 1.0)
207
- ruby-progressbar (1.11.0)
213
+ ruby-progressbar (1.13.0)
208
214
  securerandom (0.1.1)
209
- sidekiq (7.0.6)
215
+ sidekiq (7.1.5)
210
216
  concurrent-ruby (< 2)
211
217
  connection_pool (>= 2.3.0)
212
218
  rack (>= 2.2.4)
213
- redis-client (>= 0.11.0)
214
- thor (1.2.1)
215
- timeout (0.3.2)
219
+ redis-client (>= 0.14.0)
220
+ thor (1.2.2)
221
+ timeout (0.4.0)
216
222
  tzinfo (2.0.6)
217
223
  concurrent-ruby (~> 1.0)
218
- unicode-display_width (2.4.2)
219
- websocket-driver (0.7.5)
224
+ unicode-display_width (2.5.0)
225
+ websocket-driver (0.7.6)
220
226
  websocket-extensions (>= 0.1.0)
221
227
  websocket-extensions (0.1.5)
222
- zeitwerk (2.6.7)
228
+ zeitwerk (2.6.12)
223
229
 
224
230
  PLATFORMS
225
231
  arm64-darwin-22
@@ -237,4 +243,4 @@ DEPENDENCIES
237
243
  sidekiq
238
244
 
239
245
  BUNDLED WITH
240
- 2.4.3
246
+ 2.4.19
@@ -3,13 +3,15 @@
3
3
  Memolog::Config = Struct.new(
4
4
  :debug,
5
5
  :formatter,
6
- :middlewares,
6
+ :isolation_level,
7
7
  :log_size_limit,
8
+ :middlewares,
8
9
  ) do
9
10
  def initialize
10
11
  self.debug = false
11
12
  self.formatter = Logger::Formatter.new
12
- self.middlewares = %i[rails sidekiq]
13
+ self.isolation_level = :thread
13
14
  self.log_size_limit = 50_000
15
+ self.middlewares = %i[rails sidekiq]
14
16
  end
15
17
  end
@@ -2,12 +2,12 @@
2
2
 
3
3
  module Memolog::LoggerExtension
4
4
  def add(*args, &block)
5
- Memolog.logger.log(*args, &block)
5
+ Memolog.log(*args, &block)
6
6
  super
7
7
  end
8
8
 
9
9
  def log(*args, &block)
10
- Memolog.logger.log(*args, &block)
10
+ Memolog.log(*args, &block)
11
11
  super
12
12
  end
13
13
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Memolog
4
- VERSION = "0.5.0"
4
+ VERSION = "0.5.2"
5
5
  end
data/lib/memolog.rb CHANGED
@@ -31,14 +31,6 @@ module Memolog
31
31
  other_logger.extend(Memolog::LoggerExtension)
32
32
  end
33
33
 
34
- def logger
35
- Thread.current[:memolog_logger] ||= Logger.new(nil, formatter: config.formatter)
36
- end
37
-
38
- def logdevs
39
- Thread.current[:memolog_logdevs] ||= []
40
- end
41
-
42
34
  def run
43
35
  logdevs.push(StringIO.new)
44
36
  logger.instance_variable_set(:@logdev, logdevs.last)
@@ -48,6 +40,10 @@ module Memolog
48
40
  logdevs.pop unless config.debug
49
41
  end
50
42
 
43
+ def log(*args, &block)
44
+ logger.log(*args, &block)
45
+ end
46
+
51
47
  def dump(parse_json: false)
52
48
  return if logdevs.empty?
53
49
 
@@ -60,4 +56,18 @@ module Memolog
60
56
  rescue JSON::ParserError
61
57
  dump
62
58
  end
59
+
60
+ private
61
+
62
+ def logger
63
+ storage[:memolog_logger] ||= Logger.new(nil, formatter: config.formatter)
64
+ end
65
+
66
+ def logdevs
67
+ storage[:memolog_logdevs] ||= []
68
+ end
69
+
70
+ def storage
71
+ config.isolation_level == :fiber ? Fiber : Thread.current
72
+ end
63
73
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: memolog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stepan Kirushkin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-02-22 00:00:00.000000000 Z
11
+ date: 2023-10-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -52,90 +52,6 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: 0.1.0
55
- - !ruby/object:Gem::Dependency
56
- name: pry
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - ">="
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - ">="
67
- - !ruby/object:Gem::Version
68
- version: '0'
69
- - !ruby/object:Gem::Dependency
70
- name: rails
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - ">="
74
- - !ruby/object:Gem::Version
75
- version: '0'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - ">="
81
- - !ruby/object:Gem::Version
82
- version: '0'
83
- - !ruby/object:Gem::Dependency
84
- name: rake
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - ">="
88
- - !ruby/object:Gem::Version
89
- version: '0'
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - ">="
95
- - !ruby/object:Gem::Version
96
- version: '0'
97
- - !ruby/object:Gem::Dependency
98
- name: rspec
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - ">="
102
- - !ruby/object:Gem::Version
103
- version: '0'
104
- type: :development
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - ">="
109
- - !ruby/object:Gem::Version
110
- version: '0'
111
- - !ruby/object:Gem::Dependency
112
- name: rubocop-config-umbrellio
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - ">="
116
- - !ruby/object:Gem::Version
117
- version: '0'
118
- type: :development
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - ">="
123
- - !ruby/object:Gem::Version
124
- version: '0'
125
- - !ruby/object:Gem::Dependency
126
- name: sidekiq
127
- requirement: !ruby/object:Gem::Requirement
128
- requirements:
129
- - - ">="
130
- - !ruby/object:Gem::Version
131
- version: '0'
132
- type: :development
133
- prerelease: false
134
- version_requirements: !ruby/object:Gem::Requirement
135
- requirements:
136
- - - ">="
137
- - !ruby/object:Gem::Version
138
- version: '0'
139
55
  description: |2
140
56
  Memolog is an in-memory logger, which extend any other logger.
141
57
  Designed to work with Sentry.
@@ -187,7 +103,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
187
103
  - !ruby/object:Gem::Version
188
104
  version: '0'
189
105
  requirements: []
190
- rubygems_version: 3.4.6
106
+ rubygems_version: 3.4.19
191
107
  signing_key:
192
108
  specification_version: 4
193
109
  summary: In-memory logger for exceptions.