summaryrefslogtreecommitdiffstats
path: root/libnetdutils/Log.cpp
diff options
context:
space:
mode:
authorBernie Innocenti <codewiz@google.com>2018-09-06 16:36:38 +0900
committerBernie Innocenti <codewiz@google.com>2018-09-06 12:19:59 +0000
commitc7994ae2259fcd850d0f5337689a6498be17dba9 (patch)
treeff8b03bcf3bd0e13a88fbebf98bb8813d8a5d54b /libnetdutils/Log.cpp
parenta5211079dddea75278b6cf8fa5016b6d15146ed9 (diff)
downloadplatform_system_netd-c7994ae2259fcd850d0f5337689a6498be17dba9.tar.gz
platform_system_netd-c7994ae2259fcd850d0f5337689a6498be17dba9.tar.bz2
platform_system_netd-c7994ae2259fcd850d0f5337689a6498be17dba9.zip
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
Diffstat (limited to 'libnetdutils/Log.cpp')
-rw-r--r--libnetdutils/Log.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/libnetdutils/Log.cpp b/libnetdutils/Log.cpp
index 07d59525e..1a742f617 100644
--- a/libnetdutils/Log.cpp
+++ b/libnetdutils/Log.cpp
@@ -117,7 +117,8 @@ LogEntry& LogEntry::arg(const std::string& val) {
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 @@ LogEntry& LogEntry::arg(const std::vector<int32_t>& val) {
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;