Use distinct colors for output msg types

Introduce distinct colors per output function.  For elog and eerror
the colors remain the same but the names change.  For einfo and eqawarn,
use darker colors to distinguish them.

Signed-off-by: Michał Górny <mgorny@gentoo.org>
diff --git a/bin/isolated-functions.sh b/bin/isolated-functions.sh
index 3e79ea6..df806d4 100644
--- a/bin/isolated-functions.sh
+++ b/bin/isolated-functions.sh
@@ -270,7 +270,7 @@
 	__elog_base QA "$*"
 	[[ ${RC_ENDCOL} != "yes" && ${LAST_E_CMD} == "ebegin" ]] && echo >&2
 	echo -e "$@" | while read -r ; do
-		echo " ${PORTAGE_COLOR_WARN}*${PORTAGE_COLOR_NORMAL} ${REPLY}" >&2
+		echo " ${PORTAGE_COLOR_QAWARN}*${PORTAGE_COLOR_NORMAL} ${REPLY}" >&2
 	done
 	LAST_E_CMD="eqawarn"
 	return 0
@@ -280,7 +280,7 @@
 	__elog_base LOG "$*"
 	[[ ${RC_ENDCOL} != "yes" && ${LAST_E_CMD} == "ebegin" ]] && echo >&2
 	echo -e "$@" | while read -r ; do
-		echo " ${PORTAGE_COLOR_GOOD}*${PORTAGE_COLOR_NORMAL} ${REPLY}" >&2
+		echo " ${PORTAGE_COLOR_LOG}*${PORTAGE_COLOR_NORMAL} ${REPLY}" >&2
 	done
 	LAST_E_CMD="elog"
 	return 0
@@ -290,7 +290,7 @@
 	__elog_base INFO "$*"
 	[[ ${RC_ENDCOL} != "yes" && ${LAST_E_CMD} == "ebegin" ]] && echo >&2
 	echo -e "$@" | while read -r ; do
-		echo " ${PORTAGE_COLOR_GOOD}*${PORTAGE_COLOR_NORMAL} ${REPLY}" >&2
+		echo " ${PORTAGE_COLOR_INFO}*${PORTAGE_COLOR_NORMAL} ${REPLY}" >&2
 	done
 	LAST_E_CMD="einfo"
 	return 0
@@ -299,7 +299,7 @@
 einfon() {
 	__elog_base INFO "$*"
 	[[ ${RC_ENDCOL} != "yes" && ${LAST_E_CMD} == "ebegin" ]] && echo >&2
-	echo -ne " ${PORTAGE_COLOR_GOOD}*${PORTAGE_COLOR_NORMAL} $*" >&2
+	echo -ne " ${PORTAGE_COLOR_INFO}*${PORTAGE_COLOR_NORMAL} $*" >&2
 	LAST_E_CMD="einfon"
 	return 0
 }
@@ -318,7 +318,7 @@
 	__elog_base ERROR "$*"
 	[[ ${RC_ENDCOL} != "yes" && ${LAST_E_CMD} == "ebegin" ]] && echo >&2
 	echo -e "$@" | while read -r ; do
-		echo " ${PORTAGE_COLOR_BAD}*${PORTAGE_COLOR_NORMAL} ${RC_INDENTATION}${REPLY}" >&2
+		echo " ${PORTAGE_COLOR_ERR}*${PORTAGE_COLOR_NORMAL} ${RC_INDENTATION}${REPLY}" >&2
 	done
 	LAST_E_CMD="eerror"
 	return 0
@@ -378,12 +378,16 @@
 	COLS=80
 	ENDCOL=
 
-	PORTAGE_COLOR_GOOD=
-	PORTAGE_COLOR_WARN=
 	PORTAGE_COLOR_BAD=
-	PORTAGE_COLOR_HILITE=
-	PORTAGE_COLOR_NORMAL=
 	PORTAGE_COLOR_BRACKET=
+	PORTAGE_COLOR_ERR=
+	PORTAGE_COLOR_GOOD=
+	PORTAGE_COLOR_HILITE=
+	PORTAGE_COLOR_INFO=
+	PORTAGE_COLOR_LOG=
+	PORTAGE_COLOR_NORMAL=
+	PORTAGE_COLOR_QAWARN=
+	PORTAGE_COLOR_WARN=
 }
 
 __set_colors() {
@@ -403,12 +407,16 @@
 	if [ -n "${PORTAGE_COLORMAP}" ] ; then
 		eval ${PORTAGE_COLORMAP}
 	else
-		PORTAGE_COLOR_GOOD=$'\e[32;01m'
-		PORTAGE_COLOR_WARN=$'\e[33;01m'
 		PORTAGE_COLOR_BAD=$'\e[31;01m'
-		PORTAGE_COLOR_HILITE=$'\e[36;01m'
 		PORTAGE_COLOR_BRACKET=$'\e[34;01m'
+		PORTAGE_COLOR_ERR=$'\e[31;01m'
+		PORTAGE_COLOR_GOOD=$'\e[32;01m'
+		PORTAGE_COLOR_HILITE=$'\e[36;01m'
+		PORTAGE_COLOR_INFO=$'\e[32m'
+		PORTAGE_COLOR_LOG=$'\e[32;01m'
 		PORTAGE_COLOR_NORMAL=$'\e[0m'
+		PORTAGE_COLOR_QAWARN=$'\e[33m'
+		PORTAGE_COLOR_WARN=$'\e[33;01m'
 	fi
 }
 
diff --git a/bin/save-ebuild-env.sh b/bin/save-ebuild-env.sh
index 8d2ec67..9880881 100644
--- a/bin/save-ebuild-env.sh
+++ b/bin/save-ebuild-env.sh
@@ -102,8 +102,10 @@
 		LAST_E_CMD LAST_E_LEN LD_PRELOAD MISC_FUNCTIONS_ARGS MOPREFIX \
 		NOCOLOR PKGDIR PKGUSE PKG_LOGDIR PKG_TMPDIR \
 		PORTAGE_BASHRC_FILES PORTAGE_BASHRCS_SOURCED \
-		PORTAGE_COLOR_BAD PORTAGE_COLOR_BRACKET PORTAGE_COLOR_GOOD \
-		PORTAGE_COLOR_HILITE PORTAGE_COLOR_NORMAL PORTAGE_COLOR_WARN \
+		PORTAGE_COLOR_BAD PORTAGE_COLOR_BRACKET PORTAGE_COLOR_ERR \
+		PORTAGE_COLOR_GOOD PORTAGE_COLOR_HILITE PORTAGE_COLOR_INFO \
+		PORTAGE_COLOR_LOG PORTAGE_COLOR_NORMAL PORTAGE_COLOR_QAWARN \
+		PORTAGE_COLOR_WARN \
 		PORTAGE_COMPRESS PORTAGE_COMPRESS_EXCLUDE_SUFFIXES \
 		PORTAGE_DOHTML_UNWARNED_SKIPPED_EXTENSIONS \
 		PORTAGE_DOHTML_UNWARNED_SKIPPED_FILES \
diff --git a/lib/portage/elog/messages.py b/lib/portage/elog/messages.py
index 923e10b..6a67a45 100644
--- a/lib/portage/elog/messages.py
+++ b/lib/portage/elog/messages.py
@@ -125,7 +125,7 @@
         out = sys.stdout
 
     if color is None:
-        color = "GOOD"
+        color = "INFO"
 
     msg = _unicode_decode(msg, encoding=_encodings["content"], errors="replace")
 
@@ -183,11 +183,11 @@
 
 # creating and exporting the actual messaging functions
 _functions = {
-    "einfo": ("INFO", "GOOD"),
-    "elog": ("LOG", "GOOD"),
+    "einfo": ("INFO", "INFO"),
+    "elog": ("LOG", "LOG"),
     "ewarn": ("WARN", "WARN"),
-    "eqawarn": ("QA", "WARN"),
-    "eerror": ("ERROR", "BAD"),
+    "eqawarn": ("QA", "QAWARN"),
+    "eerror": ("ERROR", "ERR"),
 }
 
 
diff --git a/lib/portage/elog/mod_echo.py b/lib/portage/elog/mod_echo.py
index fa9203c..a639399 100644
--- a/lib/portage/elog/mod_echo.py
+++ b/lib/portage/elog/mod_echo.py
@@ -60,10 +60,10 @@
             for msgtype, msgcontent in logentries[phase]:
                 fmap = {
                     "INFO": printer.einfo,
+                    "LOG": printer.elog,
                     "WARN": printer.ewarn,
                     "ERROR": printer.eerror,
-                    "LOG": printer.einfo,
-                    "QA": printer.ewarn,
+                    "QA": printer.eqawarn,
                 }
                 if isinstance(msgcontent, str):
                     msgcontent = [msgcontent]
diff --git a/lib/portage/output.py b/lib/portage/output.py
index 9d8601b..42f487f 100644
--- a/lib/portage/output.py
+++ b/lib/portage/output.py
@@ -140,12 +140,16 @@
 
 
 # Colors from /etc/init.d/functions.sh
-_styles["NORMAL"] = ("normal",)
-_styles["GOOD"] = ("green",)
-_styles["WARN"] = ("yellow",)
 _styles["BAD"] = ("red",)
-_styles["HILITE"] = ("teal",)
 _styles["BRACKET"] = ("blue",)
+_styles["ERR"] = ("red",)
+_styles["GOOD"] = ("green",)
+_styles["HILITE"] = ("teal",)
+_styles["INFO"] = ("darkgreen",)
+_styles["LOG"] = ("green",)
+_styles["NORMAL"] = ("normal",)
+_styles["QAWARN"] = ("brown",)
+_styles["WARN"] = ("yellow",)
 
 # Portage functions
 _styles["INFORM"] = ("darkgreen",)
@@ -377,7 +381,18 @@
 
 def colormap():
     mycolors = []
-    for c in ("GOOD", "WARN", "BAD", "HILITE", "BRACKET", "NORMAL"):
+    for c in (
+        "BAD",
+        "BRACKET",
+        "ERR",
+        "GOOD",
+        "HILITE",
+        "INFO",
+        "LOG",
+        "NORMAL",
+        "QAWARN",
+        "WARN",
+    ):
         mycolors.append("PORTAGE_COLOR_{}=$'{}'".format(c, style_to_ansi_code(c)))
     return "\n".join(mycolors)
 
@@ -665,7 +680,7 @@
         if not self.quiet:
             if self.__last_e_cmd == "ebegin":
                 self._write(out, "\n")
-            self._write(out, colorize("BAD", " * ") + msg + "\n")
+            self._write(out, colorize("ERR", " * ") + msg + "\n")
         self.__last_e_cmd = "eerror"
 
     def einfo(self, msg):
@@ -679,7 +694,7 @@
         if not self.quiet:
             if self.__last_e_cmd == "ebegin":
                 self._write(out, "\n")
-            self._write(out, colorize("GOOD", " * ") + msg + "\n")
+            self._write(out, colorize("INFO", " * ") + msg + "\n")
         self.__last_e_cmd = "einfo"
 
     def einfon(self, msg):
@@ -693,9 +708,37 @@
         if not self.quiet:
             if self.__last_e_cmd == "ebegin":
                 self._write(out, "\n")
-            self._write(out, colorize("GOOD", " * ") + msg)
+            self._write(out, colorize("INFO", " * ") + msg)
         self.__last_e_cmd = "einfon"
 
+    def eqawarn(self, msg):
+        """
+        Shows a QA warning.
+
+        @param msg: A very brief (shorter than one line) warning message.
+        @type msg: StringType
+        """
+        out = sys.stderr
+        if not self.quiet:
+            if self.__last_e_cmd == "ebegin":
+                self._write(out, "\n")
+            self._write(out, colorize("QAWARN", " * ") + msg + "\n")
+        self.__last_e_cmd = "ewarn"
+
+    def elog(self, msg):
+        """
+        Shows a logged informative message terminated with a newline.
+
+        @param msg: A very brief (shorter than one line) informative message.
+        @type msg: StringType
+        """
+        out = sys.stdout
+        if not self.quiet:
+            if self.__last_e_cmd == "ebegin":
+                self._write(out, "\n")
+            self._write(out, colorize("LOG", " * ") + msg + "\n")
+        self.__last_e_cmd = "elog"
+
     def ewarn(self, msg):
         """
         Shows a warning message.