diff options
author | Thom May <thom@chef.io> | 2018-03-23 13:05:13 +0000 |
---|---|---|
committer | Tim Smith <tsmith@chef.io> | 2018-03-26 10:34:39 -0700 |
commit | 97c1dd6f1cac6d97e85d05039cad8b28596141ba (patch) | |
tree | d8a97c0f7016986a2cc264aa50ae345638ed026c /lib/chef/http | |
parent | 1b81f35e023bcdc87e410c641545e849298de5c3 (diff) | |
download | chef-97c1dd6f1cac6d97e85d05039cad8b28596141ba.tar.gz |
mechanical conversion of most debug log statements to trace
Signed-off-by: Thom May <thom@chef.io>
Diffstat (limited to 'lib/chef/http')
-rw-r--r-- | lib/chef/http/auth_credentials.rb | 2 | ||||
-rw-r--r-- | lib/chef/http/basic_client.rb | 30 | ||||
-rw-r--r-- | lib/chef/http/decompressor.rb | 12 | ||||
-rw-r--r-- | lib/chef/http/http_request.rb | 6 | ||||
-rw-r--r-- | lib/chef/http/json_output.rb | 4 | ||||
-rw-r--r-- | lib/chef/http/validate_content_length.rb | 10 |
6 files changed, 32 insertions, 32 deletions
diff --git a/lib/chef/http/auth_credentials.rb b/lib/chef/http/auth_credentials.rb index 053b2c938e..e2494c9405 100644 --- a/lib/chef/http/auth_credentials.rb +++ b/lib/chef/http/auth_credentials.rb @@ -38,7 +38,7 @@ class Chef def signature_headers(request_params = {}) raise ArgumentError, "Cannot sign the request without a client name, check that :node_name is assigned" if client_name.nil? - Chef::Log.debug("Signing the request as #{client_name}") + Chef::Log.trace("Signing the request as #{client_name}") # params_in = {:http_method => :GET, :path => "/clients", :body => "", :host => "localhost"} request_params = request_params.dup diff --git a/lib/chef/http/basic_client.rb b/lib/chef/http/basic_client.rb index 1539770aa8..54da722b3d 100644 --- a/lib/chef/http/basic_client.rb +++ b/lib/chef/http/basic_client.rb @@ -60,32 +60,32 @@ class Chef def request(method, url, req_body, base_headers = {}) http_request = HTTPRequest.new(method, url, req_body, base_headers).http_request - Chef::Log.debug("Initiating #{method} to #{url}") - Chef::Log.debug("---- HTTP Request Header Data: ----") + Chef::Log.trace("Initiating #{method} to #{url}") + Chef::Log.trace("---- HTTP Request Header Data: ----") base_headers.each do |name, value| - Chef::Log.debug("#{name}: #{value}") + Chef::Log.trace("#{name}: #{value}") end - Chef::Log.debug("---- End HTTP Request Header Data ----") + Chef::Log.trace("---- End HTTP Request Header Data ----") http_client.request(http_request) do |response| - Chef::Log.debug("---- HTTP Status and Header Data: ----") - Chef::Log.debug("HTTP #{response.http_version} #{response.code} #{response.msg}") + Chef::Log.trace("---- HTTP Status and Header Data: ----") + Chef::Log.trace("HTTP #{response.http_version} #{response.code} #{response.msg}") response.each do |header, value| - Chef::Log.debug("#{header}: #{value}") + Chef::Log.trace("#{header}: #{value}") end - Chef::Log.debug("---- End HTTP Status/Header Data ----") + Chef::Log.trace("---- End HTTP Status/Header Data ----") # For non-400's, log the request and response bodies if !response.code || !response.code.start_with?("2") if response.body - Chef::Log.debug("---- HTTP Response Body ----") - Chef::Log.debug(response.body) - Chef::Log.debug("---- End HTTP Response Body -----") + Chef::Log.trace("---- HTTP Response Body ----") + Chef::Log.trace(response.body) + Chef::Log.trace("---- End HTTP Response Body -----") end if req_body - Chef::Log.debug("---- HTTP Request Body ----") - Chef::Log.debug(req_body) - Chef::Log.debug("---- End HTTP Request Body ----") + Chef::Log.trace("---- HTTP Request Body ----") + Chef::Log.trace(req_body) + Chef::Log.trace("---- End HTTP Request Body ----") end end @@ -133,7 +133,7 @@ class Chef if proxy_uri.nil? Net::HTTP else - Chef::Log.debug("Using #{proxy_uri.host}:#{proxy_uri.port} for proxy") + Chef::Log.trace("Using #{proxy_uri.host}:#{proxy_uri.port} for proxy") Net::HTTP.Proxy(proxy_uri.host, proxy_uri.port, http_proxy_user(proxy_uri), http_proxy_pass(proxy_uri)) end diff --git a/lib/chef/http/decompressor.rb b/lib/chef/http/decompressor.rb index 1bba4cc492..cf4a4bc593 100644 --- a/lib/chef/http/decompressor.rb +++ b/lib/chef/http/decompressor.rb @@ -79,10 +79,10 @@ class Chef else case response[CONTENT_ENCODING] when GZIP - Chef::Log.debug "Decompressing gzip response" + Chef::Log.trace "Decompressing gzip response" Zlib::Inflate.new(Zlib::MAX_WBITS + 16).inflate(response.body) when DEFLATE - Chef::Log.debug "Decompressing deflate response" + Chef::Log.trace "Decompressing deflate response" Zlib::Inflate.inflate(response.body) else response.body @@ -94,20 +94,20 @@ class Chef # object you can use to unzip/inflate a streaming response. def stream_response_handler(response) if gzip_disabled? - Chef::Log.debug "disable_gzip is set. \ + Chef::Log.trace "disable_gzip is set. \ Not using #{response[CONTENT_ENCODING]} \ and initializing noop stream deflator." NoopInflater.new else case response[CONTENT_ENCODING] when GZIP - Chef::Log.debug "Initializing gzip stream deflator" + Chef::Log.trace "Initializing gzip stream deflator" GzipInflater.new when DEFLATE - Chef::Log.debug "Initializing deflate stream deflator" + Chef::Log.trace "Initializing deflate stream deflator" DeflateInflater.new else - Chef::Log.debug "content_encoding = '#{response[CONTENT_ENCODING]}' \ + Chef::Log.trace "content_encoding = '#{response[CONTENT_ENCODING]}' \ initializing noop stream deflator." NoopInflater.new end diff --git a/lib/chef/http/http_request.rb b/lib/chef/http/http_request.rb index bd999d8f86..de589e429e 100644 --- a/lib/chef/http/http_request.rb +++ b/lib/chef/http/http_request.rb @@ -127,9 +127,9 @@ class Chef # http://redmine.ruby-lang.org/issues/show/2708 # http://redmine.ruby-lang.org/issues/show/2758 if e.to_s =~ /#{Regexp.escape(%q{undefined method `closed?' for nil:NilClass})}/ - Chef::Log.debug("Rescued error in http connect, re-raising as Errno::ECONNREFUSED to hide bug in net/http") - Chef::Log.debug("#{e.class.name}: #{e}") - Chef::Log.debug(e.backtrace.join("\n")) + Chef::Log.trace("Rescued error in http connect, re-raising as Errno::ECONNREFUSED to hide bug in net/http") + Chef::Log.trace("#{e.class.name}: #{e}") + Chef::Log.trace(e.backtrace.join("\n")) raise Errno::ECONNREFUSED, "Connection refused attempting to contact #{url.scheme}://#{host}:#{port}" else raise diff --git a/lib/chef/http/json_output.rb b/lib/chef/http/json_output.rb index dc363cdc54..25f1380ceb 100644 --- a/lib/chef/http/json_output.rb +++ b/lib/chef/http/json_output.rb @@ -60,9 +60,9 @@ class Chef end [http_response, rest_request, return_value] else - Chef::Log.debug("Expected JSON response, but got content-type '#{http_response['content-type']}'") + Chef::Log.trace("Expected JSON response, but got content-type '#{http_response['content-type']}'") if http_response.body - Chef::Log.debug("Response body contains:\n#{http_response.body.length < 256 ? http_response.body : http_response.body[0..256] + " [...truncated...]"}") + Chef::Log.trace("Response body contains:\n#{http_response.body.length < 256 ? http_response.body : http_response.body[0..256] + " [...truncated...]"}") end return [http_response, rest_request, http_response.body.to_s] end diff --git a/lib/chef/http/validate_content_length.rb b/lib/chef/http/validate_content_length.rb index 3a8d3bda2b..c8e8ac53ad 100644 --- a/lib/chef/http/validate_content_length.rb +++ b/lib/chef/http/validate_content_length.rb @@ -55,7 +55,7 @@ class Chef def handle_stream_complete(http_response, rest_request, return_value) if @content_length_counter.nil? - Chef::Log.debug("No content-length information collected for the streamed download, cannot identify streamed download.") + Chef::Log.trace("No content-length information collected for the streamed download, cannot identify streamed download.") else validate(http_response, @content_length_counter.content_length) end @@ -86,19 +86,19 @@ class Chef transfer_encoding = http_response["transfer-encoding"] if content_length.nil? - Chef::Log.debug "HTTP server did not include a Content-Length header in response, cannot identify truncated downloads." + Chef::Log.trace "HTTP server did not include a Content-Length header in response, cannot identify truncated downloads." return true end if content_length < 0 - Chef::Log.debug "HTTP server responded with a negative Content-Length header (#{content_length}), cannot identify truncated downloads." + Chef::Log.trace "HTTP server responded with a negative Content-Length header (#{content_length}), cannot identify truncated downloads." return true end # if Transfer-Encoding is set the RFC states that we must ignore the Content-Length field # CHEF-5041: some proxies uncompress gzip content, leave the incorrect content-length, but set the transfer-encoding field unless transfer_encoding.nil? - Chef::Log.debug "Transfer-Encoding header is set, skipping Content-Length check." + Chef::Log.trace "Transfer-Encoding header is set, skipping Content-Length check." return true end @@ -106,7 +106,7 @@ class Chef raise Chef::Exceptions::ContentLengthMismatch.new(response_length, content_length) end - Chef::Log.debug "Content-Length validated correctly." + Chef::Log.trace "Content-Length validated correctly." true end end |