class Deas::VerboseLogging

Constants

RESPONSE_STATUS_NAMES

Public Instance Methods

call!(env) click to toggle source

This the real Rack call interface. It adds logging before and after super-ing to the common logging behavior.

Calls superclass method Deas::BaseLogging#call!
# File lib/deas/logging.rb, line 74
def call!(env)
  log "===== Received request ====="
  Rack::Request.new(env).tap do |request|
    log "  Method:  #{request.request_method.inspect}"
    log "  Path:    #{request.path.inspect}"
  end
  env['deas.logging'] = Proc.new{ |msg| log(msg) }
  status, headers, body = super(env)
  log "  Redir:   #{headers['Location']}" if headers.key?('Location')
  log "===== Completed in #{env['deas.time_taken']}ms (#{response_display(status)}) ====="
  [status, headers, body]
end
response_display(status) click to toggle source
# File lib/deas/logging.rb, line 87
def response_display(status)
  [status, RESPONSE_STATUS_NAMES[status.to_i]].compact.join(', ')
end