Class: Griffin::Interceptors::Client::PayloadStreamer

Inherits:
Object
  • Object
show all
Defined in:
lib/griffin/interceptors/client/payload_streamer.rb

Instance Method Summary collapse

Constructor Details

#initialize(inner, logger, base_log = {}, filter = nil) ⇒ PayloadStreamer

Returns a new instance of PayloadStreamer.

Parameters:

  • inner (GrpcKit::Calls::Call)
  • logger (Logger)
  • base_log (Hash<String,String>) (defaults to: {})


12
13
14
15
16
17
# File 'lib/griffin/interceptors/client/payload_streamer.rb', line 12

def initialize(inner, logger, base_log = {}, filter = nil)
  super(inner)
  @logger = logger
  @filter = filter
  @base_log = base_log
end

Instance Method Details

#recvObject



24
25
26
27
28
# File 'lib/griffin/interceptors/client/payload_streamer.rb', line 24

def recv
  super.tap do |resp|
    @logger.info(@base_log.merge('grpc.response.content' => extract_content(resp)))
  end
end

#send_msg(msg) ⇒ Object



19
20
21
22
# File 'lib/griffin/interceptors/client/payload_streamer.rb', line 19

def send_msg(msg)
  @logger.info(@base_log.merge('grpc.request.content' => extract_content(msg)))
  super
end