Class: Transport::HTTP::Formatter

Inherits:
Object
  • Object
show all
Defined in:
lib/transport/http/formatter.rb

Overview

Formatter for the http request and response objects. Used for log output.

Defined Under Namespace

Classes: Request, Response

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(logger) ⇒ Formatter

Returns a new instance of Formatter.



62
63
64
# File 'lib/transport/http/formatter.rb', line 62

def initialize(logger)
  @logger = logger
end

Instance Attribute Details

#loggerObject (readonly)

Returns the value of attribute logger.



60
61
62
# File 'lib/transport/http/formatter.rb', line 60

def logger
  @logger
end

Instance Method Details

#log_transport(uri, request, response) ⇒ Object



66
67
68
# File 'lib/transport/http/formatter.rb', line 66

def log_transport(uri, request, response)
  log Request.new(uri, request).message + "\n" + Response.new(response).message
end