Class: Padrino::Logger::Rack
- Defined in:
- padrino-core/lib/padrino-core/logger.rb
Overview
Padrino::Logger::Rack 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.
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, uri_root) ⇒ Rack
constructor
A new instance of Rack.
Constructor Details
#initialize(app, uri_root) ⇒ Rack
Returns a new instance of Rack.
495 496 497 498 |
# File 'padrino-core/lib/padrino-core/logger.rb', line 495 def initialize(app, uri_root) @app = app @uri_root = uri_root.chomp('/') end |
Instance Method Details
#call(env) ⇒ Object
500 501 502 503 504 505 506 |
# File 'padrino-core/lib/padrino-core/logger.rb', line 500 def call(env) env['rack.logger'] = Padrino.logger began_at = Time.now status, header, body = @app.call(env) log(env, status, header, began_at) if logger.debug? [status, header, body] end |