[REFACTOR] Split Android and CrOS logging.

Previously, they are all cramped in main.cc. Split them
into their respective files logging.cc, logging_android.cc
and provide a common header, logging.h, that main.cc can use.

Bug: 147696014
Bug: 148818798
Test: builds
Test: build logging.cc in Android
Change-Id: Iafdaee6be20e204f4faa1d1d8f81e43670f08d96
diff --git a/common/utils.cc b/common/utils.cc
index e7b6975..fc89040 100644
--- a/common/utils.cc
+++ b/common/utils.cc
@@ -30,6 +30,7 @@
 #include <sys/resource.h>
 #include <sys/stat.h>
 #include <sys/types.h>
+#include <time.h>
 #include <unistd.h>
 
 #include <algorithm>
@@ -1074,6 +1075,14 @@
   return file_name.value();
 }
 
+string GetTimeAsString(time_t utime) {
+  struct tm tm;
+  CHECK_EQ(localtime_r(&utime, &tm), &tm);
+  char str[16];
+  CHECK_EQ(strftime(str, sizeof(str), "%Y%m%d-%H%M%S", &tm), 15u);
+  return str;
+}
+
 }  // namespace utils
 
 }  // namespace chromeos_update_engine