Skip to content

Instantly share code, notes, and snippets.

@lowang
Created October 13, 2015 10:33
Show Gist options
  • Save lowang/899b002666987b40a4e0 to your computer and use it in GitHub Desktop.
Save lowang/899b002666987b40a4e0 to your computer and use it in GitHub Desktop.
class MySanitizedLogger
def initialize(logger)
@logger = logger
end
def <<(message)
@logger << message.gsub(/password=[^&? "']+/,'password=REDACTED')
end
end
RestClient.log = MySanitizedLogger.new(Logger.new(STDOUT))
RestClient.get "http://api.nokaut.pl/loguj?password=ala"
# RestClient.get "http://api.nokaut.pl/loguj?password=REDACTED", "Accept"=>"*/*; q=0.5, application/xml", "Accept-Encoding"=>"gzip, deflate"
# # => 200 OK | text/xml 126 bytes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment