summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Andres Klode <julian.klode@canonical.com>2024-07-15 17:57:42 +0200
committerJulian Andres Klode <julian.klode@canonical.com>2024-07-15 19:16:27 +0200
commitc51ea9f44e9742c88a252b86cb0260798b4b9f7b (patch)
tree665e290c7c9d5fa79030188004ca4843c67ab4c5
parent761852064521d9f34d3179c002427658342b6f03 (diff)
worker: Add an audit level to log audit messages
-rw-r--r--apt-pkg/acquire-worker.cc5
-rw-r--r--methods/aptmethod.h12
2 files changed, 15 insertions, 2 deletions
diff --git a/apt-pkg/acquire-worker.cc b/apt-pkg/acquire-worker.cc
index 4f247cf84..696a3e0b8 100644
--- a/apt-pkg/acquire-worker.cc
+++ b/apt-pkg/acquire-worker.cc
@@ -200,6 +200,7 @@ enum class APT_HIDDEN MessageType
STATUS = 102,
REDIRECT = 103,
WARNING = 104,
+ AUDIT = 105,
URI_START = 200,
URI_DONE = 201,
AUX_REQUEST = 351,
@@ -388,6 +389,10 @@ bool pkgAcquire::Worker::RunMessages()
_error->Warning("%s: %s", Itm ? Itm->Owner ? Itm->Owner->DescURI().c_str() : Access.c_str() : Access.c_str(), LookupTag(Message, "Message").c_str());
break;
+ case MessageType::AUDIT:
+ _error->Audit("%s: %s", Itm ? Itm->Owner ? Itm->Owner->DescURI().c_str() : Access.c_str() : Access.c_str(), LookupTag(Message, "Message").c_str());
+ break;
+
case MessageType::URI_START:
{
if (Itm == nullptr)
diff --git a/methods/aptmethod.h b/methods/aptmethod.h
index 26b8c0b55..1c24f3a98 100644
--- a/methods/aptmethod.h
+++ b/methods/aptmethod.h
@@ -448,7 +448,7 @@ protected:
return true;
}
- void Warning(std::string &&msg)
+ void Message(std::string &&msg, std::string code)
{
std::unordered_map<std::string, std::string> fields;
if (Queue != 0)
@@ -458,7 +458,15 @@ protected:
if (not UsedMirror.empty())
fields.emplace("UsedMirror", UsedMirror);
fields.emplace("Message", std::move(msg));
- SendMessage("104 Warning", std::move(fields));
+ SendMessage(code, std::move(fields));
+ }
+ void Warning(std::string &&msg)
+ {
+ return Message(std::move(msg), "104 Warning");
+ }
+ void Audit(std::string &&msg)
+ {
+ return Message(std::move(msg), "105 Audit");
}
bool TransferModificationTimes(char const * const From, char const * const To, time_t &LastModified) APT_NONNULL(2, 3)