Created
December 26, 2010 22:45
-
-
Save bmarini/755696 to your computer and use it in GitHub Desktop.
a more verbose log subscriber for active resource 3.0
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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