Class: Alula::CommonLogger
- Inherits:
-
Object
- Object
- Alula::CommonLogger
- Defined in:
- lib/alula/support/commonlogger.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, logger = nil) ⇒ CommonLogger
constructor
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” %d %sn % FORMAT = %%s %sn.
Constructor Details
#initialize(app, logger = nil) ⇒ CommonLogger
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} %
FORMAT = %%s %sn
8 9 10 11 |
# File 'lib/alula/support/commonlogger.rb', line 8 def initialize(app, logger=nil) @app = app @logger = logger end |
Instance Method Details
#call(env) ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/alula/support/commonlogger.rb', line 13 def call(env) request_start = Time.now status, header, body = @app.call(env) header = Rack::Utils::HeaderHash.new(header) env["REQUEST_TIME"] = (Time.now - request_start) * 1000.0 body = Rack::BodyProxy.new(body) { log(env, status, header) } [status, header, body] end |