lib/napa/middleware/logger.rb in napa-0.2.1 vs lib/napa/middleware/logger.rb in napa-0.3.0
- old
+ new
@@ -32,17 +32,18 @@
rescue
# do nothing, params is already set
end
request_data = {
- method: env['REQUEST_METHOD'],
- path: env['PATH_INFO'],
- query: env['QUERY_STRING'],
+ method: request.request_method,
+ path: request.path_info,
+ query: request.query_string,
host: Napa::Identity.hostname,
pid: Napa::Identity.pid,
revision: Napa::Identity.revision,
- params: params
+ params: params,
+ remote_ip: request.ip
}
request_data[:user_id] = current_user.try(:id) if defined?(current_user)
{ request: request_data }
end
@@ -52,16 +53,10 @@
response_body = body.respond_to?(:body) ? body.body.map { |r| r } : nil
rescue
response_body = body.inspect
end
- { response:
- {
- status: status,
- headers: headers,
- response: response_body
- }
- }
+ Napa::Logger.response(status, headers, response_body)
end
end
end
end