summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Andres Klode <julian.klode@canonical.com>2024-01-23 18:32:32 +0100
committerJulian Andres Klode <julian.klode@canonical.com>2024-04-19 20:08:44 +0200
commitb455ad0a6681be80134d31ca59c350332ab4fb73 (patch)
tree32444ecc8c544ec241d5eb4d89fcd8f868dc66ec
parent70103339b017a42ea71a56c27c221a79ccc3116f (diff)
Add an "audit" error level
This will aggressively highlight out-of-compliance vs the best practices.
-rw-r--r--apt-pkg/contrib/error.cc7
-rw-r--r--apt-pkg/contrib/error.h23
2 files changed, 30 insertions, 0 deletions
diff --git a/apt-pkg/contrib/error.cc b/apt-pkg/contrib/error.cc
index c9bb622e7..4715568d0 100644
--- a/apt-pkg/contrib/error.cc
+++ b/apt-pkg/contrib/error.cc
@@ -64,6 +64,7 @@ GEMessage(FatalE, FATAL)
GEMessage(Errno, ERROR)
GEMessage(WarningE, WARNING)
GEMessage(NoticeE, NOTICE)
+GEMessage(AuditE, AUDIT)
GEMessage(DebugE, DEBUG)
#undef GEMessage
/*}}}*/
@@ -121,6 +122,7 @@ GEMessage(Fatal, FATAL)
GEMessage(Error, ERROR)
GEMessage(Warning, WARNING)
GEMessage(Notice, NOTICE)
+GEMessage(Audit, AUDIT)
GEMessage(Debug, DEBUG)
#undef GEMessage
/*}}}*/
@@ -270,6 +272,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:
@@ -289,6 +292,9 @@ APT_HIDDEN std::ostream &operator<<(std::ostream &out, GlobalError::Item i)
case GlobalError::NOTICE:
out << 'N';
break;
+ case GlobalError::AUDIT:
+ out << 'A';
+ break;
case GlobalError::DEBUG:
out << 'D';
break;
@@ -303,6 +309,7 @@ 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;
break;
default:
diff --git a/apt-pkg/contrib/error.h b/apt-pkg/contrib/error.h
index 35e39ee0e..792232010 100644
--- a/apt-pkg/contrib/error.h
+++ b/apt-pkg/contrib/error.h
@@ -66,6 +66,8 @@ public: /*{{{*/
WARNING = 20,
/** \brief deprecation warnings, old fallback behavior, … */
NOTICE = 10,
+ /** \brief future deprecation warnings, divergence from best practices */
+ AUDIT = 5,
/** \brief for developers only in areas it is hard to print something directly */
DEBUG = 0
};
@@ -109,6 +111,15 @@ public: /*{{{*/
*/
bool NoticeE(const char *Function,const char *Description,...) APT_PRINTF(3) APT_COLD;
+ /** \brief add an audit message with errno to the list
+ *
+ * \param Function name of the function generating the error
+ * \param Description format string for the error message
+ *
+ * \return \b false
+ */
+ bool AuditE(const char *Function,const char *Description,...) APT_PRINTF(3) APT_COLD;
+
/** \brief add a debug message with errno to the list
*
* \param Function name of the function generating the error
@@ -193,6 +204,18 @@ public: /*{{{*/
*/
bool Notice(const char *Description,...) APT_PRINTF(2) APT_COLD;
+ /** \brief add an audit message to the list
+ *
+ * An audit message highlights divergences from best practices and
+ * future deprecations. It my for example include additional messages
+ * targeted at repository owners.
+ *
+ * \param Description Format string for the message
+ *
+ * \return \b false
+ */
+ bool Audit(const char *Description,...) APT_PRINTF(2) APT_COLD;
+
/** \brief add a debug message to the list
*
* \param Description Format string for the message