123456789_123456789_123456789_123456789_123456789_

Class: Sinatra::Middleware::Logger

Relationships & Source Files
Inherits: Object
Defined in: lib/sinatra/middleware/logger.rb

Class Method Summary

Instance Method Summary

Constructor Details

.new(app, level = ::Logger::INFO) ⇒ Logger

[ GitHub ]

  
# File 'lib/sinatra/middleware/logger.rb', line 8

def initialize(app, level = ::Logger::INFO)
  @app, @level = app, level
end

Instance Method Details

#call(env)

[ GitHub ]

  
# File 'lib/sinatra/middleware/logger.rb', line 12

def call(env)
  logger = ::Logger.new(env[Rack::RACK_ERRORS])
  logger.level = @level

  env[Rack::RACK_LOGGER] = logger
  @app.call(env)
end