gruf 2.7.1 → 2.8.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: 406a8f82efb12ee3d64829d9888301899a2268caf34c5ce9f4ada8c50e32700c
4
- data.tar.gz: 7b2f3d645e99fc49e53a97e75b5c59c6c9c1d35c2544642f52bc7607beb7aab0
3
+ metadata.gz: 05c56ef80530be6983b6a54c116f0ba6c378255688ced90d11b5bb1be69e7937
4
+ data.tar.gz: 72f3d26b4bc35a231e11198799c58823e5f4ff0f39a21798dddcb82d5c14fd68
5
5
  SHA512:
6
- metadata.gz: 93c5133334095c2319e555d902b8f597c01ec5cdc1ecd48d670fcb247ee45df4304c7623f91f50142cd10277175f22ec7c6a6ea428f70834afeee0bfc3b1373d
7
- data.tar.gz: 538bee3d11ee7a1fa45b375304857cf4f8daa18f0ef545e36a69a6d147a0b8cd911b759a2bdc7b9247e882829c95ae9ebc29a72852d126985555e8970b24694e
6
+ metadata.gz: 7390293027865fa85e904f0c82bf106bb3596aa949ea5f0bb13668511475dfed75cfddc68efb2beb4a832507cd92db266c9fc3bf903f9ece8779a21843bf532e
7
+ data.tar.gz: 765c589bdf841074a7c6944006670bb72794483c427cee52562bf232563771a929e91b3de32ef8cb72c208bad62ebe4d2bdffa8d5f9daa70dc29562e6f54cce5
@@ -2,6 +2,10 @@ Changelog for the gruf gem. This includes internal history before the gem was ma
2
2
 
3
3
  ### Pending release
4
4
 
5
+ ### 2.8.0
6
+
7
+ - Pass the controller request object into the request logging formatters [#92]
8
+
5
9
  ### 2.7.1
6
10
 
7
11
  - Add `channel_credentials` option to `Gruf::Client` and `default_channel_credentials` option to `Gruf::Configuration` [#85] [#87]
@@ -28,9 +28,11 @@ module Gruf
28
28
  # Format the parameters into a loggable string. Must be implemented in every derivative class
29
29
  #
30
30
  # @param [Hash] _payload The incoming request payload
31
+ # @param [Gruf::Controllers::Request] request The current controller request
32
+ # @param [Gruf::Interceptors::Timer::Result] result The timed result of the response
31
33
  # @return [String] The formatted string
32
34
  #
33
- def format(_payload)
35
+ def format(_payload, request:, result:)
34
36
  raise NotImplementedError
35
37
  end
36
38
  end
@@ -30,9 +30,11 @@ module Gruf
30
30
  # Format the request into a JSON-friendly payload
31
31
  #
32
32
  # @param [Hash] payload The incoming request payload
33
+ # @param [Gruf::Controllers::Request] request The current controller request
34
+ # @param [Gruf::Interceptors::Timer::Result] result The timed result of the response
33
35
  # @return [String] The JSON representation of the payload
34
36
  #
35
- def format(payload)
37
+ def format(payload, request:, result:)
36
38
  payload.merge(format: 'json').to_json
37
39
  end
38
40
  end
@@ -28,9 +28,11 @@ module Gruf
28
28
  # Format the request by only outputting the message body and params (if set to log params)
29
29
  #
30
30
  # @param [Hash] payload The incoming request payload
31
+ # @param [Gruf::Controllers::Request] request The current controller request
32
+ # @param [Gruf::Interceptors::Timer::Result] result The timed result of the response
31
33
  # @return [String] The formatted string
32
34
  #
33
- def format(payload)
35
+ def format(payload, request:, result:)
34
36
  time = payload.fetch(:duration, 0)
35
37
  grpc_status = payload.fetch(:grpc_status, 'GRPC::Ok')
36
38
  route_key = payload.fetch(:method, 'unknown')
@@ -100,7 +100,7 @@ module Gruf
100
100
  payload[:time] = Time.now.to_s
101
101
  payload[:host] = Socket.gethostname
102
102
 
103
- logger.send(type, formatter.format(payload))
103
+ logger.send(type, formatter.format(payload, request: request, result: result))
104
104
 
105
105
  raise result.message unless result.successful?
106
106
 
@@ -16,5 +16,5 @@
16
16
  # OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
17
17
  #
18
18
  module Gruf
19
- VERSION = '2.7.1'
19
+ VERSION = '2.8.0'
20
20
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gruf
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.7.1
4
+ version: 2.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shaun McCormick
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-12-16 00:00:00.000000000 Z
11
+ date: 2020-02-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler