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/y2022/control_loops/superstructure/BUILD b/y2022/control_loops/superstructure/BUILD
index 0a72b71..650fa99 100644
--- a/y2022/control_loops/superstructure/BUILD
+++ b/y2022/control_loops/superstructure/BUILD
@@ -152,8 +152,9 @@
         ":superstructure_status_fbs",
         "//frc971/control_loops:control_loops_fbs",
         "//frc971/control_loops:profiled_subsystem_fbs",
-        "@com_github_google_glog//:glog",
         "@com_google_absl//absl/functional:bind_front",
+        "@com_google_absl//absl/log",
+        "@com_google_absl//absl/log:check",
     ],
 )
 
diff --git a/y2022/control_loops/superstructure/catapult/catapult_main.cc b/y2022/control_loops/superstructure/catapult/catapult_main.cc
index 5124745..62b5271 100644
--- a/y2022/control_loops/superstructure/catapult/catapult_main.cc
+++ b/y2022/control_loops/superstructure/catapult/catapult_main.cc
@@ -109,8 +109,6 @@
 
 int Main(int /*argc*/, char ** /*argv*/) {
   OSQPSolve();
-
-  gflags::ShutDownCommandLineFlags();
   return 0;
 }
 
diff --git a/y2022/control_loops/superstructure/catapult/catapult_test.cc b/y2022/control_loops/superstructure/catapult/catapult_test.cc
index 0077633..0aec698 100644
--- a/y2022/control_loops/superstructure/catapult/catapult_test.cc
+++ b/y2022/control_loops/superstructure/catapult/catapult_test.cc
@@ -1,6 +1,7 @@
 #include "frc971/control_loops/catapult/catapult.h"
 
-#include "glog/logging.h"
+#include "absl/log/check.h"
+#include "absl/log/log.h"
 #include "gtest/gtest.h"
 
 #include "y2022/control_loops/superstructure/catapult/catapult_plant.h"
diff --git a/y2022/control_loops/superstructure/collision_avoidance.cc b/y2022/control_loops/superstructure/collision_avoidance.cc
index 33e4d6e..5b6cee6 100644
--- a/y2022/control_loops/superstructure/collision_avoidance.cc
+++ b/y2022/control_loops/superstructure/collision_avoidance.cc
@@ -3,7 +3,8 @@
 #include <cmath>
 
 #include "absl/functional/bind_front.h"
-#include "glog/logging.h"
+#include "absl/log/check.h"
+#include "absl/log/log.h"
 
 namespace y2022::control_loops::superstructure {
 
diff --git a/y2022/control_loops/superstructure/superstructure.cc b/y2022/control_loops/superstructure/superstructure.cc
index dca0a96..b5cb3f3 100644
--- a/y2022/control_loops/superstructure/superstructure.cc
+++ b/y2022/control_loops/superstructure/superstructure.cc
@@ -1,13 +1,15 @@
 #include "y2022/control_loops/superstructure/superstructure.h"
 
+#include "absl/flags/flag.h"
+
 #include "aos/events/event_loop.h"
 #include "aos/flatbuffer_merge.h"
 #include "aos/network/team_number.h"
 #include "frc971/zeroing/wrap.h"
 #include "y2022/control_loops/superstructure/collision_avoidance.h"
 
-DEFINE_bool(ignore_distance, false,
-            "If true, ignore distance when shooting and obay joystick_reader");
+ABSL_FLAG(bool, ignore_distance, false,
+          "If true, ignore distance when shooting and obay joystick_reader");
 
 namespace y2022::control_loops::superstructure {
 
@@ -140,7 +142,7 @@
 
     constants::Values::ShotParams shot_params;
     const double distance_to_goal = aimer_.DistanceToGoal();
-    if (!FLAGS_ignore_distance && unsafe_goal->auto_aim() &&
+    if (!absl::GetFlag(FLAGS_ignore_distance) && unsafe_goal->auto_aim() &&
         values_->shot_interpolation_table.GetInRange(distance_to_goal,
                                                      &shot_params)) {
       flatbuffers::FlatBufferBuilder *catapult_goal_fbb =
diff --git a/y2022/control_loops/superstructure/superstructure_lib_test.cc b/y2022/control_loops/superstructure/superstructure_lib_test.cc
index eb33f29..8eaa7f6 100644
--- a/y2022/control_loops/superstructure/superstructure_lib_test.cc
+++ b/y2022/control_loops/superstructure/superstructure_lib_test.cc
@@ -1,6 +1,7 @@
 #include <chrono>
 #include <memory>
 
+#include "absl/flags/flag.h"
 #include "gtest/gtest.h"
 
 #include "aos/events/logging/log_writer.h"
@@ -16,8 +17,8 @@
 #include "y2022/control_loops/superstructure/superstructure.h"
 #include "y2022/control_loops/superstructure/turret/turret_plant.h"
 
-DEFINE_string(output_folder, "",
-              "If set, logs all channels to the provided logfile.");
+ABSL_FLAG(std::string, output_folder, "",
+          "If set, logs all channels to the provided logfile.");
 
 namespace y2022::control_loops::superstructure::testing {
 namespace chrono = std::chrono;
@@ -275,11 +276,11 @@
 
     SetEnabled(true);
 
-    if (!FLAGS_output_folder.empty()) {
-      unlink(FLAGS_output_folder.c_str());
+    if (!absl::GetFlag(FLAGS_output_folder).empty()) {
+      unlink(absl::GetFlag(FLAGS_output_folder).c_str());
       logger_event_loop_ = MakeEventLoop("logger", roborio_);
       logger_ = std::make_unique<aos::logger::Logger>(logger_event_loop_.get());
-      logger_->StartLoggingOnRun(FLAGS_output_folder);
+      logger_->StartLoggingOnRun(absl::GetFlag(FLAGS_output_folder));
     }
   }
 
diff --git a/y2022/control_loops/superstructure/superstructure_replay.cc b/y2022/control_loops/superstructure/superstructure_replay.cc
index d7f03e6..70640de 100644
--- a/y2022/control_loops/superstructure/superstructure_replay.cc
+++ b/y2022/control_loops/superstructure/superstructure_replay.cc
@@ -3,7 +3,7 @@
 // replayed, so that it can then be run through the plotting tool or analyzed
 // in some other way. The original superstructure status data will be on the
 // /original/superstructure channel.
-#include "gflags/gflags.h"
+#include "absl/flags/flag.h"
 
 #include "aos/events/logging/log_reader.h"
 #include "aos/events/logging/log_writer.h"
@@ -15,14 +15,14 @@
 #include "y2022/constants.h"
 #include "y2022/control_loops/superstructure/superstructure.h"
 
-DEFINE_int32(team, 971, "Team number to use for logfile replay.");
-DEFINE_string(output_folder, "/tmp/superstructure_replay/",
-              "Logs all channels to the provided logfile.");
+ABSL_FLAG(int32_t, team, 971, "Team number to use for logfile replay.");
+ABSL_FLAG(std::string, output_folder, "/tmp/superstructure_replay/",
+          "Logs all channels to the provided logfile.");
 
 int main(int argc, char **argv) {
   aos::InitGoogle(&argc, &argv);
 
-  aos::network::OverrideTeamNumber(FLAGS_team);
+  aos::network::OverrideTeamNumber(absl::GetFlag(FLAGS_team));
 
   // open logfiles
   aos::logger::LogReader reader(
@@ -40,11 +40,11 @@
   aos::NodeEventLoopFactory *roborio =
       factory.GetNodeEventLoopFactory("roborio");
 
-  unlink(FLAGS_output_folder.c_str());
+  unlink(absl::GetFlag(FLAGS_output_folder).c_str());
   std::unique_ptr<aos::EventLoop> logger_event_loop =
       roborio->MakeEventLoop("logger");
   auto logger = std::make_unique<aos::logger::Logger>(logger_event_loop.get());
-  logger->StartLoggingOnRun(FLAGS_output_folder);
+  logger->StartLoggingOnRun(absl::GetFlag(FLAGS_output_folder));
 
   roborio->OnStartup([roborio]() {
     roborio->AlwaysStart<y2022::control_loops::superstructure::Superstructure>(