2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
# File 'lib/rest_client/core_ext/logged_request.rb', line 2
def logged_request(opts = {}, &block)
started = Time.now
log_request(opts, started)
response, exception = nil, nil
response = execute(opts, &block)
rescue StandardError => ex
exception = ex.class.to_s
response = ex.respond_to?(:response) ? ex.response : nil
raise ex ensure
logged_response = opts.merge(exception: exception, response: response)
ActiveSupport::Notifications.instrument(
RestClient::Jogger.response_pattern,
log_payload(logged_response, started)
)
end
|