Class: Rack::Logger
- Inherits:
-
Object
- Object
- Rack::Logger
- Defined in:
- lib/rack/logger.rb
Overview
Sets up rack.logger to write to rack.errors stream
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, level = ::Logger::INFO) ⇒ Logger
constructor
A new instance of Logger.
Constructor Details
#initialize(app, level = ::Logger::INFO) ⇒ Logger
Returns a new instance of Logger.
6 7 8 |
# File 'lib/rack/logger.rb', line 6 def initialize(app, level = ::Logger::INFO) @app, @level = app, level end |
Instance Method Details
#call(env) ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/rack/logger.rb', line 10 def call(env) logger = ::Logger.new(env['rack.errors']) logger.level = @level env['rack.logger'] = logger @app.call(env) ensure logger.close end |