Class: RestClient::Request

Inherits:
Object
  • Object
show all
Defined in:
lib/morpheus/ext/rest_client.rb

Instance Method Summary collapse

Instance Method Details

#log_requestObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/morpheus/ext/rest_client.rb', line 8

def log_request
  begin
    return unless RestClient.log
    out = []
    # out << "RestClient.#{method} #{redacted_url.inspect}"
    out << "#{method.to_s.upcase} #{redacted_url.inspect}"
    out << payload.short_inspect if payload
    out << processed_headers.to_a.sort.map { |(k, v)| [k.inspect, v.inspect].join("=>") }.join(", ")
    RestClient.log << out.join(', ') + "\n"
  rescue => ex
    # something went wrong, wrong gem version maybe...above is from rest-client 2.0.2
    # do it the old way
    super
  end
end