diff options
Diffstat (limited to 'activeresource/lib/active_resource/connection.rb')
-rw-r--r-- | activeresource/lib/active_resource/connection.rb | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/activeresource/lib/active_resource/connection.rb b/activeresource/lib/active_resource/connection.rb index 193be89a82..2f0ccd7dae 100644 --- a/activeresource/lib/active_resource/connection.rb +++ b/activeresource/lib/active_resource/connection.rb @@ -103,14 +103,14 @@ module ActiveResource with_auth { request(:head, path, build_request_headers(headers, :head, self.site.merge(path))) } end - private # Makes a request to the remote service. def request(method, path, *arguments) - logger.info "#{method.to_s.upcase} #{site.scheme}://#{site.host}:#{site.port}#{path}" if logger - result = nil - ms = Benchmark.ms { result = http.send(method, path, *arguments) } - logger.info "--> %d %s (%d %.0fms)" % [result.code, result.message, result.body ? result.body.length : 0, ms] if logger + result = ActiveSupport::Notifications.instrument("active_resource.request") do |payload| + payload[:method] = method + payload[:request_uri] = "#{site.scheme}://#{site.host}:#{site.port}#{path}" + payload[:result] = http.send(method, path, *arguments) + end handle_response(result) rescue Timeout::Error => e raise TimeoutError.new(e.message) @@ -274,10 +274,6 @@ module ActiveResource {HTTP_FORMAT_HEADER_NAMES[http_method] => format.mime_type} end - def logger #:nodoc: - Base.logger - end - def legitimize_auth_type(auth_type) return :basic if auth_type.nil? auth_type = auth_type.to_sym |