From 760d7d3aa5ac414f05e381e0984430544b1f42d9 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Mon, 15 Apr 2024 16:48:16 +0200 Subject: Render notices without (yellow) color, just in bold Yellow is a bit odd for notices. --- apt-pkg/contrib/error.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'apt-pkg/contrib/error.cc') diff --git a/apt-pkg/contrib/error.cc b/apt-pkg/contrib/error.cc index c9bb622e7..2cb1191c1 100644 --- a/apt-pkg/contrib/error.cc +++ b/apt-pkg/contrib/error.cc @@ -252,7 +252,7 @@ void GlobalError::MergeWithStack() { APT_HIDDEN std::ostream &operator<<(std::ostream &out, GlobalError::Item i) { static constexpr auto COLOR_RESET = "\033[0m"; - static constexpr auto COLOR_NOTICE = "\033[33m"; // normal yellow + static constexpr auto COLOR_NOTICE = "\033[1m"; // bold neutral static constexpr auto COLOR_WARN = "\033[1;33m"; // bold yellow static constexpr auto COLOR_ERROR = "\033[1;31m"; // bold red -- cgit v1.2.3-70-g09d2 From 4d54b35e7a0c073b293d26d075714bef17080d48 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Mon, 15 Apr 2024 16:49:43 +0200 Subject: Keep the entire error/warning/notice message bold This draws a bit more attention, and improves readability vs keeping the color for the entire message. --- apt-pkg/contrib/error.cc | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'apt-pkg/contrib/error.cc') diff --git a/apt-pkg/contrib/error.cc b/apt-pkg/contrib/error.cc index 2cb1191c1..e3cdb7566 100644 --- a/apt-pkg/contrib/error.cc +++ b/apt-pkg/contrib/error.cc @@ -252,11 +252,13 @@ void GlobalError::MergeWithStack() { APT_HIDDEN std::ostream &operator<<(std::ostream &out, GlobalError::Item i) { static constexpr auto COLOR_RESET = "\033[0m"; + static constexpr auto COLOR_BOLD = "\033[1m"; // bold neutral static constexpr auto COLOR_NOTICE = "\033[1m"; // bold neutral static constexpr auto COLOR_WARN = "\033[1;33m"; // bold yellow static constexpr auto COLOR_ERROR = "\033[1;31m"; // bold red bool use_color = _config->FindB("APT::Color", false); + auto out_ver = _config->FindI("APT::Output-Version"); if (use_color) { @@ -304,6 +306,8 @@ APT_HIDDEN std::ostream &operator<<(std::ostream &out, GlobalError::Item i) case GlobalError::WARNING: case GlobalError::NOTICE: out << COLOR_RESET; + if (out_ver >= 30) + out << COLOR_BOLD; break; default: break; -- cgit v1.2.3-70-g09d2 From dc3f3ec100f275e5a802e59fd160f75cd262845f Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Mon, 15 Apr 2024 16:51:32 +0200 Subject: i18n: Use Error:/Warning:/Notice: instead of E:/W:/N: This allows these bits to be localized, improving user experience for users in different languages. --- apt-pkg/contrib/error.cc | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'apt-pkg/contrib/error.cc') diff --git a/apt-pkg/contrib/error.cc b/apt-pkg/contrib/error.cc index e3cdb7566..3bd253dba 100644 --- a/apt-pkg/contrib/error.cc +++ b/apt-pkg/contrib/error.cc @@ -34,6 +34,7 @@ #include #include +#include /*}}}*/ // Global Error Object /*{{{*/ @@ -283,19 +284,23 @@ APT_HIDDEN std::ostream &operator<<(std::ostream &out, GlobalError::Item i) { case GlobalError::FATAL: case GlobalError::ERROR: - out << 'E'; + // TRANSLATOR: This is a warning level displayed before the message + out << (out_ver < 30 ? "E:" : _("Error:")); break; case GlobalError::WARNING: - out << 'W'; + // TRANSLATOR: This is a warning level displayed before the message + out << (out_ver < 30 ? "W:" : _("Warning:")); break; case GlobalError::NOTICE: - out << 'N'; + // TRANSLATOR: This is a warning level displayed before the message + out << (out_ver < 30 ? "N:" : _("Notice:")); break; case GlobalError::DEBUG: - out << 'D'; + // TRANSLATOR: This is a warning level displayed before the message + out << _("Debug:"); break; } - out << ": "; + out << " "; if (use_color) { -- cgit v1.2.3-70-g09d2