Permalink
Browse files

Adding logging and debugging example

  • Loading branch information...
1 parent aa4b7c6 commit 172e23df4b39da943524670d3f6052cb52443736 @augustl committed Jan 18, 2010
Showing with 14 additions and 0 deletions.
  1. +14 −0 logging_and_debugging.rb
View
@@ -0,0 +1,14 @@
+require "net/http"
+require "uri"
+
+uri = URI.parse("http://google.com/")
+http = Net::HTTP.new(uri.host, uri.port)
+
+http.set_debug_output($stdout)
+# or
+http.set_debug_output($stderr)
+# or
+require "logger"
+http.set_debug_output(Logger.new("/path/to/my.log"))
+
+response = http.request(Net::HTTP::Get.new(uri.request_uri))

0 comments on commit 172e23d

Please sign in to comment.