Class: Iudex::HTTP::Test::SLogger

Inherits:
Object
  • Object
show all
Includes:
RJack
Defined in:
lib/iudex-http-test/test_app.rb

Overview

Sets up rack.logger to write to rack.errors stream

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app, level = :info) ⇒ SLogger

Returns a new instance of SLogger.



37
38
39
40
41
42
43
44
45
# File 'lib/iudex-http-test/test_app.rb', line 37

def initialize( app, level = :info )
  @app = app
  @logger = SLF4J[ self.class ]
  @level = level

  def @logger.<<( msg )
    send( @level, msg )
  end
end

Class Method Details

.<<(msg) ⇒ Object



42
43
44
# File 'lib/iudex-http-test/test_app.rb', line 42

def @logger.<<( msg )
  send( @level, msg )
end

Instance Method Details

#call(env) ⇒ Object



47
48
49
50
# File 'lib/iudex-http-test/test_app.rb', line 47

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