minato_logger 0.2.16 → 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: a92bc90dad9351db28e1822889e30507ec655fbbd8af5d8958e0bd71d0543adf
4
- data.tar.gz: 116eae9a2b9e93b22227c349bac98bdf939575ab6ffac7c1a381ce34a262f297
3
+ metadata.gz: 5c5068439bea8138ccf5e917e57399cef69758cf135bee2a103ca4ffd7eb6d10
4
+ data.tar.gz: 79911c6c7c72b4bb20c569c4e9bc98ccb22b426f112b80473bfc9600edccbcbe
5
5
  SHA512:
6
- metadata.gz: fe0647f14553910186ae4bd62937ef60d9768b2c0875aed66a921696c786f3f867057f7016d2551f622d5d43654979225a15a80efe64ef61a8c4fe2e93bb3d01
7
- data.tar.gz: 95ff3b9a514096cd59de2f4f48238646beaec3ab8da2cbd712aed8fe26db654ce70506636bef85142c926794c6db1ff327c5e121cdf9f4e2e1fe0bdf5d9d9702
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 = { request: { start_time: current_time, headers: extract_request_headers(request),
14
- body: extract_request_body(request) } }
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,9 +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')
123
+
124
+ body = request.raw_post
125
+ return nil if body.blank?
117
126
 
118
- body = request.body.read
119
- request.body.rewind
127
+ request.body.rewind if request.body.respond_to?(:rewind)
120
128
  safe_parse_json(body)
121
129
  rescue StandardError => e
122
130
  "Error reading request body: #{e}"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MinatoLogger
4
- VERSION = '0.2.16'
4
+ VERSION = '0.2.18'
5
5
  end
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.16
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-16 00:00:00.000000000 Z
11
+ date: 2026-02-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport