class Rack::SimpleLogger

Constants

VERSION

Public Class Methods

new(app, options={}) click to toggle source
# File lib/rack/simple_logger.rb, line 11
def initialize(app, options={})
  options[:log] ||= STDOUT
  @logger = LogProxy.new(options[:log])
  @filter = options[:filter] || LogFilter.new
  @app = app
end

Public Instance Methods

call(env) click to toggle source
# File lib/rack/simple_logger.rb, line 18
def call(env)
  began_at = Time.now
  status, header, body = @app.call(env)
  log(@filter.pass(env, status, header, began_at))
  [status, header, body]
end

Private Instance Methods

log(log_hash) click to toggle source
# File lib/rack/simple_logger.rb, line 26
def log(log_hash)
  @logger.write(log_hash)
end