Class: Hoover::ActiveResourceLogSubscriber

Inherits:
ActiveSupport::LogSubscriber
  • Object
show all
Defined in:
lib/hoover/log_subscribers/active_resource_log_subscriber.rb

Instance Method Summary collapse

Instance Method Details

#request(event) ⇒ Object



3
4
5
6
7
8
9
10
11
12
# File 'lib/hoover/log_subscribers/active_resource_log_subscriber.rb', line 3

def request(event)
  result = event.payload[:result]
  request = { :method => event.payload[:method].to_s.upcase,
              :request_uri => event.payload[:request_uri],
              :result_code => result.code.to_i,
              :result_message => result.message,
              :result_length => result.body.to_s.length,
              :duration => event.duration }
  Hoover.add(:active_resource_request => request)
end