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



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

def log(method, url, response)
  Console.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