adb: clean up debug tracing a little.

Always use LOG() for debug tracing.
Remove useless D_lock. I believe it is useless to lock just before and after fprintf.

I verified the log output both on host and on device. The output looks fine to me.

Change-Id: I96ccfe408ff56864361551afe9ad464d197ae104
diff --git a/adb/commandline.cpp b/adb/commandline.cpp
index 6325e64..86f9263 100644
--- a/adb/commandline.cpp
+++ b/adb/commandline.cpp
@@ -258,10 +258,10 @@
 
 static void read_and_dump(int fd) {
     while (fd >= 0) {
-        D("read_and_dump(): pre adb_read(fd=%d)\n", fd);
+        D("read_and_dump(): pre adb_read(fd=%d)", fd);
         char buf[BUFSIZ];
         int len = adb_read(fd, buf, sizeof(buf));
-        D("read_and_dump(): post adb_read(fd=%d): len=%d\n", fd, len);
+        D("read_and_dump(): post adb_read(fd=%d): len=%d", fd, len);
         if (len <= 0) {
             break;
         }
@@ -297,7 +297,7 @@
     int old_stdout_mode = -1;
 #endif
 
-    D("copy_to_file(%d -> %d)\n", inFd, outFd);
+    D("copy_to_file(%d -> %d)", inFd, outFd);
 
     if (inFd == STDIN_FILENO) {
         stdin_raw_init(STDIN_FILENO);
@@ -325,11 +325,11 @@
             len = adb_read(inFd, buf, BUFSIZE);
         }
         if (len == 0) {
-            D("copy_to_file() : read 0 bytes; exiting\n");
+            D("copy_to_file() : read 0 bytes; exiting");
             break;
         }
         if (len < 0) {
-            D("copy_to_file(): read failed: %s\n", strerror(errno));
+            D("copy_to_file(): read failed: %s", strerror(errno));
             break;
         }
         if (outFd == STDOUT_FILENO) {
@@ -358,7 +358,7 @@
     }
 #endif
 
-    D("copy_to_file() finished after %lu bytes\n", total);
+    D("copy_to_file() finished after %lu bytes", total);
     free(buf);
 }
 
@@ -378,9 +378,9 @@
 
     while (true) {
         /* fdi is really the client's stdin, so use read, not adb_read here */
-        D("stdin_read_thread(): pre unix_read(fdi=%d,...)\n", fdi);
+        D("stdin_read_thread(): pre unix_read(fdi=%d,...)", fdi);
         r = unix_read(fdi, buf, 1024);
-        D("stdin_read_thread(): post unix_read(fdi=%d,...)\n", fdi);
+        D("stdin_read_thread(): post unix_read(fdi=%d,...)", fdi);
         if (r <= 0) break;
         for (n = 0; n < r; n++){
             switch(buf[n]) {
@@ -777,7 +777,7 @@
         cmd += " " + escape_arg(*argv++);
     }
 
-    D("backup. filename=%s cmd=%s\n", filename, cmd.c_str());
+    D("backup. filename=%s cmd=%s", filename, cmd.c_str());
     std::string error;
     int fd = adb_connect(cmd, &error);
     if (fd < 0) {
@@ -1152,7 +1152,7 @@
         }
 
         if (argc < 2) {
-            D("starting interactive shell\n");
+            D("starting interactive shell");
             r = interactive_shell();
             if (h) {
                 printf("\x1b[0m");
@@ -1171,14 +1171,14 @@
         }
 
         while (true) {
-            D("interactive shell loop. cmd=%s\n", cmd.c_str());
+            D("interactive shell loop. cmd=%s", cmd.c_str());
             std::string error;
             int fd = adb_connect(cmd, &error);
             int r;
             if (fd >= 0) {
-                D("about to read_and_dump(fd=%d)\n", fd);
+                D("about to read_and_dump(fd=%d)", fd);
                 read_and_dump(fd);
-                D("read_and_dump() done.\n");
+                D("read_and_dump() done.");
                 adb_close(fd);
                 r = 0;
             } else {
@@ -1190,7 +1190,7 @@
                 printf("\x1b[0m");
                 fflush(stdout);
             }
-            D("interactive shell loop. return r=%d\n", r);
+            D("interactive shell loop. return r=%d", r);
             return r;
         }
     }