lib/olaf/log/http_request_logger.rb
def log(env, status, header, began_at)
      now = Time.now
      length = extract_content_length(header)

      data =
      {
          :remote_ip => env['HTTP_X_FORWARDED_FOR'] || env["REMOTE_ADDR"] || "?",
          :remote_user => env["REMOTE_USER"] || "",
          :http_method => env["REQUEST_METHOD"],
          :path => env["PATH_INFO"],
          :query => env["QUERY_STRING"].empty? ? "" : "?"+env["QUERY_STRING"],
          :http_version => env["HTTP_VERSION"],
          :http_status => status.to_s[0..3],
          :content_length => length,
          :duration => now - began_at
      }

      logger = @logger || env['rack.errors']
      #logger.write data
    end
# I just copied logic from CommonLogger
I just copied logic from CommonLogger
I just copied logic from CommonLogger
def log(env, status, header, began_at)
      now = Time.now
      length = extract_content_length(header)
      data =
      {
          :remote_ip => env['HTTP_X_FORWARDED_FOR'] || env["REMOTE_ADDR"] || "?",
          :remote_user => env["REMOTE_USER"] || "",
          :http_method => env["REQUEST_METHOD"],
          :path => env["PATH_INFO"],
          :query => env["QUERY_STRING"].empty? ? "" : "?"+env["QUERY_STRING"],
          :http_version => env["HTTP_VERSION"],
          :http_status => status.to_s[0..3],
          :content_length => length,
          :duration => now - began_at
      }
      logger = @logger || env['rack.errors']
    end
def log ( env , status , header , began_at ) now = Time . now length = extract_content_length ( header ) data = { :remote_ip => env [ 'HTTP_X_FORWARDED_FOR' ] || env [ "REMOTE_ADDR" ] || "?" , :remote_user => env [ "REMOTE_USER" ] || "" , :http_method => env [ "REQUEST_METHOD" ] , :path => env [ "PATH_INFO" ] , :query => env [ "QUERY_STRING" ] . empty? ? "" : "?" + env [ "QUERY_STRING" ] , :http_version => env [ "HTTP_VERSION" ] , :http_status => status . to_s [ 0 .. 3 ] , :content_length => length , :duration => now - began_at } logger = @logger || env [ 'rack.errors' ] end
I just copied logic from CommonLogger
I just copied logic from CommonLogger
#logger.write data
env
status
header
began_at