Class: HttpLoggerForRails

Inherits:
Object
  • Object
show all
Defined in:
lib/resurfaceio/http_logger_for_rails.rb

Direct Known Subclasses

Resurfaceio::HttpLoggerForRails

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ HttpLoggerForRails

Returns a new instance of HttpLoggerForRails.



10
11
12
# File 'lib/resurfaceio/http_logger_for_rails.rb', line 10

def initialize(options = {})
  @logger = HttpLogger.new(options)
end

Instance Method Details

#around(controller) ⇒ Object



18
19
20
21
22
23
24
25
26
# File 'lib/resurfaceio/http_logger_for_rails.rb', line 18

def around(controller)
  timer = Timer.new
  yield
  if @logger.enabled?
    request = controller.request
    response = controller.response
    HttpMessage.send(logger, request, response, nil, nil, nil, timer.millis)
  end
end

#loggerObject



14
15
16
# File 'lib/resurfaceio/http_logger_for_rails.rb', line 14

def logger
  @logger
end