Skip to content

Instantly share code, notes, and snippets.

@bmarini
Created December 26, 2010 22:45
Show Gist options
  • Save bmarini/755696 to your computer and use it in GitHub Desktop.
Save bmarini/755696 to your computer and use it in GitHub Desktop.
a more verbose log subscriber for active resource 3.0
# Create our own log subscriber that logs a little more
class VerboseLogSubscriber < ActiveSupport::LogSubscriber
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]
info result.body
end
end
VerboseLogSubscriber.attach_to :active_resource
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment