rails_api_logger 0.2.0 → 0.2.1

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: b613afbb5fea833002c8cefd748428314e45df42344a41aacf0230aa7cdd9ffa
4
- data.tar.gz: 28ed28bde3d2aacfeee818600fb336d06355b0acbfab26cddd2ba779585dcb90
3
+ metadata.gz: 5fbcb1b4b9bd0ac439819b399b94cb27ae816c8d76afec1e700deada25d4934f
4
+ data.tar.gz: ddfa3c8d1528fb7b1bd18bcac71bc6499023d641496116c7db6b67f36839f9af
5
5
  SHA512:
6
- metadata.gz: 8e435ae3d44e5be4307ba6fa8239687ba2f95a6dba1841d857305cdb6f7c6d5471e07b9cab659e35ea432d9e76eb6f62658be24ee21582cef7cc52789aa5a6db
7
- data.tar.gz: cb0e8be6fba1f7108a93e124f57c0e10998c8354da03759ce5607ca8b4dd0f4fcb3d1a83ee442303290792f03a15098610ce2188d452c494a8c76174d9d40fae
6
+ metadata.gz: d40aa71d6d9c9229b93fabece22e6fbb51ef5dc4024edbfa2e914b433dfd4421c2bdae6218f7de33000896c8fdfbf1b0db4d253938db18bb9e36f70a0b8483d0
7
+ data.tar.gz: 94f7bc3f052d87c8f1cb8072febc193a43710b2f949737e0ea52fc5849097f1a6bd29d5eac6da3d06da51b2057bf649e76d64a3eef88873ebb0b79550cdd020f
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rails_api_logger (0.2.0)
4
+ rails_api_logger (0.2.1)
5
5
  activerecord (>= 4.1.0)
6
6
  railties (>= 4.1.0)
7
7
 
@@ -9,13 +9,14 @@ class InboundRequestLoggerMiddleware
9
9
 
10
10
  def call(env)
11
11
  request = ActionDispatch::Request.new(env)
12
- if log?(request)
12
+ logging = log?(env, request)
13
+ if logging
13
14
  @inbound_request_log = InboundRequestLog.from_request(request)
14
15
  env["inbound_request_log"] = @inbound_request_log
15
16
  request.body.rewind
16
17
  end
17
18
  status, headers, body = @app.call(env)
18
- if log?(request)
19
+ if logging
19
20
  @inbound_request_log.update(response_body: parsed_body(body), response_code: status)
20
21
  end
21
22
  [status, headers, body]
@@ -23,8 +24,8 @@ class InboundRequestLoggerMiddleware
23
24
 
24
25
  private
25
26
 
26
- def log?(request)
27
- request.path =~ path_regexp && (!only_state_change || request_with_state_change?(request))
27
+ def log?(env, request)
28
+ env["REQUEST_URI"] =~ path_regexp && (!only_state_change || request_with_state_change?(request))
28
29
  end
29
30
 
30
31
  def parsed_body(body)
@@ -1,3 +1,3 @@
1
1
  module RailsApiLogger
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  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.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alessandro Rodi
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-03-02 00:00:00.000000000 Z
11
+ date: 2021-03-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties