def call(env)
      began_at = Time.now
      began_ns = Process.clock_gettime(Process::CLOCK_MONOTONIC, :nanosecond)

      # this is closed after the app is called, so read it before 
      env["rack.input"].rewind
      request_body = env["rack.input"].read
      env["rack.input"].rewind

      if @logger && @logger.formatter.respond_to?(:current_tags)
        log_tags = @logger.formatter.current_tags.dup
      end

      request = Rack::Request.new(env)
      request_uri = Addressable::URI.new(
        :scheme => request.scheme,
        :host => request.host,
        :port => request.port,
        :path => request.path,
        :query => (request.query_string unless request.query_string.empty?)
      )

      status, response_headers, response_body = @app.call(env)
      response_headers = ::Rack::Utils::HeaderHash.new(response_headers)
      body_proxy = ::Rack::BodyProxy.new(response_body) do
        log(env, request_uri, request_body, status, response_headers, response_body, began_at, began_ns, log_tags)
      end
      [status, response_headers, body_proxy]
    end
def call(env)
      began_at = Time.now
      began_ns = Process.clock_gettime(Process::CLOCK_MONOTONIC, :nanosecond)

      # this is closed after the app is called, so read it before 
      env["rack.input"].rewind
      request_body = env["rack.input"].read
      env["rack.input"].rewind

      if @logger && @logger.formatter.respond_to?(:current_tags)
        log_tags = @logger.formatter.current_tags.dup
      end

      request = Rack::Request.new(env)
      request_uri = Addressable::URI.new(
        :scheme => request.scheme,
        :host => request.host,
        :port => request.port,
        :path => request.path,
        :query => (request.query_string unless request.query_string.empty?)
      )

      status, response_headers, response_body = @app.call(env)
      response_headers = ::Rack::Utils::HeaderHash.new(response_headers)
      body_proxy = ::Rack::BodyProxy.new(response_body) do
        log(env, request_uri, request_body, status, response_headers, response_body, began_at, began_ns, log_tags)
      end
      [status, response_headers, body_proxy]
    end
options
 - :logger
 - :filter_keys - array of keys to filter from logged bodies
 - :log_bodies - true, false, :on_error