Method: Rack::CommonLogger#call

Defined in:
lib/rack/common_logger.rb

#call(env) ⇒ Object

Log all requests in common_log format after a response has been returned. Note that if the app raises an exception, the request will not be logged, so if exception handling middleware are used, they should be loaded after this middleware. Additionally, because the logging happens after the request body has been fully sent, any exceptions raised during the sending of the response body will cause the request not to be logged.



41
42
43
44
45
46
47
# File 'lib/rack/common_logger.rb', line 41

def call(env)
  began_at = Utils.clock_time
  status, headers, body = response = @app.call(env)

  response[2] = BodyProxy.new(body) { log(env, status, headers, began_at) }
  response
end