Module: LogOverride

Defined in:
lib/right_api_client/client.rb

Overview

This is used to extend a new instance of RestClient::Request and override it’s log_request. Override version keeps email/password from getting into the logs.

Instance Method Summary collapse

Instance Method Details

#log_requestObject



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/right_api_client/client.rb', line 36

def log_request
 if RestClient.log
    out = []
    out << "RestClient.#{method} #{url.inspect}"
    if !payload.nil?
      if (payload.short_inspect.include? "email") || (payload.short_inspect.include? "password")
        out << "<hidden credentials>"
      else
        out <<  payload.short_inspect
      end
    end
    out << processed_headers.to_a.sort.map { |(k, v)| [k.inspect, v.inspect].join("=>") }.join(", ")
    RestClient.log << out.join(', ') + "\n"
  end
end