rails_api_logger 0.5.0 → 0.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.semaphore/{master-deploy.yml → main-deploy.yml} +3 -4
- data/.semaphore/semaphore.yml +2 -2
- data/CHANGELOG.md +13 -2
- data/README.md +2 -2
- data/lib/rails_api_logger/inbound_requests_logger.rb +1 -5
- data/lib/rails_api_logger/inbound_requests_logger_middleware.rb +5 -4
- data/lib/rails_api_logger.rb +5 -1
- data/rails_api_logger.gemspec +3 -1
- metadata +31 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f8a67bf5d7fcb8870d45a30a0112940edb4ec72f5edda7361872ec52b5f03d6d
|
4
|
+
data.tar.gz: ba68121637c9ee34420f6c8743183cfaf5c0728fa46e16827a22560a136a9d1e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eafedcd8d83dc150d3a22d6dba3152d55a9ac4f32701e7e1dd2b0e3f1eb735a35d89c0cd130c7cd265dc00dac0734c2cd6123c8fd02e438f51576e7a9c37d192
|
7
|
+
data.tar.gz: ab52418861338ca00c330a7fc561a8fc4113679b80e59e9fc8156a902ece41d94a94b398e51b5848daf12ae403967c716913092549a3bae60b4c9273043876bb
|
@@ -1,19 +1,18 @@
|
|
1
1
|
version: v1.0
|
2
|
-
name:
|
2
|
+
name: main-deploy
|
3
3
|
agent:
|
4
4
|
machine:
|
5
5
|
type: e1-standard-2
|
6
6
|
os_image: ubuntu1804
|
7
7
|
|
8
8
|
blocks:
|
9
|
-
- name:
|
9
|
+
- name: main-deploy
|
10
10
|
task:
|
11
11
|
secrets:
|
12
12
|
- name: rubygems-deploy
|
13
13
|
jobs:
|
14
|
-
- name:
|
14
|
+
- name: main-deploy
|
15
15
|
commands:
|
16
16
|
- checkout --use-cache
|
17
17
|
- gem build rails_api_logger
|
18
|
-
- chmod 0600 ~/.gem/credentials
|
19
18
|
- gem push rails_api_logger-*.gem
|
data/.semaphore/semaphore.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,14 @@
|
|
1
|
+
# 0.6.1
|
2
|
+
* Fixes the loading of concern into controllers.
|
3
|
+
|
4
|
+
# 0.6.0
|
5
|
+
* Fixes an important concurrency issue by removing instance variables in the rack middleware.
|
6
|
+
|
7
|
+
# 0.5.0
|
8
|
+
* Started using Zeitwerk.
|
9
|
+
* Removed RailsAdmin specific code.
|
10
|
+
* Improved RailsApiLogger class.
|
11
|
+
|
1
12
|
# 0.4.1
|
2
13
|
* Fixed the `.failed` scope.
|
3
14
|
|
@@ -18,7 +29,7 @@ add_column :outbound_request_logs, :ended_at, :timestamp
|
|
18
29
|
* Added `formatted_request_body` and `formatted_response_body` methods.
|
19
30
|
|
20
31
|
# 0.2.0
|
21
|
-
* Switch to a middleware solution
|
32
|
+
* Switch to a middleware solution.
|
22
33
|
|
23
34
|
# 0.1.0
|
24
|
-
* Initial release
|
35
|
+
* Initial release.
|
data/README.md
CHANGED
@@ -180,7 +180,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
180
180
|
|
181
181
|
Bug reports and pull requests are welcome on GitHub at https://github.com/renuo/rails_api_logger.
|
182
182
|
This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to
|
183
|
-
the [code of conduct](https://github.com/renuo/rails_api_logger/blob/
|
183
|
+
the [code of conduct](https://github.com/renuo/rails_api_logger/blob/main/CODE_OF_CONDUCT.md).
|
184
184
|
|
185
185
|
## License
|
186
186
|
|
@@ -189,4 +189,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
189
189
|
## Code of Conduct
|
190
190
|
|
191
191
|
Everyone interacting in the RailsApiLogger project's codebases, issue trackers, chat rooms and mailing lists is
|
192
|
-
expected to follow the [code of conduct](https://github.com/renuo/rails_api_logger/blob/
|
192
|
+
expected to follow the [code of conduct](https://github.com/renuo/rails_api_logger/blob/main/CODE_OF_CONDUCT.md).
|
@@ -4,10 +4,6 @@ module InboundRequestsLogger
|
|
4
4
|
private
|
5
5
|
|
6
6
|
def attach_inbound_request_loggable(loggable)
|
7
|
-
request.env["
|
7
|
+
request.env["INBOUND_REQUEST_LOG"].update(loggable: loggable) if loggable&.persisted?
|
8
8
|
end
|
9
9
|
end
|
10
|
-
|
11
|
-
ActiveSupport.on_load(:action_controller) do
|
12
|
-
include InboundRequestsLogger
|
13
|
-
end
|
@@ -11,13 +11,14 @@ class InboundRequestsLoggerMiddleware
|
|
11
11
|
request = ActionDispatch::Request.new(env)
|
12
12
|
logging = log?(env, request)
|
13
13
|
if logging
|
14
|
-
|
15
|
-
env["inbound_request_log"] = @inbound_request_log
|
14
|
+
env["INBOUND_REQUEST_LOG"] = InboundRequestLog.from_request(request)
|
16
15
|
request.body.rewind
|
17
16
|
end
|
18
17
|
status, headers, body = @app.call(env)
|
19
18
|
if logging
|
20
|
-
|
19
|
+
env["INBOUND_REQUEST_LOG"].update_columns(response_body: parsed_body(body),
|
20
|
+
response_code: status,
|
21
|
+
ended_at: Time.current)
|
21
22
|
end
|
22
23
|
[status, headers, body]
|
23
24
|
end
|
@@ -25,7 +26,7 @@ class InboundRequestsLoggerMiddleware
|
|
25
26
|
private
|
26
27
|
|
27
28
|
def log?(env, request)
|
28
|
-
env["
|
29
|
+
env["PATH_INFO"] =~ path_regexp && (!only_state_change || request_with_state_change?(request))
|
29
30
|
end
|
30
31
|
|
31
32
|
def parsed_body(body)
|
data/lib/rails_api_logger.rb
CHANGED
@@ -4,7 +4,7 @@ require "zeitwerk"
|
|
4
4
|
|
5
5
|
loader = Zeitwerk::Loader.for_gem
|
6
6
|
loader.collapse("#{__dir__}/rails_api_logger")
|
7
|
-
loader.
|
7
|
+
loader.ignore("#{__dir__}/generators")
|
8
8
|
loader.setup
|
9
9
|
|
10
10
|
class RailsApiLogger
|
@@ -27,3 +27,7 @@ class RailsApiLogger
|
|
27
27
|
log.save!
|
28
28
|
end
|
29
29
|
end
|
30
|
+
|
31
|
+
ActiveSupport.on_load(:action_controller) do
|
32
|
+
include InboundRequestsLogger
|
33
|
+
end
|
data/rails_api_logger.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |spec|
|
2
2
|
spec.name = "rails_api_logger"
|
3
|
-
spec.version = "0.
|
3
|
+
spec.version = "0.6.2"
|
4
4
|
spec.authors = ["Alessandro Rodi"]
|
5
5
|
spec.email = ["alessandro.rodi@renuo.ch"]
|
6
6
|
|
@@ -25,6 +25,7 @@ Gem::Specification.new do |spec|
|
|
25
25
|
|
26
26
|
spec.add_dependency "railties", ">= 4.1.0"
|
27
27
|
spec.add_dependency "activerecord", ">= 4.1.0"
|
28
|
+
spec.add_dependency "actionpack", ">= 4.1.0"
|
28
29
|
spec.add_dependency "nokogiri"
|
29
30
|
spec.add_dependency "zeitwerk", ">= 2.0.0"
|
30
31
|
|
@@ -32,4 +33,5 @@ Gem::Specification.new do |spec|
|
|
32
33
|
spec.add_development_dependency "standard", "~> 0.13.0"
|
33
34
|
spec.add_development_dependency "rake", "~> 12.0"
|
34
35
|
spec.add_development_dependency "rspec", "~> 3.0"
|
36
|
+
spec.add_development_dependency "rack"
|
35
37
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_api_logger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alessandro Rodi
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-07-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 4.1.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: actionpack
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 4.1.0
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 4.1.0
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: nokogiri
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -122,6 +136,20 @@ dependencies:
|
|
122
136
|
- - "~>"
|
123
137
|
- !ruby/object:Gem::Version
|
124
138
|
version: '3.0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: rack
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
125
153
|
description: Log inbound and outbound API requests in your Rails application
|
126
154
|
email:
|
127
155
|
- alessandro.rodi@renuo.ch
|
@@ -132,7 +160,7 @@ files:
|
|
132
160
|
- ".gitignore"
|
133
161
|
- ".rspec"
|
134
162
|
- ".ruby-version"
|
135
|
-
- ".semaphore/
|
163
|
+
- ".semaphore/main-deploy.yml"
|
136
164
|
- ".semaphore/semaphore.yml"
|
137
165
|
- CHANGELOG.md
|
138
166
|
- CODE_OF_CONDUCT.md
|