Move over to ABSL logging and flags.

Removes gperftools too since that wants gflags.

Here come the fireworks.

Change-Id: I79cb7bcf60f1047fbfa28bfffc21a0fd692e4b1c
Signed-off-by: Austin Schuh <austin.linux@gmail.com>
diff --git a/aos/logging/BUILD b/aos/logging/BUILD
index b08f465..0ba90a9 100644
--- a/aos/logging/BUILD
+++ b/aos/logging/BUILD
@@ -23,7 +23,8 @@
         "//aos:macros",
         "//aos/libc:aos_strerror",
         "//aos/time",
-        "@com_github_google_glog//:glog",
+        "@com_google_absl//absl/log",
+        "@com_google_absl//absl/log:check",
     ],
 )
 
@@ -36,7 +37,8 @@
     deps = [
         "//aos:configuration",
         "//aos/time",
-        "@com_github_google_glog//:glog",
+        "@com_google_absl//absl/log",
+        "@com_google_absl//absl/log:check",
     ],
 )
 
@@ -49,7 +51,8 @@
     deps = [
         ":logging",
         "//aos/testing:googletest",
-        "@com_github_google_glog//:glog",
+        "@com_google_absl//absl/log",
+        "@com_google_absl//absl/log:check",
     ],
 )
 
@@ -83,7 +86,8 @@
     deps = [
         ":dynamic_log_command_fbs",
         "//aos/events:shm_event_loop",
-        "@com_github_google_glog//:glog",
+        "@com_google_absl//absl/log",
+        "@com_google_absl//absl/log:check",
     ],
 )
 
diff --git a/aos/logging/context.cc b/aos/logging/context.cc
index 00b7f3c..66ece05 100644
--- a/aos/logging/context.cc
+++ b/aos/logging/context.cc
@@ -21,7 +21,8 @@
 extern char *program_invocation_name;
 extern char *program_invocation_short_name;
 
-#include "glog/logging.h"
+#include "absl/log/check.h"
+#include "absl/log/log.h"
 
 namespace aos::logging::internal {
 namespace {
diff --git a/aos/logging/dynamic_logging.cc b/aos/logging/dynamic_logging.cc
index 48c9dcb..4ed4ea3 100644
--- a/aos/logging/dynamic_logging.cc
+++ b/aos/logging/dynamic_logging.cc
@@ -3,8 +3,10 @@
 #include <ostream>
 #include <string_view>
 
+#include "absl/log/check.h"
+#include "absl/log/globals.h"
+#include "absl/log/log.h"
 #include "flatbuffers/string.h"
-#include "glog/logging.h"
 
 namespace aos::logging {
 
@@ -31,7 +33,7 @@
   if (command.vlog_level() < 0) {
     return;
   }
-  FLAGS_v = command.vlog_level();
+  absl::SetGlobalVLogLevel(command.vlog_level());
 }
 
 }  // namespace aos::logging
diff --git a/aos/logging/dynamic_logging_test.cc b/aos/logging/dynamic_logging_test.cc
index 21e0c36..449d7ac 100644
--- a/aos/logging/dynamic_logging_test.cc
+++ b/aos/logging/dynamic_logging_test.cc
@@ -4,9 +4,10 @@
 #include <memory>
 #include <ostream>
 
+#include "absl/log/check.h"
+#include "absl/log/log.h"
 #include "flatbuffers/buffer.h"
 #include "flatbuffers/flatbuffer_builder.h"
-#include "glog/logging.h"
 #include "gtest/gtest.h"
 
 #include "aos/configuration.h"
diff --git a/aos/logging/implementations_test.cc b/aos/logging/implementations_test.cc
index 08fdc7b..62d5f1e 100644
--- a/aos/logging/implementations_test.cc
+++ b/aos/logging/implementations_test.cc
@@ -7,7 +7,8 @@
 #include <cinttypes>
 #include <string>
 
-#include "glog/logging.h"
+#include "absl/log/check.h"
+#include "absl/log/log.h"
 #include "gtest/gtest.h"
 
 #include "aos/logging/printf_formats.h"
diff --git a/aos/logging/interface.cc b/aos/logging/interface.cc
index 326f28e..a630285 100644
--- a/aos/logging/interface.cc
+++ b/aos/logging/interface.cc
@@ -9,7 +9,8 @@
 #include <string>
 #include <type_traits>
 
-#include "glog/logging.h"
+#include "absl/log/check.h"
+#include "absl/log/log.h"
 
 #include "aos/die.h"
 #include "aos/logging/context.h"
diff --git a/aos/logging/log_namer.cc b/aos/logging/log_namer.cc
index d5005bb..0e68e7b 100644
--- a/aos/logging/log_namer.cc
+++ b/aos/logging/log_namer.cc
@@ -11,8 +11,9 @@
 #include <ostream>
 #include <string>
 
-#include "gflags/gflags.h"
-#include "glog/logging.h"
+#include "absl/flags/flag.h"
+#include "absl/log/check.h"
+#include "absl/log/log.h"
 
 #include "aos/configuration.h"
 #include "aos/time/time.h"
@@ -23,14 +24,14 @@
 #pragma GCC diagnostic ignored "-Wformat-nonliteral"
 #endif
 
-DEFINE_string(logging_folder,
+ABSL_FLAG(std::string, logging_folder,
 #ifdef AOS_ARCHITECTURE_arm_frc
-              "",
+          "",
 #else
-              "./logs",
+          "./logs",
 #endif
-              "The folder to log to.  If empty, search for the /media/sd*1/ "
-              "folder and place logs there.");
+          "The folder to log to.  If empty, search for the /media/sd*1/ "
+          "folder and place logs there.");
 
 namespace aos::logging {
 namespace {
@@ -126,7 +127,7 @@
 }  // namespace
 
 std::optional<std::string> MaybeGetLogName(const char *basename) {
-  if (FLAGS_logging_folder.empty()) {
+  if (absl::GetFlag(FLAGS_logging_folder).empty()) {
     char folder[128];
     {
       char dev_name[8];
@@ -147,23 +148,23 @@
                  << "' does not exist. please create it.";
     }
 
-    FLAGS_logging_folder = folder;
+    absl::SetFlag(&FLAGS_logging_folder, folder);
   }
-  const char *folder = FLAGS_logging_folder.c_str();
-  if (access(folder, R_OK | W_OK) == -1) {
+  const std::string folder = absl::GetFlag(FLAGS_logging_folder);
+  if (access(folder.c_str(), R_OK | W_OK) == -1) {
     LOG(FATAL) << "folder '" << folder << "' does not exist. please create it.";
   }
   LOG(INFO) << "logging to folder '" << folder << "'";
 
   char *tmp;
-  AllocateLogName(&tmp, folder, basename);
+  AllocateLogName(&tmp, folder.c_str(), basename);
 
   std::string log_base_name = tmp;
   std::string log_roborio_name = log_base_name + "/";
   free(tmp);
 
   char *tmp2;
-  if (asprintf(&tmp2, "%s/%s-current", folder, basename) == -1) {
+  if (asprintf(&tmp2, "%s/%s-current", folder.c_str(), basename) == -1) {
     PLOG(WARNING) << "couldn't create current symlink name";
   } else {
     if (unlink(tmp2) == -1 && (errno != EROFS && errno != ENOENT)) {