Rack::CommonLogger forwards every request
to an app
given, and logs a line in the Apache common log
format to the logger
, or rack.errors by default.
Common Log Format: httpd.apache.org/docs/1.3/logs.html#common lilith.local - - [07/Aug/2006 23:58:02] “GET / HTTP/1.1” 500 -
%{%s - %s [%s] "%s %s%s %s" %d %s\n} %
# File lib/rack/commonlogger.rb, line 11 def initialize(app, logger=nil) @app = app @logger = logger end
# File lib/rack/commonlogger.rb, line 16 def call(env) began_at = Time.now status, header, body = @app.call(env) header = Utils::HeaderHash.new(header) log(env, status, header, began_at) [status, header, body] end