Class: LogMe::HttpFormatter

Inherits:
Object
  • Object
show all
Defined in:
lib/logme/http_formatter.rb

Instance Method Summary collapse

Instance Method Details

#format_request(request, url) ⇒ Object



4
5
6
7
8
9
# File 'lib/logme/http_formatter.rb', line 4

def format_request(request, url)
  message = format_message(request) do
    message =  with_line_break { 'Request:' }
    message << with_line_break { "#{request.method.to_s.upcase} #{url}" }
  end
end

#format_response(response) ⇒ Object



11
12
13
14
15
16
# File 'lib/logme/http_formatter.rb', line 11

def format_response(response)
  message = format_message(response) do
    message =  with_line_break { 'Response:' }
    message << with_line_break { "HTTP/#{response.http_version} #{response.code} #{response.message}" }
  end
end