Property definitions

popcorn $ PopFormatter :: defaultinit
class PopFormatter
	super Formatter

	# Do not decorate messages with colors
	var no_color = false is optional, writable

	redef fun format(level, message) do
		var string = message.write_to_string

		if level == fatal_level then
			string = "[FATAL] {string}"
		else if level == error_level then
			string = "[ERROR] {string}"
		else if level == warn_level then
			string = "[WARN] {string}"
		else if level == info_level then
			string = "[INFO] {string}"
		else if level == debug_level then
			string = "[DEBUG] {string}"
		end

		if no_color then return string

		if level == fatal_level then
			return string.red
		else if level == error_level then
			return string.red
		else if level == warn_level then
			return string.yellow
		else if level == info_level then
			return string.blue
		else if level == debug_level then
			return string.gray
		end

		return string
	end
end
lib/popcorn/pop_logging.nit:58,1--95,3