Class: ActiveResource::LogSubscriber

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

Constant Summary

Constants inherited from ActiveSupport::LogSubscriber

ActiveSupport::LogSubscriber::BLACK, ActiveSupport::LogSubscriber::BLUE, ActiveSupport::LogSubscriber::BOLD, ActiveSupport::LogSubscriber::CLEAR, ActiveSupport::LogSubscriber::CYAN, ActiveSupport::LogSubscriber::GREEN, ActiveSupport::LogSubscriber::MAGENTA, ActiveSupport::LogSubscriber::RED, ActiveSupport::LogSubscriber::WHITE, ActiveSupport::LogSubscriber::YELLOW

Instance Method Summary collapse

Methods inherited from ActiveSupport::LogSubscriber

attach_to, #call, flush_all!, flushable_loggers, log_subscribers, logger

Instance Method Details

#loggerObject


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

def logger
  ActiveResource::Base.logger
end

#request(event) ⇒ Object


3
4
5
6
7
# File 'activeresource/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