diff options
author | José Valim <jose.valim@gmail.com> | 2010-01-13 22:59:27 +0100 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-01-14 01:07:03 +0100 |
commit | 116df09c3e4a57a6b0a57a5134c451687113ece1 (patch) | |
tree | 066f99faac94657761377003516e64e7a6f926ac /activeresource/lib/active_resource/railties/subscriber.rb | |
parent | 7c3573f32757e9c4c6b6140499a3e7dfe2d335b1 (diff) | |
download | rails-116df09c3e4a57a6b0a57a5134c451687113ece1.tar.gz rails-116df09c3e4a57a6b0a57a5134c451687113ece1.tar.bz2 rails-116df09c3e4a57a6b0a57a5134c451687113ece1.zip |
Add notifications to ActiveResource.
Diffstat (limited to 'activeresource/lib/active_resource/railties/subscriber.rb')
-rw-r--r-- | activeresource/lib/active_resource/railties/subscriber.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/activeresource/lib/active_resource/railties/subscriber.rb b/activeresource/lib/active_resource/railties/subscriber.rb new file mode 100644 index 0000000000..42c108d702 --- /dev/null +++ b/activeresource/lib/active_resource/railties/subscriber.rb @@ -0,0 +1,15 @@ +module ActiveResource + module Railties + class Subscriber < Rails::Subscriber + def request(event) + result, site = event.payload[:result], event.payload[:site] + info "#{event.payload[:method].to_s.upcase} #{site.scheme}://#{site.host}:#{site.port}#{event.payload[:path]}" + info "--> %d %s %d (%.1fms)" % [result.code, result.message, result.body.to_s.length, event.duration] + end + + def logger + ActiveResource::Base.logger + end + end + end +end
\ No newline at end of file |