Add a Log::arg() variant to hexdump binary buffers
Perhaps we should make this work with Slices, easy to add once the need
arises.
Test: atest netdutils_test
Change-Id: I031b8e41e9ab7b59a857e77438bc3fa193e755b3
diff --git a/libnetdutils/LogTest.cpp b/libnetdutils/LogTest.cpp
index e95b30d..1270560 100644
--- a/libnetdutils/LogTest.cpp
+++ b/libnetdutils/LogTest.cpp
@@ -128,6 +128,12 @@
EXPECT_EQ("testFunc(65, 100, -1000)", entry.toString());
}
+TEST(LogEntryTest, PrintHex) {
+ const std::vector<uint8_t> buf{0xDE, 0xAD, 0xBE, 0xEF};
+ const LogEntry entry = LogEntry().function("testFunc").arg(buf);
+ EXPECT_EQ("testFunc({deadbeef})", entry.toString());
+}
+
TEST(LogEntryTest, PrintArgumentPack) {
const LogEntry entry = LogEntry().function("testFunc").args("hello", 42, false);
EXPECT_EQ("testFunc(hello, 42, false)", entry.toString());