Class: ActiveResource::LogSubscriber

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

Instance Method Summary collapse

Instance Method Details

#loggerObject


9
10
11
# File 'lib/active_resource/log_subscriber.rb', line 9

def logger
  ActiveResource::Base.logger
end

#request(event) ⇒ Object


3
4
5
6
7
# File 'lib/active_resource/log_subscriber.rb', line 3

def request(event)
  result = event.payload[:result]
  info "#{event.payload[:method].to_s.upcase} #{event.payload[:request_uri]}"
  info "--> %d %s %d (%.1fms)" % [result.code, result.message, result.body.to_s.length, event.duration]
end