Property definitions

popcorn $ PopLogger :: defaultinit
# Display log info about request processing.
class PopLogger
	super Logger
	super Handler

	# Do we want colors in the console output?
	var no_color = false is optional

	redef var default_formatter = new PopFormatter(no_color) is optional

	redef fun all(req, res) do
		var clock = req.clock
		if clock != null then
			add_raw(info_level, "{req.method} {req.url} {status(res)} ({clock.total}s)")
		else
			add_raw(info_level, "{req.method} {req.url} {status(res)}")
		end
	end

	# Colorize the request status.
	private fun status(res: HttpResponse): String do
		if no_color then return res.status_code.to_s
		return res.color_status
	end
end
lib/popcorn/pop_logging.nit:32,1--56,3