summaryrefslogtreecommitdiffstats
path: root/apt-pkg/contrib/error.cc
diff options
context:
space:
mode:
Diffstat (limited to 'apt-pkg/contrib/error.cc')
-rw-r--r--apt-pkg/contrib/error.cc28
1 files changed, 22 insertions, 6 deletions
diff --git a/apt-pkg/contrib/error.cc b/apt-pkg/contrib/error.cc
index c9bb622..83e90a0 100644
--- a/apt-pkg/contrib/error.cc
+++ b/apt-pkg/contrib/error.cc
@@ -34,6 +34,7 @@
#include <string>
#include <unistd.h>
+#include <apti18n.h>
/*}}}*/
// Global Error Object /*{{{*/
@@ -64,6 +65,7 @@ GEMessage(FatalE, FATAL)
GEMessage(Errno, ERROR)
GEMessage(WarningE, WARNING)
GEMessage(NoticeE, NOTICE)
+GEMessage(AuditE, AUDIT)
GEMessage(DebugE, DEBUG)
#undef GEMessage
/*}}}*/
@@ -121,6 +123,7 @@ GEMessage(Fatal, FATAL)
GEMessage(Error, ERROR)
GEMessage(Warning, WARNING)
GEMessage(Notice, NOTICE)
+GEMessage(Audit, AUDIT)
GEMessage(Debug, DEBUG)
#undef GEMessage
/*}}}*/
@@ -252,11 +255,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_NOTICE = "\033[33m"; // normal yellow
+ 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)
{
@@ -270,6 +275,7 @@ APT_HIDDEN std::ostream &operator<<(std::ostream &out, GlobalError::Item i)
out << COLOR_WARN;
break;
case GlobalError::NOTICE:
+ case GlobalError::AUDIT:
out << COLOR_NOTICE;
break;
default:
@@ -281,19 +287,26 @@ 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::AUDIT:
+ out << (out_ver < 30 ? "A:" : _("Audit:"));
break;
case GlobalError::DEBUG:
- out << 'D';
+ // TRANSLATOR: This is a warning level displayed before the message
+ out << _("Debug:");
break;
}
- out << ": ";
+ out << " ";
if (use_color)
{
@@ -303,7 +316,10 @@ APT_HIDDEN std::ostream &operator<<(std::ostream &out, GlobalError::Item i)
case GlobalError::ERROR:
case GlobalError::WARNING:
case GlobalError::NOTICE:
+ case GlobalError::AUDIT:
out << COLOR_RESET;
+ if (out_ver >= 30)
+ out << COLOR_BOLD;
break;
default:
break;