OSDN Git Service

Add LOG_DUMPSYS[_TITLE]
authorChris Manton <cmanton@google.com>
Sun, 22 Nov 2020 22:48:52 +0000 (14:48 -0800)
committerChris Manton <cmanton@google.com>
Tue, 24 Nov 2020 07:05:44 +0000 (23:05 -0800)
Toward loggable code

Bug: 163134718
Tag: #refactor
Test: CtsVerifier

Change-Id: I6f8b8ae83c220324c5f99ce1f06178c13803913d

main/shim/dumpsys.h

index 33702ad..363c5c8 100644 (file)
 #include <functional>
 #include <list>
 
+#define LOG_DUMPSYS(fd, fmt, args...)                 \
+  do {                                                \
+    dprintf(fd, "%s " fmt "\n", DUMPSYS_TAG, ##args); \
+  } while (false)
+
+#define LOG_DUMPSYS_TITLE(fd, title)         \
+  do {                                       \
+    dprintf(fd, " ----- %s -----\n", title); \
+  } while (false)
+
+#define BOOL_TEXT(b) ((b) ? "true" : "false")
+
 namespace bluetooth {
 namespace shim {