Method: CloudControl::Connection#log_response

Defined in:
lib/cloudcontrol/connection.rb

#log_response(request, response) ⇒ Object



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/cloudcontrol/connection.rb', line 41

def log_response(request, response)
  if response.success?
    log "...........success!", :yellow
  elsif response.timed_out?
    log_error "ERROR\n-----", :red
    log_error "got a time out"
  elsif response.code == 0
    # Could not get an http response, something's wrong.
    log_error "ERROR\n-----", :red
    log_error response.return_message
  else
    # Received a non-successful http response.
    log_error "ERROR\n-----", :red
    log_error "HTTP request failed: " + response.code.to_s, :red
    log_error response.body, :yellow
  end
end