Created
September 25, 2019 06:00
-
-
Save mrk21/5cf6e6a21c20109adb9e0119095819d2 to your computer and use it in GitHub Desktop.
How to output logs for Net::HTTP
This file contains hidden or 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
require 'net/http' | |
# @see https://qiita.com/mechamogera/items/d9ea1cf043e976641a23#rails%E3%81%A7%E7%A2%BA%E8%AA%8D%E3%81%99%E3%82%8B%E6%96%B9%E6%B3%95 | |
class Net::HTTP | |
alias :create :initialize | |
def initialize(*args) | |
logger = ActiveSupport::Logger.new(STDOUT) | |
create(*args) | |
self.set_debug_output logger | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment