Sha256: 45192d647273bbb245faa77b5bc4fe4713a70194e46b424718f7852571c77ae3

Contents?: true

Size: 592 Bytes

Versions: 73

Compression:

Stored size: 592 Bytes

Contents

require 'rack/commonlogger'

module Rack
  # Patch CommonLogger to use after_reply.
  #
  # Simply request this file and CommonLogger will be a bit more 
  # efficient.
  class CommonLogger
    remove_method :call

    def call(env)
      began_at = Time.now
      status, header, body = @app.call(env)
      header = Utils::HeaderHash.new(header)

      if ary = env['rack.after_reply']
        ary << lambda { log(env, status, header, began_at) }
      else
        body = BodyProxy.new(body) { log(env, status, header, began_at) }
      end

      [status, header, body]
    end
  end
end

Version data entries

73 entries across 73 versions & 2 rubygems

Version Path
puma-2.0.0.b7-java lib/puma/rack_patch.rb
puma-2.0.0.b7 lib/puma/rack_patch.rb
puma-2.0.0.b6 lib/puma/rack_patch.rb
puma-2.0.0.b5 lib/puma/rack_patch.rb
puma-2.0.0.b4-java lib/puma/rack_patch.rb
puma-2.0.0.b4 lib/puma/rack_patch.rb
puma-2.0.0.b3-java lib/puma/rack_patch.rb
puma-2.0.0.b3 lib/puma/rack_patch.rb
puma-2.0.0.b2-java lib/puma/rack_patch.rb
puma-2.0.0.b2 lib/puma/rack_patch.rb
fragrant-0.0.5 vendor/bundle/ruby/1.9.1/gems/puma-1.6.3/lib/puma/rack_patch.rb
puma-2.0.0.b1-java lib/puma/rack_patch.rb
puma-2.0.0.b1 lib/puma/rack_patch.rb
puma-1.6.3-java lib/puma/rack_patch.rb
puma-1.6.3 lib/puma/rack_patch.rb
puma-1.6.2-java lib/puma/rack_patch.rb
puma-1.6.2 lib/puma/rack_patch.rb
puma-1.6.1-java lib/puma/rack_patch.rb
puma-1.6.1 lib/puma/rack_patch.rb
puma-1.6.0-java lib/puma/rack_patch.rb