Class: Racknga::LogEntry

Inherits:
Object
  • Object
show all
Defined in:
lib/racknga/nginx_access_log_parser.rb

Constant Summary collapse

ATTRIBUTES =
[
  :remote_address,
  :remote_user,
  :time_local,
  :runtime,
  :request_time,
  :request,
  :status,
  :body_bytes_sent,
  :http_referer,
  :http_user_agent,
]

Instance Method Summary collapse

Constructor Details

#initialize(options = nil) ⇒ LogEntry

Returns a new instance of LogEntry.



115
116
117
118
119
120
121
122
123
124
125
126
127
# File 'lib/racknga/nginx_access_log_parser.rb', line 115

def initialize(options=nil)
  options ||= {}
  @remote_address = options[:remote_address]
  @remote_user = options[:remote_user]
  @time_local = options[:time_local] || Time.at(0)
  @runtime = options[:runtime] || 0.0
  @request_time = options[:request_time] || 0.0
  @request = options[:request]
  @status = options[:status]
  @body_bytes_sent = options[:body_bytes_sent]
  @http_referer = options[:http_referer]
  @http_user_agent = options[:http_user_agent]
end

Instance Method Details

#==(other) ⇒ Object



135
136
137
# File 'lib/racknga/nginx_access_log_parser.rb', line 135

def ==(other)
  attributes == other.attributes
end

#attributesObject



129
130
131
132
133
# File 'lib/racknga/nginx_access_log_parser.rb', line 129

def attributes
  ATTRIBUTES.collect do |attribute|
    __send__(attribute)
  end
end