Class: ActiveResource::DetailedLogSubscriber

Inherits:
ActiveSupport::LogSubscriber
  • Object
show all
Defined in:
lib/active_resource/detailed_log_subscriber.rb

Instance Method Summary collapse

Instance Method Details

#loggerObject



13
14
15
# File 'lib/active_resource/detailed_log_subscriber.rb', line 13

def logger
  ActiveResource::Base.logger
end

#request(event) ⇒ Object



3
4
5
6
7
8
9
10
11
# File 'lib/active_resource/detailed_log_subscriber.rb', line 3

def request(event)
  data = event.payload[:data]
  headers = data.extract_options!
  request_body = data.first

  info "Request:\n#{request_body}" if request_body
  info "Headers: #{headers.inspect}"
  info "Response:\n#{event.payload[:response].body}"
end