Class: Rack::Ougai::ConstantLogger

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

Instance Method Summary collapse

Constructor Details

#initialize(app, logger) ⇒ ConstantLogger

Returns a new instance of ConstantLogger.



6
7
8
9
10
11
# File 'lib/rack/ougai/constant_logger.rb', line 6

def initialize(app, logger)
  raise "logger must be an Ougai::Logging (got: #{logger.class.name})." unless logger.is_a?(::Ougai::Logging)

  @app = app
  @logger = logger
end

Instance Method Details

#call(env) ⇒ Object



13
14
15
16
# File 'lib/rack/ougai/constant_logger.rb', line 13

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