heavylog 0.0.26 → 0.1.0

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: 236a8f3c0a678260e534434028169a3dab6dd6fec8cbb5a827d5554afbea4378
4
- data.tar.gz: 84db3e326ced8bcab0e1f1178de9fbc5cad325f92286089c72dde1ae7c05f68c
3
+ metadata.gz: 67f8f650ce028d5d665e91dcf433598cac9f2e43b5f0bc27e4b275741ccbd9e0
4
+ data.tar.gz: 10e83a39f390df38b8bb1d47ea9fdc508591f390a1f42f428a34d2deb8ea84d8
5
5
  SHA512:
6
- metadata.gz: e3f02cae1c723b8d25288734842eb8d7e48309f2dcda7584cdb723e05eae29aa5eb2a7c6e87c1e18f07b6c881ab61a536db1b642e071b0ef54d9ba30143d8f89
7
- data.tar.gz: 26a2bdc5733d615593766c1bec4bdf3a736a7840fa3c30a4af8315518e1a885b6283b94c9b7409b8f669c8bd700c61b5ec022308fc83ce0f81e1ee9c3f3a049c
6
+ metadata.gz: 1881fefdd481ac8129676698e71fff044207f6ec39add42eaf4ecb512208a321e74c2e3daeb9e34da5e79d133845355460adbf158fb8d9a160473dce480e86f7
7
+ data.tar.gz: 9cbad0db88d74272274966840c5d3d84fde5b4a8d3f21d1d605a2f54c921d6e2f2ef18acc686f79982e3a7908c5aa462e4d16976b222f02c9f7bb58221a60e49
@@ -31,3 +31,6 @@ jobs:
31
31
  env:
32
32
  CI: true
33
33
  run: bundle exec rspec
34
+
35
+ - name: Upload coverage to Codecov
36
+ uses: codecov/codecov-action@v3
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 3.3.0
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- heavylog (0.0.25)
4
+ heavylog (0.1.0)
5
5
  actionpack (>= 5)
6
6
  activesupport (>= 5)
7
7
  railties (>= 5)
@@ -10,93 +10,123 @@ PATH
10
10
  GEM
11
11
  remote: https://rubygems.org/
12
12
  specs:
13
- actionpack (7.0.4)
14
- actionview (= 7.0.4)
15
- activesupport (= 7.0.4)
16
- rack (~> 2.0, >= 2.2.0)
13
+ actionpack (7.1.3.2)
14
+ actionview (= 7.1.3.2)
15
+ activesupport (= 7.1.3.2)
16
+ nokogiri (>= 1.8.5)
17
+ racc
18
+ rack (>= 2.2.4)
19
+ rack-session (>= 1.0.1)
17
20
  rack-test (>= 0.6.3)
18
- rails-dom-testing (~> 2.0)
19
- rails-html-sanitizer (~> 1.0, >= 1.2.0)
20
- actionview (7.0.4)
21
- activesupport (= 7.0.4)
21
+ rails-dom-testing (~> 2.2)
22
+ rails-html-sanitizer (~> 1.6)
23
+ actionview (7.1.3.2)
24
+ activesupport (= 7.1.3.2)
22
25
  builder (~> 3.1)
23
- erubi (~> 1.4)
24
- rails-dom-testing (~> 2.0)
25
- rails-html-sanitizer (~> 1.1, >= 1.2.0)
26
- activesupport (7.0.4)
26
+ erubi (~> 1.11)
27
+ rails-dom-testing (~> 2.2)
28
+ rails-html-sanitizer (~> 1.6)
29
+ activesupport (7.1.3.2)
30
+ base64
31
+ bigdecimal
27
32
  concurrent-ruby (~> 1.0, >= 1.0.2)
33
+ connection_pool (>= 2.2.5)
34
+ drb
28
35
  i18n (>= 1.6, < 2)
29
36
  minitest (>= 5.1)
37
+ mutex_m
30
38
  tzinfo (~> 2.0)
31
39
  ast (2.4.2)
32
40
  backport (1.2.0)
33
- benchmark (0.2.0)
41
+ base64 (0.2.0)
42
+ benchmark (0.3.0)
43
+ bigdecimal (3.1.6)
34
44
  builder (3.2.4)
35
- concurrent-ruby (1.1.10)
36
- connection_pool (2.2.5)
45
+ concurrent-ruby (1.2.3)
46
+ connection_pool (2.4.1)
37
47
  crass (1.0.6)
38
- diff-lcs (1.5.0)
48
+ diff-lcs (1.5.1)
39
49
  docile (1.4.0)
50
+ drb (2.2.1)
40
51
  e2mmap (0.1.0)
41
- erubi (1.11.0)
42
- i18n (1.12.0)
52
+ erubi (1.12.0)
53
+ i18n (1.14.1)
43
54
  concurrent-ruby (~> 1.0)
44
- jaro_winkler (1.5.4)
45
- json (2.6.2)
55
+ io-console (0.7.2)
56
+ irb (1.11.2)
57
+ rdoc
58
+ reline (>= 0.4.2)
59
+ jaro_winkler (1.5.6)
46
60
  kramdown (2.4.0)
47
61
  rexml
48
62
  kramdown-parser-gfm (1.1.0)
49
63
  kramdown (~> 2.0)
50
- loofah (2.19.0)
64
+ loofah (2.22.0)
51
65
  crass (~> 1.0.2)
52
- nokogiri (>= 1.5.9)
53
- method_source (1.0.0)
54
- mini_portile2 (2.8.0)
55
- minitest (5.16.3)
56
- nokogiri (1.13.7)
57
- mini_portile2 (~> 2.8.0)
66
+ nokogiri (>= 1.12.0)
67
+ mini_portile2 (2.8.5)
68
+ minitest (5.22.2)
69
+ mutex_m (0.2.0)
70
+ nokogiri (1.16.2)
71
+ mini_portile2 (~> 2.8.2)
58
72
  racc (~> 1.4)
59
- parallel (1.22.1)
60
- parser (3.1.2.0)
73
+ parallel (1.24.0)
74
+ parser (3.3.0.5)
61
75
  ast (~> 2.4.1)
62
- racc (1.6.0)
63
- rack (2.2.4)
64
- rack-test (2.0.2)
76
+ racc
77
+ psych (5.1.2)
78
+ stringio
79
+ racc (1.7.3)
80
+ rack (3.0.9.1)
81
+ rack-session (2.0.0)
82
+ rack (>= 3.0.0)
83
+ rack-test (2.1.0)
65
84
  rack (>= 1.3)
66
- rails-dom-testing (2.0.3)
67
- activesupport (>= 4.2.0)
85
+ rackup (2.1.0)
86
+ rack (>= 3)
87
+ webrick (~> 1.8)
88
+ rails-dom-testing (2.2.0)
89
+ activesupport (>= 5.0.0)
90
+ minitest
68
91
  nokogiri (>= 1.6)
69
- rails-html-sanitizer (1.4.3)
70
- loofah (~> 2.3)
71
- railties (7.0.4)
72
- actionpack (= 7.0.4)
73
- activesupport (= 7.0.4)
74
- method_source
92
+ rails-html-sanitizer (1.6.0)
93
+ loofah (~> 2.21)
94
+ nokogiri (~> 1.14)
95
+ railties (7.1.3.2)
96
+ actionpack (= 7.1.3.2)
97
+ activesupport (= 7.1.3.2)
98
+ irb
99
+ rackup (>= 1.0.0)
75
100
  rake (>= 12.2)
76
- thor (~> 1.0)
77
- zeitwerk (~> 2.5)
101
+ thor (~> 1.0, >= 1.2.2)
102
+ zeitwerk (~> 2.6)
78
103
  rainbow (3.1.1)
79
- rake (13.0.6)
80
- redis (4.7.1)
81
- regexp_parser (2.5.0)
82
- request_store (1.5.1)
104
+ rake (13.1.0)
105
+ rdoc (6.6.2)
106
+ psych (>= 4.0.0)
107
+ redis-client (0.20.0)
108
+ connection_pool
109
+ regexp_parser (2.9.0)
110
+ reline (0.4.3)
111
+ io-console (~> 0.5)
112
+ request_store (1.6.0)
83
113
  rack (>= 1.4)
84
114
  reverse_markdown (2.1.1)
85
115
  nokogiri
86
- rexml (3.2.5)
87
- rspec (3.11.0)
88
- rspec-core (~> 3.11.0)
89
- rspec-expectations (~> 3.11.0)
90
- rspec-mocks (~> 3.11.0)
91
- rspec-core (3.11.0)
92
- rspec-support (~> 3.11.0)
93
- rspec-expectations (3.11.0)
116
+ rexml (3.2.6)
117
+ rspec (3.13.0)
118
+ rspec-core (~> 3.13.0)
119
+ rspec-expectations (~> 3.13.0)
120
+ rspec-mocks (~> 3.13.0)
121
+ rspec-core (3.13.0)
122
+ rspec-support (~> 3.13.0)
123
+ rspec-expectations (3.13.0)
94
124
  diff-lcs (>= 1.2.0, < 2.0)
95
- rspec-support (~> 3.11.0)
96
- rspec-mocks (3.11.1)
125
+ rspec-support (~> 3.13.0)
126
+ rspec-mocks (3.13.0)
97
127
  diff-lcs (>= 1.2.0, < 2.0)
98
- rspec-support (~> 3.11.0)
99
- rspec-support (3.11.0)
128
+ rspec-support (~> 3.13.0)
129
+ rspec-support (3.13.1)
100
130
  rubocop (0.93.1)
101
131
  parallel (~> 1.10)
102
132
  parser (>= 2.7.1.5)
@@ -106,21 +136,26 @@ GEM
106
136
  rubocop-ast (>= 0.6.0)
107
137
  ruby-progressbar (~> 1.7)
108
138
  unicode-display_width (>= 1.4.0, < 2.0)
109
- rubocop-ast (1.19.1)
110
- parser (>= 3.1.1.0)
139
+ rubocop-ast (1.31.1)
140
+ parser (>= 3.3.0.4)
111
141
  rubocop-performance (1.5.2)
112
142
  rubocop (>= 0.71.0)
113
- ruby-progressbar (1.11.0)
114
- sidekiq (6.5.1)
115
- connection_pool (>= 2.2.2)
116
- rack (~> 2.0)
117
- redis (>= 4.2.0)
118
- simplecov (0.17.1)
143
+ ruby-progressbar (1.13.0)
144
+ sidekiq (7.2.2)
145
+ concurrent-ruby (< 2)
146
+ connection_pool (>= 2.3.0)
147
+ rack (>= 2.2.4)
148
+ redis-client (>= 0.19.0)
149
+ simplecov (0.21.2)
119
150
  docile (~> 1.1)
120
- json (>= 1.8, < 3)
121
- simplecov-html (~> 0.10.0)
122
- simplecov-html (0.10.2)
123
- solargraph (0.45.0)
151
+ simplecov-html (~> 0.11)
152
+ simplecov_json_formatter (~> 0.1)
153
+ simplecov-cobertura (2.1.0)
154
+ rexml
155
+ simplecov (~> 0.19)
156
+ simplecov-html (0.12.3)
157
+ simplecov_json_formatter (0.1.4)
158
+ solargraph (0.48.0)
124
159
  backport (~> 1.2)
125
160
  benchmark
126
161
  bundler (>= 1.17.2)
@@ -135,15 +170,15 @@ GEM
135
170
  thor (~> 1.0)
136
171
  tilt (~> 2.0)
137
172
  yard (~> 0.9, >= 0.9.24)
138
- thor (1.2.1)
139
- tilt (2.0.10)
140
- tzinfo (2.0.5)
173
+ stringio (3.1.0)
174
+ thor (1.3.1)
175
+ tilt (2.3.0)
176
+ tzinfo (2.0.6)
141
177
  concurrent-ruby (~> 1.0)
142
178
  unicode-display_width (1.8.0)
143
- webrick (1.7.0)
144
- yard (0.9.28)
145
- webrick (~> 1.7.0)
146
- zeitwerk (2.6.5)
179
+ webrick (1.8.1)
180
+ yard (0.9.36)
181
+ zeitwerk (2.6.13)
147
182
 
148
183
  PLATFORMS
149
184
  ruby
@@ -156,7 +191,8 @@ DEPENDENCIES
156
191
  rubocop (~> 0.71)
157
192
  rubocop-performance (~> 1.5.2)
158
193
  sidekiq (>= 6.0)
159
- simplecov (~> 0.17.1)
194
+ simplecov (~> 0.21.2)
195
+ simplecov-cobertura (~> 2.1.0)
160
196
  solargraph
161
197
 
162
198
  BUNDLED WITH
data/heavylog.gemspec CHANGED
@@ -27,7 +27,8 @@ Gem::Specification.new do |spec|
27
27
  spec.add_development_dependency "rspec", "~> 3.0"
28
28
  spec.add_development_dependency "rubocop", "~> 0.71"
29
29
  spec.add_development_dependency "rubocop-performance", "~> 1.5.2"
30
- spec.add_development_dependency "simplecov", "~> 0.17.1"
30
+ spec.add_development_dependency "simplecov", "~> 0.21.2"
31
+ spec.add_development_dependency "simplecov-cobertura", "~> 2.1.0"
31
32
  spec.add_development_dependency "sidekiq", ">= 6.0"
32
33
  spec.add_development_dependency "solargraph"
33
34
 
@@ -18,7 +18,7 @@ module Heavylog
18
18
  request = ActionDispatch::Request.new(env)
19
19
  RequestStore.store[:heavylog_request_id] = request.uuid
20
20
  RequestStore.store[:heavylog_request_start] = Time.now.iso8601
21
- RequestStore.store[:heavylog_request_ip] = request.ip
21
+ RequestStore.store[:heavylog_request_ip] = request.remote_ip
22
22
  end
23
23
 
24
24
  @app.call(env)
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Heavylog
4
+ class ProxyLogger < ::Logger
5
+ def initialize
6
+ super(nil)
7
+ end
8
+
9
+ def add(severity, message=nil, progname=nil, &block)
10
+ Heavylog.log(severity, message, progname, &block)
11
+ end
12
+
13
+ def loggable?
14
+ true
15
+ end
16
+ end
17
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Heavylog
4
- VERSION = "0.0.26"
4
+ VERSION = "0.1.0"
5
5
  end
data/lib/heavylog.rb CHANGED
@@ -8,6 +8,7 @@ require "heavylog/log_subscriber"
8
8
  require "heavylog/middleware"
9
9
  require "heavylog/ordered_options"
10
10
  require "heavylog/request_logger"
11
+ require "heavylog/proxy_logger"
11
12
  require "heavylog/sidekiq_logger"
12
13
  require "heavylog/sidekiq_exception_handler"
13
14
 
@@ -29,7 +30,13 @@ module Heavylog
29
30
  end
30
31
 
31
32
  def patch_loggers
32
- Rails.logger.extend(RequestLogger) if defined?(Rails)
33
+ return unless defined?(Rails)
34
+
35
+ if Rails.logger.respond_to?(:broadcast_to)
36
+ Rails.logger.broadcast_to(ProxyLogger.new)
37
+ else
38
+ Rails.logger.extend(RequestLogger)
39
+ end
33
40
  end
34
41
 
35
42
  def set_options
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: heavylog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.26
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kristjan Rang
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-11-06 00:00:00.000000000 Z
11
+ date: 2024-03-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -86,14 +86,28 @@ dependencies:
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: 0.17.1
89
+ version: 0.21.2
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: 0.17.1
96
+ version: 0.21.2
97
+ - !ruby/object:Gem::Dependency
98
+ name: simplecov-cobertura
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: 2.1.0
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: 2.1.0
97
111
  - !ruby/object:Gem::Dependency
98
112
  name: sidekiq
99
113
  requirement: !ruby/object:Gem::Requirement
@@ -190,6 +204,7 @@ files:
190
204
  - ".gitignore"
191
205
  - ".rspec"
192
206
  - ".rubocop.yml"
207
+ - ".ruby-version"
193
208
  - Gemfile
194
209
  - Gemfile.lock
195
210
  - LICENSE.txt
@@ -205,6 +220,7 @@ files:
205
220
  - lib/heavylog/log_subscriber.rb
206
221
  - lib/heavylog/middleware.rb
207
222
  - lib/heavylog/ordered_options.rb
223
+ - lib/heavylog/proxy_logger.rb
208
224
  - lib/heavylog/railtie.rb
209
225
  - lib/heavylog/request_logger.rb
210
226
  - lib/heavylog/sidekiq_exception_handler.rb
@@ -229,7 +245,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
229
245
  - !ruby/object:Gem::Version
230
246
  version: '0'
231
247
  requirements: []
232
- rubygems_version: 3.3.7
248
+ rubygems_version: 3.5.3
233
249
  signing_key:
234
250
  specification_version: 4
235
251
  summary: Format all Rails logging per request