Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
tree: 013c543331
Fetching contributors…

Cannot retrieve contributors at this time

31 lines (20 sloc) 0.627 kB
class LoggedRequest
def initialize(app)
@app = app
end
def call(env)
request = Rack::Cache::Request.new(env)
resp = nil
Logger.current.buffer do
Logger.current.info "#{request.request_method} #{request.path} [#{request.ip}]"
secs = Benchmark.realtime do
Logger.current.intend do
resp = @app.call(env)
end
end
Logger.current.info((resp[0] < 399 ? 'Success' : "Error [#{resp[0]}]") + " after %.3fs Cache: %s" % [secs, resp[1]['X-Rack-Cache']])
Logger.current.info ''
end
resp
end
end
Jump to Line
Something went wrong with that request. Please try again.