Skip to content

Instantly share code, notes, and snippets.

@nfo
Created November 4, 2010 19:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nfo/662986 to your computer and use it in GitHub Desktop.
Save nfo/662986 to your computer and use it in GitHub Desktop.
Prints all the sent HTTP queries, with the headers and data.
Riak::Client::CurbBackend.class_eval do
private
def perform_with_logs(method, uri, headers, expect, data=nil)
puts "\e[31m#{method.upcase} #{uri}\e[0m"
puts "\t\e[33m#{headers}\e[0m"
# puts "\t\e[36m#{expect}\e[0m"
puts "\t\e[34m#{data}\e[0m" if data
# puts "\t\e[37m#{caller.last}\e[0m"
puts
perform_without_logs(method, uri, headers, expect, data)
end
alias_method_chain :perform, :logs
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment