Class: PriceHubble::Instrumentation::LogSubscriber

Inherits:
ActiveSupport::LogSubscriber
  • Object
show all
Defined in:
lib/price_hubble/instrumentation/log_subscriber.rb

Overview

Produce logs for requests.

Instance Method Summary collapse

Instance Method Details

#loggerLogger?

Return the PriceHubble SDK configured logger when logging is enabled. Otherwise nil is returned and the subscriber is never started.

Returns:

  • (Logger, nil)

    the logger to use



11
12
13
14
15
# File 'lib/price_hubble/instrumentation/log_subscriber.rb', line 11

def logger
  return unless PriceHubble.configuration.request_logging

  PriceHubble.configuration.logger
end

#request(event) ⇒ Object

Log request statistics and debugging details.

Parameters:

  • event (ActiveSupport::Notifications::Event)

    the subscribed event



20
21
22
23
24
# File 'lib/price_hubble/instrumentation/log_subscriber.rb', line 20

def request(event)
  log_action_summary(event)
  log_request_details(event)
  log_response_details(event)
end