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



29
30
31
32
33
34
35
36
37
# File 'lib/benchmark/http/command/spider.rb', line 29

def log(method, url, response)
  Console.logger.public_send(response.failure? ? :warn : :info, self) 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