Property definitions

popcorn $ LogEntry :: defaultinit
# A tracker log entry used to store HTTP requests and their given HTTP responses
class LogEntry
	super RepoObject
	serialize

	# HTTP request that triggered that log entry
	var request: HttpRequest

	# HTTP response returned by the serveur
	var response: HttpResponse

	# Request user-agent shortcut (easier for db requests
	var user_agent: nullable String is lazy do return request.header["User-Agent"]

	# Processing time in miliseconds (or null if no clock was found in request)
	var response_time: nullable Int is lazy do
		var clock = request.clock
		if clock == null then return null
		return (clock.total * 1000.0).to_i
	end

	# Log entry timestamp
	var timestamp: Int = get_time

	# Session ID associated to this entry
	var session: nullable String is lazy do
		var session = request.session
		if session == null then return null
		return session.id_hash
	end
end
lib/popcorn/pop_tracker.nit:202,1--232,3