Class: Rack::Ougai::Logger

Inherits:
Object
  • Object
show all
Defined in:
lib/rack/ougai/logger.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, level = ::Logger::INFO) ⇒ Logger

Returns a new instance of Logger.



6
7
8
9
# File 'lib/rack/ougai/logger.rb', line 6

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

Instance Method Details

#call(env) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/rack/ougai/logger.rb', line 11

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

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