Adb: use VLOG() to replace D() for verbose logging.
As there are too many D(), we can keep both VLOG() and D() now, and get
rid of D() gradually.
Change-Id: I2f1cb70bcab3e82c99fed939341d03f6b2216076
diff --git a/adb/adb_trace.h b/adb/adb_trace.h
index b4155df..78b2deb 100644
--- a/adb/adb_trace.h
+++ b/adb/adb_trace.h
@@ -22,36 +22,40 @@
/* IMPORTANT: if you change the following list, don't
* forget to update the corresponding 'tags' table in
- * the adb_trace_init() function implemented in adb.c
+ * the adb_trace_init() function implemented in adb_trace.cpp.
*/
enum AdbTrace {
- TRACE_ADB = 0, /* 0x001 */
- TRACE_SOCKETS,
- TRACE_PACKETS,
- TRACE_TRANSPORT,
- TRACE_RWX, /* 0x010 */
- TRACE_USB,
- TRACE_SYNC,
- TRACE_SYSDEPS,
- TRACE_JDWP, /* 0x100 */
- TRACE_SERVICES,
- TRACE_AUTH,
- TRACE_FDEVENT,
- TRACE_SHELL
+ ADB = 0, /* 0x001 */
+ SOCKETS,
+ PACKETS,
+ TRANSPORT,
+ RWX, /* 0x010 */
+ USB,
+ SYNC,
+ SYSDEPS,
+ JDWP, /* 0x100 */
+ SERVICES,
+ AUTH,
+ FDEVENT,
+ SHELL
};
-extern int adb_trace_mask;
-extern unsigned char adb_trace_output_count;
-void adb_trace_init(char**);
+#define VLOG_IS_ON(TAG) \
+ ((adb_trace_mask & (1 << TAG)) != 0)
-#define ADB_TRACING ((adb_trace_mask & (1 << TRACE_TAG)) != 0)
+#define VLOG(TAG) \
+ if (LIKELY(!VLOG_IS_ON(TAG))) \
+ ; \
+ else \
+ LOG(INFO)
// You must define TRACE_TAG before using this macro.
#define D(...) \
- do { \
- if (ADB_TRACING) { \
- LOG(INFO) << android::base::StringPrintf(__VA_ARGS__); \
- } \
- } while (0)
+ VLOG(TRACE_TAG) << android::base::StringPrintf(__VA_ARGS__)
+
+
+extern int adb_trace_mask;
+void adb_trace_init(char**);
+void adb_trace_enable(AdbTrace trace_tag);
#endif /* __ADB_TRACE_H */