memolog 0.3.1 → 0.3.5

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: a4c3d9289bf4c0378b3050613589595dbf2c1d1e5a25a0fa9f0c3d2302a2963e
4
- data.tar.gz: 0b56db61731b0e1bd1c293216cf0a0fab009ea8eb70be2b85601a27b70cdf284
3
+ metadata.gz: 9dce059f72625002e6b813ad70cf427c5a3a59fb00cc614b6c9f80c8424bae8f
4
+ data.tar.gz: 9e2fb92f533500da3d192c417b63578bfaa1984e76718e501393143e786796e5
5
5
  SHA512:
6
- metadata.gz: 6a25437819058d1330f195a7dbbeea54d728face25790bc83c6fcba84500e18b459a8d50730c79e598b86c4c7a0f953d5ab804c2d71bb38c3d2f898a08097761
7
- data.tar.gz: 0b90e159e40b2a0e4a7fb0c0aa84e96a8de0fb3b4538346e5614f894f001574c7c0157963273d50081aa36fc732085f46bd97afa9991d42085235e393a3d5e93
6
+ metadata.gz: 6d3dd9ff1c59a672936711f746fafb06921558108c3973ba174a8d3b08feb5ad239120d3422cf9a1fb53ff9621c6b10e82489b8da055774674821cef0e33eaaf
7
+ data.tar.gz: 60a56a7a9bd93b7fb06383230b3874a41806cf422197675a148b31410b67265733fc89673613990e7e5adc279d9f5a0ac8ac134e8e2284b07503471ec7eb1e73
@@ -24,7 +24,7 @@ jobs:
24
24
 
25
25
  strategy:
26
26
  matrix:
27
- ruby: [2.5, 2.6, 2.7, 3.0]
27
+ ruby: [2.7, 3.0]
28
28
 
29
29
  steps:
30
30
  - uses: actions/checkout@v2
data/Gemfile CHANGED
@@ -10,6 +10,4 @@ gem "rails"
10
10
  gem "rake"
11
11
  gem "rspec"
12
12
  gem "rubocop-config-umbrellio"
13
- gem "sentry-ruby"
14
- gem "sentry-sidekiq"
15
13
  gem "sidekiq"
data/Gemfile.lock CHANGED
@@ -1,237 +1,223 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- memolog (0.3.1)
4
+ memolog (0.3.5)
5
5
  logger (~> 1.4.3)
6
6
  securerandom (~> 0.1.0)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- actioncable (6.1.4.1)
12
- actionpack (= 6.1.4.1)
13
- activesupport (= 6.1.4.1)
11
+ actioncable (7.0.1)
12
+ actionpack (= 7.0.1)
13
+ activesupport (= 7.0.1)
14
14
  nio4r (~> 2.0)
15
15
  websocket-driver (>= 0.6.1)
16
- actionmailbox (6.1.4.1)
17
- actionpack (= 6.1.4.1)
18
- activejob (= 6.1.4.1)
19
- activerecord (= 6.1.4.1)
20
- activestorage (= 6.1.4.1)
21
- activesupport (= 6.1.4.1)
16
+ actionmailbox (7.0.1)
17
+ actionpack (= 7.0.1)
18
+ activejob (= 7.0.1)
19
+ activerecord (= 7.0.1)
20
+ activestorage (= 7.0.1)
21
+ activesupport (= 7.0.1)
22
22
  mail (>= 2.7.1)
23
- actionmailer (6.1.4.1)
24
- actionpack (= 6.1.4.1)
25
- actionview (= 6.1.4.1)
26
- activejob (= 6.1.4.1)
27
- activesupport (= 6.1.4.1)
23
+ net-imap
24
+ net-pop
25
+ net-smtp
26
+ actionmailer (7.0.1)
27
+ actionpack (= 7.0.1)
28
+ actionview (= 7.0.1)
29
+ activejob (= 7.0.1)
30
+ activesupport (= 7.0.1)
28
31
  mail (~> 2.5, >= 2.5.4)
32
+ net-imap
33
+ net-pop
34
+ net-smtp
29
35
  rails-dom-testing (~> 2.0)
30
- actionpack (6.1.4.1)
31
- actionview (= 6.1.4.1)
32
- activesupport (= 6.1.4.1)
33
- rack (~> 2.0, >= 2.0.9)
36
+ actionpack (7.0.1)
37
+ actionview (= 7.0.1)
38
+ activesupport (= 7.0.1)
39
+ rack (~> 2.0, >= 2.2.0)
34
40
  rack-test (>= 0.6.3)
35
41
  rails-dom-testing (~> 2.0)
36
42
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
37
- actiontext (6.1.4.1)
38
- actionpack (= 6.1.4.1)
39
- activerecord (= 6.1.4.1)
40
- activestorage (= 6.1.4.1)
41
- activesupport (= 6.1.4.1)
43
+ actiontext (7.0.1)
44
+ actionpack (= 7.0.1)
45
+ activerecord (= 7.0.1)
46
+ activestorage (= 7.0.1)
47
+ activesupport (= 7.0.1)
48
+ globalid (>= 0.6.0)
42
49
  nokogiri (>= 1.8.5)
43
- actionview (6.1.4.1)
44
- activesupport (= 6.1.4.1)
50
+ actionview (7.0.1)
51
+ activesupport (= 7.0.1)
45
52
  builder (~> 3.1)
46
53
  erubi (~> 1.4)
47
54
  rails-dom-testing (~> 2.0)
48
55
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
49
- activejob (6.1.4.1)
50
- activesupport (= 6.1.4.1)
56
+ activejob (7.0.1)
57
+ activesupport (= 7.0.1)
51
58
  globalid (>= 0.3.6)
52
- activemodel (6.1.4.1)
53
- activesupport (= 6.1.4.1)
54
- activerecord (6.1.4.1)
55
- activemodel (= 6.1.4.1)
56
- activesupport (= 6.1.4.1)
57
- activestorage (6.1.4.1)
58
- actionpack (= 6.1.4.1)
59
- activejob (= 6.1.4.1)
60
- activerecord (= 6.1.4.1)
61
- activesupport (= 6.1.4.1)
62
- marcel (~> 1.0.0)
59
+ activemodel (7.0.1)
60
+ activesupport (= 7.0.1)
61
+ activerecord (7.0.1)
62
+ activemodel (= 7.0.1)
63
+ activesupport (= 7.0.1)
64
+ activestorage (7.0.1)
65
+ actionpack (= 7.0.1)
66
+ activejob (= 7.0.1)
67
+ activerecord (= 7.0.1)
68
+ activesupport (= 7.0.1)
69
+ marcel (~> 1.0)
63
70
  mini_mime (>= 1.1.0)
64
- activesupport (6.1.4.1)
71
+ activesupport (7.0.1)
65
72
  concurrent-ruby (~> 1.0, >= 1.0.2)
66
73
  i18n (>= 1.6, < 2)
67
74
  minitest (>= 5.1)
68
75
  tzinfo (~> 2.0)
69
- zeitwerk (~> 2.3)
70
76
  ast (2.4.2)
71
77
  builder (3.2.4)
72
78
  coderay (1.1.3)
73
79
  concurrent-ruby (1.1.9)
74
80
  connection_pool (2.2.5)
75
81
  crass (1.0.6)
76
- diff-lcs (1.4.4)
82
+ diff-lcs (1.5.0)
83
+ digest (3.1.0)
77
84
  erubi (1.10.0)
78
- faraday (1.8.0)
79
- faraday-em_http (~> 1.0)
80
- faraday-em_synchrony (~> 1.0)
81
- faraday-excon (~> 1.1)
82
- faraday-httpclient (~> 1.0.1)
83
- faraday-net_http (~> 1.0)
84
- faraday-net_http_persistent (~> 1.1)
85
- faraday-patron (~> 1.0)
86
- faraday-rack (~> 1.0)
87
- multipart-post (>= 1.2, < 3)
88
- ruby2_keywords (>= 0.0.4)
89
- faraday-em_http (1.0.0)
90
- faraday-em_synchrony (1.0.0)
91
- faraday-excon (1.1.0)
92
- faraday-httpclient (1.0.1)
93
- faraday-net_http (1.0.1)
94
- faraday-net_http_persistent (1.2.0)
95
- faraday-patron (1.0.0)
96
- faraday-rack (1.0.0)
97
- globalid (0.5.2)
85
+ globalid (1.0.0)
98
86
  activesupport (>= 5.0)
99
- i18n (1.8.10)
87
+ i18n (1.9.1)
100
88
  concurrent-ruby (~> 1.0)
89
+ io-wait (0.2.1)
101
90
  logger (1.4.4)
102
- loofah (2.12.0)
91
+ loofah (2.13.0)
103
92
  crass (~> 1.0.2)
104
93
  nokogiri (>= 1.5.9)
105
94
  mail (2.7.1)
106
95
  mini_mime (>= 0.1.1)
107
96
  marcel (1.0.2)
108
97
  method_source (1.0.0)
109
- mini_mime (1.1.1)
110
- minitest (5.14.4)
111
- multipart-post (2.1.1)
98
+ mini_mime (1.1.2)
99
+ minitest (5.15.0)
100
+ net-imap (0.2.3)
101
+ digest
102
+ net-protocol
103
+ strscan
104
+ net-pop (0.1.1)
105
+ digest
106
+ net-protocol
107
+ timeout
108
+ net-protocol (0.1.2)
109
+ io-wait
110
+ timeout
111
+ net-smtp (0.3.1)
112
+ digest
113
+ net-protocol
114
+ timeout
112
115
  nio4r (2.5.8)
113
- nokogiri (1.12.5-x86_64-darwin)
116
+ nokogiri (1.13.1-x86_64-darwin)
114
117
  racc (~> 1.4)
115
- nokogiri (1.12.5-x86_64-linux)
118
+ nokogiri (1.13.1-x86_64-linux)
116
119
  racc (~> 1.4)
117
120
  parallel (1.21.0)
118
- parser (3.0.2.0)
121
+ parser (3.1.0.0)
119
122
  ast (~> 2.4.1)
120
123
  pry (0.14.1)
121
124
  coderay (~> 1.1)
122
125
  method_source (~> 1.0)
123
- racc (1.5.2)
126
+ racc (1.6.0)
124
127
  rack (2.2.3)
125
128
  rack-test (1.1.0)
126
129
  rack (>= 1.0, < 3)
127
- rails (6.1.4.1)
128
- actioncable (= 6.1.4.1)
129
- actionmailbox (= 6.1.4.1)
130
- actionmailer (= 6.1.4.1)
131
- actionpack (= 6.1.4.1)
132
- actiontext (= 6.1.4.1)
133
- actionview (= 6.1.4.1)
134
- activejob (= 6.1.4.1)
135
- activemodel (= 6.1.4.1)
136
- activerecord (= 6.1.4.1)
137
- activestorage (= 6.1.4.1)
138
- activesupport (= 6.1.4.1)
130
+ rails (7.0.1)
131
+ actioncable (= 7.0.1)
132
+ actionmailbox (= 7.0.1)
133
+ actionmailer (= 7.0.1)
134
+ actionpack (= 7.0.1)
135
+ actiontext (= 7.0.1)
136
+ actionview (= 7.0.1)
137
+ activejob (= 7.0.1)
138
+ activemodel (= 7.0.1)
139
+ activerecord (= 7.0.1)
140
+ activestorage (= 7.0.1)
141
+ activesupport (= 7.0.1)
139
142
  bundler (>= 1.15.0)
140
- railties (= 6.1.4.1)
141
- sprockets-rails (>= 2.0.0)
143
+ railties (= 7.0.1)
142
144
  rails-dom-testing (2.0.3)
143
145
  activesupport (>= 4.2.0)
144
146
  nokogiri (>= 1.6)
145
147
  rails-html-sanitizer (1.4.2)
146
148
  loofah (~> 2.3)
147
- railties (6.1.4.1)
148
- actionpack (= 6.1.4.1)
149
- activesupport (= 6.1.4.1)
149
+ railties (7.0.1)
150
+ actionpack (= 7.0.1)
151
+ activesupport (= 7.0.1)
150
152
  method_source
151
- rake (>= 0.13)
153
+ rake (>= 12.2)
152
154
  thor (~> 1.0)
153
- rainbow (3.0.0)
155
+ zeitwerk (~> 2.5)
156
+ rainbow (3.1.1)
154
157
  rake (13.0.6)
155
- redis (4.4.0)
156
- regexp_parser (2.1.1)
158
+ redis (4.5.1)
159
+ regexp_parser (2.2.0)
157
160
  rexml (3.2.5)
158
161
  rspec (3.10.0)
159
162
  rspec-core (~> 3.10.0)
160
163
  rspec-expectations (~> 3.10.0)
161
164
  rspec-mocks (~> 3.10.0)
162
- rspec-core (3.10.1)
165
+ rspec-core (3.10.2)
163
166
  rspec-support (~> 3.10.0)
164
- rspec-expectations (3.10.1)
167
+ rspec-expectations (3.10.2)
165
168
  diff-lcs (>= 1.2.0, < 2.0)
166
169
  rspec-support (~> 3.10.0)
167
170
  rspec-mocks (3.10.2)
168
171
  diff-lcs (>= 1.2.0, < 2.0)
169
172
  rspec-support (~> 3.10.0)
170
- rspec-support (3.10.2)
171
- rubocop (1.17.0)
173
+ rspec-support (3.10.3)
174
+ rubocop (1.25.0)
172
175
  parallel (~> 1.10)
173
- parser (>= 3.0.0.0)
176
+ parser (>= 3.1.0.0)
174
177
  rainbow (>= 2.2.2, < 4.0)
175
178
  regexp_parser (>= 1.8, < 3.0)
176
179
  rexml
177
- rubocop-ast (>= 1.7.0, < 2.0)
180
+ rubocop-ast (>= 1.15.1, < 2.0)
178
181
  ruby-progressbar (~> 1.7)
179
182
  unicode-display_width (>= 1.4.0, < 3.0)
180
- rubocop-ast (1.12.0)
183
+ rubocop-ast (1.15.1)
181
184
  parser (>= 3.0.1.1)
182
- rubocop-config-umbrellio (1.17.0.53)
183
- rubocop (= 1.17.0)
184
- rubocop-performance (= 1.10.0)
185
- rubocop-rails (= 2.9.1)
186
- rubocop-rake (= 0.5.1)
187
- rubocop-rspec (= 2.2.0)
188
- rubocop-sequel (= 0.2.0)
189
- rubocop-performance (1.10.0)
190
- rubocop (>= 0.90.0, < 2.0)
185
+ rubocop-config-umbrellio (1.25.0.61)
186
+ rubocop (~> 1.25.0)
187
+ rubocop-performance (~> 1.13.0)
188
+ rubocop-rails (~> 2.13.0)
189
+ rubocop-rake (~> 0.6.0)
190
+ rubocop-rspec (~> 2.7.0)
191
+ rubocop-sequel (~> 0.3.3)
192
+ rubocop-performance (1.13.2)
193
+ rubocop (>= 1.7.0, < 2.0)
191
194
  rubocop-ast (>= 0.4.0)
192
- rubocop-rails (2.9.1)
195
+ rubocop-rails (2.13.2)
193
196
  activesupport (>= 4.2.0)
194
197
  rack (>= 1.1)
195
- rubocop (>= 0.90.0, < 2.0)
196
- rubocop-rake (0.5.1)
197
- rubocop
198
- rubocop-rspec (2.2.0)
198
+ rubocop (>= 1.7.0, < 2.0)
199
+ rubocop-rake (0.6.0)
199
200
  rubocop (~> 1.0)
200
- rubocop-ast (>= 1.1.0)
201
- rubocop-sequel (0.2.0)
201
+ rubocop-rspec (2.7.0)
202
+ rubocop (~> 1.19)
203
+ rubocop-sequel (0.3.3)
202
204
  rubocop (~> 1.0)
203
205
  ruby-progressbar (1.11.0)
204
- ruby2_keywords (0.0.5)
205
206
  securerandom (0.1.1)
206
- sentry-ruby (4.7.3)
207
- concurrent-ruby (~> 1.0, >= 1.0.2)
208
- faraday (>= 1.0)
209
- sentry-ruby-core (= 4.7.3)
210
- sentry-ruby-core (4.7.3)
211
- concurrent-ruby
212
- faraday
213
- sentry-sidekiq (4.7.3)
214
- sentry-ruby-core (~> 4.7.0)
215
- sidekiq (>= 3.0)
216
- sidekiq (6.2.2)
207
+ sidekiq (6.4.0)
217
208
  connection_pool (>= 2.2.2)
218
209
  rack (~> 2.0)
219
210
  redis (>= 4.2.0)
220
- sprockets (4.0.2)
221
- concurrent-ruby (~> 1.0)
222
- rack (> 1, < 3)
223
- sprockets-rails (3.2.2)
224
- actionpack (>= 4.0)
225
- activesupport (>= 4.0)
226
- sprockets (>= 3.0.0)
227
- thor (1.1.0)
211
+ strscan (3.0.1)
212
+ thor (1.2.1)
213
+ timeout (0.2.0)
228
214
  tzinfo (2.0.4)
229
215
  concurrent-ruby (~> 1.0)
230
216
  unicode-display_width (2.1.0)
231
217
  websocket-driver (0.7.5)
232
218
  websocket-extensions (>= 0.1.0)
233
219
  websocket-extensions (0.1.5)
234
- zeitwerk (2.4.2)
220
+ zeitwerk (2.5.4)
235
221
 
236
222
  PLATFORMS
237
223
  x86_64-darwin-20
@@ -244,8 +230,6 @@ DEPENDENCIES
244
230
  rake
245
231
  rspec
246
232
  rubocop-config-umbrellio
247
- sentry-ruby
248
- sentry-sidekiq
249
233
  sidekiq
250
234
 
251
235
  BUNDLED WITH
data/README.md CHANGED
@@ -1,8 +1,7 @@
1
1
  # Memolog
2
2
 
3
3
  Memolog is an in-memory logger, which extend any other logger.
4
- Designed to work with [Sentry](https://github.com/getsentry/sentry-ruby).
5
- It adds `memolog` extra section to Sentry errors.
4
+ Designed to work with [Sentry](https://github.com/getsentry/sentry-ruby) but it's not necessary.
6
5
 
7
6
  ## Installation
8
7
 
@@ -28,31 +27,36 @@ Use this example during application initialization process (this example impleme
28
27
  Memolog.configure do |config|
29
28
  config.debug = false
30
29
  config.formatter = ::Memolog::Formatter.new
31
- config.initializers = %i[rails sentry sidekiq]
30
+ config.middlewares = %i[rails sidekiq]
32
31
  config.log_size_limit = 50_000
33
- config.sentry_key = :memolog
34
32
  config.uuid_callable = -> { SecureRandom.uuid }
35
33
  end
36
34
 
37
- Memolog.init!
35
+ Memolog.init_middlewares!
38
36
  ```
39
37
 
40
38
  Available options are:
41
39
  - `debug` - set it to true if you need to leave Memolog.dump result outside `Memolog.run {}` block.
42
40
  - `formatter` - setup your own formatter.
43
- - `initializers` - define here what you want to initialize in `#init!` call.
44
- - `log_size_limit` - max log length in Sentry event.
45
- - `sentry_key` - key name in Sentry extra object.
41
+ - `middlewares` - define here what you want to initialize in `#init_middlewares!` call.
42
+ - `log_size_limit` - max log length in `#dump`.
46
43
  - `uuid_callable` - Memolog add unique value to logs, here you can redefine uuid generation.
47
44
 
45
+ If you want to apply Sentry monkey patch that call `Memolog.dump` before `Sentry.capture_exception`
46
+ and `Sentry.capture_message` you can implement it via this code:
47
+
48
+ ```ruby
49
+ Sentry.prepend(Memolog::SentryExtension)
50
+ ```
51
+
48
52
  ## Usage
49
53
 
50
54
  Please call `Memolog.extend_logger(Rails.logger)` or any other logger you want to collect.
51
- After that when error occured you can check your Sentry report and see `memolog` section with all
52
- logs collected before error. Also there will be unique identifier to find logs behaviour on your
53
- server or log collection system.
55
+ After that when error occured you can call `Memolog.dump` in your code and get log from
56
+ `Rails.logger` so you can collect it to another place (Sentry or etc). Also there will be unique
57
+ identifier to find logs behaviour on your server or log collection system.
54
58
 
55
- Memolog has init code for Rails (Middleware), Sentry (Extension) and Sidekiq (Middleware).
59
+ Memolog has init code for Rails (Middleware) and Sidekiq (Middleware).
56
60
  It implement all hacks on the `Memolog.init!` call.
57
61
  Also you can add `Memolog.run {}` around logs you want to collect and release it with `Memolog.dump`
58
62
  inside this block.
@@ -3,17 +3,15 @@
3
3
  Memolog::Config = Struct.new(
4
4
  :debug,
5
5
  :formatter,
6
- :initializers,
6
+ :middlewares,
7
7
  :log_size_limit,
8
- :sentry_key,
9
8
  :uuid_callable,
10
9
  ) do
11
10
  def initialize
12
11
  self.debug = false
13
12
  self.formatter = ::Memolog::Formatter.new
14
- self.initializers = %i[rails sentry sidekiq]
13
+ self.middlewares = %i[rails sidekiq]
15
14
  self.log_size_limit = 50_000
16
- self.sentry_key = :memolog
17
15
  self.uuid_callable = -> { SecureRandom.uuid }
18
16
  end
19
17
  end
data/lib/memolog/init.rb CHANGED
@@ -1,32 +1,24 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class Memolog::Init
4
- def call
5
- init_rails!
6
- init_sentry!
7
- init_sidekiq!
8
- end
9
-
10
- private
11
-
12
- def init_rails!
13
- return unless Memolog.config.initializers.include?(:rails)
14
- return unless Object.const_defined?("Rails")
15
- return if Object.const_defined?("Sidekiq") && Sidekiq.server?
3
+ module Memolog::Init
4
+ extend self
16
5
 
17
- Rails.application.middleware.insert_before(0, Memolog::RailsMiddleware)
6
+ def init_middlewares!
7
+ init_rails_middleware!
8
+ init_sidekiq_middleware!
18
9
  end
19
10
 
20
- def init_sentry!
21
- return unless Memolog.config.initializers.include?(:sentry)
22
- return unless Object.const_defined?("Sentry")
11
+ def init_rails_middleware!
12
+ return unless Memolog.config.middlewares.include?(:rails)
13
+ return unless Object.const_defined?(:Rails)
14
+ return if Object.const_defined?(:Sidekiq) && Sidekiq.server?
23
15
 
24
- Sentry.prepend(Memolog::SentryExtension)
16
+ Rails.application.middleware.insert_before(0, Memolog::RailsMiddleware)
25
17
  end
26
18
 
27
- def init_sidekiq!
28
- return unless Memolog.config.initializers.include?(:sidekiq)
29
- return unless Object.const_defined?("Sidekiq")
19
+ def init_sidekiq_middleware!
20
+ return unless Memolog.config.middlewares.include?(:sidekiq)
21
+ return unless Object.const_defined?(:Sidekiq)
30
22
 
31
23
  Sidekiq.configure_server do |config|
32
24
  config.server_middleware do |chain|
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Memolog::Extension
3
+ module Memolog::LoggerExtension
4
4
  def add(*args, &block)
5
5
  Memolog.logger.log(*args, &block)
6
6
  super
@@ -7,21 +7,18 @@ module Memolog::SentryExtension
7
7
 
8
8
  module ClassMethods
9
9
  def capture_exception(exception, **options, &block)
10
- add_memolog_to_current_scope!
10
+ set_extras_memolog!
11
11
  super
12
12
  end
13
13
 
14
14
  def capture_message(message, **options, &block)
15
- add_memolog_to_current_scope!
15
+ set_extras_memolog!
16
16
  super
17
17
  end
18
18
 
19
- def add_memolog_to_current_scope!
20
- dump = Memolog.dump
21
- return unless dump
22
-
23
- scope = get_current_scope
24
- scope.set_extras(Memolog.config.sentry_key => dump) if scope # rubocop:disable Style/SafeNavigation
19
+ def set_extras_memolog!
20
+ return unless get_current_scope
21
+ set_extras(memolog: Memolog.dump)
25
22
  end
26
23
  end
27
24
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Memolog
4
- VERSION = "0.3.1"
4
+ VERSION = "0.3.5"
5
5
  end
data/lib/memolog.rb CHANGED
@@ -6,9 +6,9 @@ require "stringio"
6
6
 
7
7
  require "memolog/version"
8
8
  require "memolog/config"
9
- require "memolog/extension"
10
9
  require "memolog/formatter"
11
10
  require "memolog/init"
11
+ require "memolog/logger_extension"
12
12
  require "memolog/rails_middleware"
13
13
  require "memolog/sentry_extension"
14
14
  require "memolog/sidekiq_middleware"
@@ -16,21 +16,20 @@ require "memolog/sidekiq_middleware"
16
16
  module Memolog
17
17
  extend self
18
18
 
19
- attr_accessor :config, :logdevs
19
+ attr_accessor :config
20
20
 
21
21
  @config = Memolog::Config.new
22
- @logdevs = []
23
22
 
24
23
  def configure
25
24
  yield(config) if block_given?
26
25
  end
27
26
 
28
- def init!
29
- Memolog::Init.new.call
27
+ def init_middlewares!
28
+ Memolog::Init.init_middlewares!
30
29
  end
31
30
 
32
31
  def extend_logger(other_logger)
33
- other_logger.extend(Memolog::Extension)
32
+ other_logger.extend(Memolog::LoggerExtension)
34
33
  other_logger.formatter = config.formatter
35
34
  end
36
35
 
@@ -42,6 +41,10 @@ module Memolog
42
41
  Thread.current[:memolog_logger] ||= Logger.new(nil, formatter: config.formatter)
43
42
  end
44
43
 
44
+ def logdevs
45
+ Thread.current[:memolog_logdevs] ||= []
46
+ end
47
+
45
48
  def run
46
49
  Thread.current[:memolog_uuid] = config.uuid_callable.call
47
50
 
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.3.1
4
+ version: 0.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stepan Kirushkin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-11-22 00:00:00.000000000 Z
11
+ date: 2022-01-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: logger
@@ -61,9 +61,9 @@ files:
61
61
  - bin/setup
62
62
  - lib/memolog.rb
63
63
  - lib/memolog/config.rb
64
- - lib/memolog/extension.rb
65
64
  - lib/memolog/formatter.rb
66
65
  - lib/memolog/init.rb
66
+ - lib/memolog/logger_extension.rb
67
67
  - lib/memolog/rails_middleware.rb
68
68
  - lib/memolog/sentry_extension.rb
69
69
  - lib/memolog/sidekiq_middleware.rb