Sha256: d611236d528d5d762f703338e959ee71e200d478bb625e1417c63c613d3ed7c5
Contents?: true
Size: 815 Bytes
Versions: 1
Compression:
Stored size: 815 Bytes
Contents
module Alula class CommonLogger # Common Log Format: http://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} % FORMAT = %{[%s] %s %s\n} def initialize(app, logger=nil) @app = app @logger = logger end def call(env) status, header, body = @app.call(env) header = Rack::Utils::HeaderHash.new(header) body = Rack::BodyProxy.new(body) { log(env, status, header) } [status, header, body] end private def log(env, status, header) logger = @logger || env['rack.errors'] logger.write FORMAT % [ env["REMOTE_ADDR"], env["REQUEST_METHOD"], Rack::Utils.unescape(env["PATH_INFO"])] end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
alula-0.4.0b | lib/alula/support/commonlogger.rb |