Use verbose prefixes for output functions einfo, elog... in order to make the message types distinguishable on non-color terminals, and to enable the possibility of grepping them. The prefixes are roughly inspired by Xorg logs, and are:
- `[--]` for einfo (and ebegin) - `[II]` for elog - `[WW]` for ewarn - `[QA]` for eqawarn - `[EE]` for eerror Signed-off-by: Michał Górny <mgo...@gentoo.org> --- bin/isolated-functions.sh | 12 ++++++------ lib/portage/output.py | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/bin/isolated-functions.sh b/bin/isolated-functions.sh index df806d403..c7fda6784 100644 --- a/bin/isolated-functions.sh +++ b/bin/isolated-functions.sh @@ -270,7 +270,7 @@ eqawarn() { __elog_base QA "$*" [[ ${RC_ENDCOL} != "yes" && ${LAST_E_CMD} == "ebegin" ]] && echo >&2 echo -e "$@" | while read -r ; do - echo " ${PORTAGE_COLOR_QAWARN}*${PORTAGE_COLOR_NORMAL} ${REPLY}" >&2 + echo "${PORTAGE_COLOR_QAWARN}[QA]${PORTAGE_COLOR_NORMAL} ${REPLY}" >&2 done LAST_E_CMD="eqawarn" return 0 @@ -280,7 +280,7 @@ elog() { __elog_base LOG "$*" [[ ${RC_ENDCOL} != "yes" && ${LAST_E_CMD} == "ebegin" ]] && echo >&2 echo -e "$@" | while read -r ; do - echo " ${PORTAGE_COLOR_LOG}*${PORTAGE_COLOR_NORMAL} ${REPLY}" >&2 + echo "${PORTAGE_COLOR_LOG}[II]${PORTAGE_COLOR_NORMAL} ${REPLY}" >&2 done LAST_E_CMD="elog" return 0 @@ -290,7 +290,7 @@ einfo() { __elog_base INFO "$*" [[ ${RC_ENDCOL} != "yes" && ${LAST_E_CMD} == "ebegin" ]] && echo >&2 echo -e "$@" | while read -r ; do - echo " ${PORTAGE_COLOR_INFO}*${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 @@ einfo() { einfon() { __elog_base INFO "$*" [[ ${RC_ENDCOL} != "yes" && ${LAST_E_CMD} == "ebegin" ]] && echo >&2 - echo -ne " ${PORTAGE_COLOR_INFO}*${PORTAGE_COLOR_NORMAL} $*" >&2 + echo -ne "${PORTAGE_COLOR_INFO}[--]${PORTAGE_COLOR_NORMAL} $*" >&2 LAST_E_CMD="einfon" return 0 } @@ -308,7 +308,7 @@ ewarn() { __elog_base WARN "$*" [[ ${RC_ENDCOL} != "yes" && ${LAST_E_CMD} == "ebegin" ]] && echo >&2 echo -e "$@" | while read -r ; do - echo " ${PORTAGE_COLOR_WARN}*${PORTAGE_COLOR_NORMAL} ${RC_INDENTATION}${REPLY}" >&2 + echo "${PORTAGE_COLOR_WARN}[WW]${PORTAGE_COLOR_NORMAL} ${RC_INDENTATION}${REPLY}" >&2 done LAST_E_CMD="ewarn" return 0 @@ -318,7 +318,7 @@ eerror() { __elog_base ERROR "$*" [[ ${RC_ENDCOL} != "yes" && ${LAST_E_CMD} == "ebegin" ]] && echo >&2 echo -e "$@" | while read -r ; do - echo " ${PORTAGE_COLOR_ERR}*${PORTAGE_COLOR_NORMAL} ${RC_INDENTATION}${REPLY}" >&2 + echo "${PORTAGE_COLOR_ERR}[EE]${PORTAGE_COLOR_NORMAL} ${RC_INDENTATION}${REPLY}" >&2 done LAST_E_CMD="eerror" return 0 diff --git a/lib/portage/output.py b/lib/portage/output.py index 42f487f8a..deae207fc 100644 --- a/lib/portage/output.py +++ b/lib/portage/output.py @@ -680,7 +680,7 @@ class EOutput: if not self.quiet: if self.__last_e_cmd == "ebegin": self._write(out, "\n") - self._write(out, colorize("ERR", " * ") + msg + "\n") + self._write(out, colorize("ERR", "[EE] ") + msg + "\n") self.__last_e_cmd = "eerror" def einfo(self, msg): @@ -694,7 +694,7 @@ class EOutput: if not self.quiet: if self.__last_e_cmd == "ebegin": self._write(out, "\n") - self._write(out, colorize("INFO", " * ") + msg + "\n") + self._write(out, colorize("INFO", "[--] ") + msg + "\n") self.__last_e_cmd = "einfo" def einfon(self, msg): @@ -708,7 +708,7 @@ class EOutput: if not self.quiet: if self.__last_e_cmd == "ebegin": self._write(out, "\n") - self._write(out, colorize("INFO", " * ") + msg) + self._write(out, colorize("INFO", "[--] ") + msg) self.__last_e_cmd = "einfon" def eqawarn(self, msg): @@ -722,7 +722,7 @@ class EOutput: if not self.quiet: if self.__last_e_cmd == "ebegin": self._write(out, "\n") - self._write(out, colorize("QAWARN", " * ") + msg + "\n") + self._write(out, colorize("QAWARN", "[QA] ") + msg + "\n") self.__last_e_cmd = "ewarn" def elog(self, msg): @@ -736,7 +736,7 @@ class EOutput: if not self.quiet: if self.__last_e_cmd == "ebegin": self._write(out, "\n") - self._write(out, colorize("LOG", " * ") + msg + "\n") + self._write(out, colorize("LOG", "[II] ") + msg + "\n") self.__last_e_cmd = "elog" def ewarn(self, msg): @@ -750,7 +750,7 @@ class EOutput: if not self.quiet: if self.__last_e_cmd == "ebegin": self._write(out, "\n") - self._write(out, colorize("WARN", " * ") + msg + "\n") + self._write(out, colorize("WARN", "[WW] ") + msg + "\n") self.__last_e_cmd = "ewarn" def ewend(self, errno, *msg): -- 2.33.0