Add a variadic overload of Log::arg() to print all arguments
Additionally limit the scope of the arg(bool) overload to fix literal
strings being logged as 'true'. Found while adding a few more tests...
Test: atest netdutils_test
Change-Id: If2c398bab6c2c809274e6b2d247cdb38494cb8e3
diff --git a/libnetdutils/Log.cpp b/libnetdutils/Log.cpp
index 07d5952..1a742f6 100644
--- a/libnetdutils/Log.cpp
+++ b/libnetdutils/Log.cpp
@@ -117,7 +117,8 @@
return *this;
}
-LogEntry& LogEntry::arg(bool val) {
+template<>
+LogEntry& LogEntry::arg<>(bool val) {
mArgs.push_back(val ? "true" : "false");
return *this;
}
@@ -127,8 +128,6 @@
return *this;
}
-// LogEntry& LogEntry::arg(const std::vector<uint8_t>& val);
-
LogEntry& LogEntry::arg(const std::vector<std::string>& val) {
mArgs.push_back(StringPrintf("[%s]", Join(val, ", ").c_str()));
return *this;