Class: Rack::SimpleLogger

Inherits:
Object
  • Object
show all
Defined in:
lib/rack/simple_logger.rb,
lib/rack/simple_logger/version.rb

Constant Summary collapse

VERSION =
"0.0.1"

Instance Method Summary collapse

Constructor Details

#initialize(app, options = {}) ⇒ SimpleLogger



10
11
12
13
14
# File 'lib/rack/simple_logger.rb', line 10

def initialize(app, options={})
  options[:log] ||= STDOUT
  @logger = LogProxy.new(options[:log])
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



16
17
18
19
20
21
# File 'lib/rack/simple_logger.rb', line 16

def call(env)
  began_at = Time.now
  status, header, body = @app.call(env)
  log(env, status, header, began_at)
  [status, header, body]
end