From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 9CB50158017 for ; Tue, 28 Sep 2021 14:20:20 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id DDD41E08E5; Tue, 28 Sep 2021 14:20:12 +0000 (UTC) Received: from smtp.gentoo.org (dev.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id AFEA9E08E5 for ; Tue, 28 Sep 2021 14:20:12 +0000 (UTC) From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= To: gentoo-portage-dev@lists.gentoo.org Cc: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Subject: [gentoo-portage-dev] [PATCH 3/4] Use verbose prefixes for output messages Date: Tue, 28 Sep 2021 16:20:03 +0200 Message-Id: <20210928142004.1375262-4-mgorny@gentoo.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210928142004.1375262-1-mgorny@gentoo.org> References: <20210928142004.1375262-1-mgorny@gentoo.org> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-portage-dev@lists.gentoo.org Reply-to: gentoo-portage-dev@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Archives-Salt: 028ab74f-7246-4b23-9724-67164fcb9bae X-Archives-Hash: bea6dad5633d7253cf473a06eeb2bb0a 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 --- 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