minato_logger 0.2.17 → 0.2.18
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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5c5068439bea8138ccf5e917e57399cef69758cf135bee2a103ca4ffd7eb6d10
|
|
4
|
+
data.tar.gz: 79911c6c7c72b4bb20c569c4e9bc98ccb22b426f112b80473bfc9600edccbcbe
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e12bdfc2ac0a746f2c4c0a1153ebc98977993088ea9b907b5d87ea6309a99b48addd031f0feb999dabd640e1938f3d0af54da2b744ecf9508c1a5775940a968e
|
|
7
|
+
data.tar.gz: e69b4561e246379cfebf0f2a13380551f5462dc1fe56591b67b4ed1214cf0831b2ecc318226a46ed4109a0a1f8c6d386a235e5b6a54db64f27d7a3fa36227ab9
|
|
@@ -10,8 +10,8 @@ module MinatoLogger
|
|
|
10
10
|
|
|
11
11
|
def call_app(request, env)
|
|
12
12
|
should_log = should_log?(request)
|
|
13
|
-
ctx = {
|
|
14
|
-
|
|
13
|
+
ctx = {}
|
|
14
|
+
ctx[:request] = build_request_context_base(request) if should_log
|
|
15
15
|
log_request(request, env, ctx) if should_log
|
|
16
16
|
handle = dispatch_request_event(request)
|
|
17
17
|
ctx[:response] = process_request(env)
|
|
@@ -30,6 +30,11 @@ module MinatoLogger
|
|
|
30
30
|
end
|
|
31
31
|
end
|
|
32
32
|
|
|
33
|
+
def build_request_context_base(request)
|
|
34
|
+
{ start_time: current_time, headers: extract_request_headers(request),
|
|
35
|
+
body: extract_request_body(request) }
|
|
36
|
+
end
|
|
37
|
+
|
|
33
38
|
def should_log?(request)
|
|
34
39
|
blacklist = Rails.application.config.minato_logger.route_blacklist || []
|
|
35
40
|
blacklist.none? do |item|
|
|
@@ -114,10 +119,12 @@ module MinatoLogger
|
|
|
114
119
|
|
|
115
120
|
def extract_request_body(request)
|
|
116
121
|
return nil unless request.body
|
|
122
|
+
return '[Multipart Form Data / File Upload]' if request.content_type.to_s.include?('multipart/form-data')
|
|
117
123
|
|
|
118
124
|
body = request.raw_post
|
|
119
125
|
return nil if body.blank?
|
|
120
126
|
|
|
127
|
+
request.body.rewind if request.body.respond_to?(:rewind)
|
|
121
128
|
safe_parse_json(body)
|
|
122
129
|
rescue StandardError => e
|
|
123
130
|
"Error reading request body: #{e}"
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: minato_logger
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.18
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ferreri
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-02-
|
|
11
|
+
date: 2026-02-25 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|