Class: Benchmark::HTTP::Command::Spider

Inherits:
Samovar::Command
  • Object
show all
Includes:
Async::Await
Defined in:
lib/benchmark/http/command/spider.rb

Instance Method Summary collapse

Instance Method Details

#log(method, url, response) ⇒ Object



43
44
45
46
47
48
49
50
51
# File 'lib/benchmark/http/command/spider.rb', line 43

def log(method, url, response)
	Async.logger.call(self, severity: (response.failure? ? :warn : :info)) do |buffer|
		buffer.puts "#{method} #{url} -> #{response.version} #{response.status} (#{response.body&.length || 'unspecified'} bytes)"
		
		response.headers.each do |key, value|
			buffer.puts "\t#{key}: #{value}"
		end if @options[:headers]
	end
end