Prefix LOG and CHECK with AOS_

This prepares us for introducing glog more widely and transitioning
things over where they make sense.

Change-Id: Ic6c208882407bc2153fe875ffc736d66f5c8ade5
diff --git a/y2019/control_loops/drivetrain/event_loop_localizer.cc b/y2019/control_loops/drivetrain/event_loop_localizer.cc
index 94ab9ea..67a708a 100644
--- a/y2019/control_loops/drivetrain/event_loop_localizer.cc
+++ b/y2019/control_loops/drivetrain/event_loop_localizer.cc
@@ -64,10 +64,10 @@
     ::aos::monotonic_clock::time_point now, double left_encoder,
     double right_encoder, double gyro_rate,
     double /*longitudinal_accelerometer*/) {
-  CHECK(U.allFinite());
-  CHECK(::std::isfinite(left_encoder));
-  CHECK(::std::isfinite(right_encoder));
-  CHECK(::std::isfinite(gyro_rate));
+  AOS_CHECK(U.allFinite());
+  AOS_CHECK(::std::isfinite(left_encoder));
+  AOS_CHECK(::std::isfinite(right_encoder));
+  AOS_CHECK(::std::isfinite(gyro_rate));
   localizer_.UpdateEncodersAndGyro(left_encoder, right_encoder, gyro_rate, U,
                                    now);
   while (frame_fetcher_.FetchNext()) {
@@ -81,11 +81,11 @@
   // Note: num_targets and camera are unsigned integers and so don't need to be
   // checked for < 0.
   if (frame.num_targets > kMaxTargetsPerFrame) {
-    LOG(ERROR, "Got bad num_targets %d\n", frame.num_targets);
+    AOS_LOG(ERROR, "Got bad num_targets %d\n", frame.num_targets);
     return;
   }
   if (frame.camera > cameras_.size()) {
-    LOG(ERROR, "Got bad camera number %d\n", frame.camera);
+    AOS_LOG(ERROR, "Got bad camera number %d\n", frame.camera);
     return;
   }
   for (int ii = 0; ii < frame.num_targets; ++ii) {
diff --git a/y2019/control_loops/drivetrain/localizer.h b/y2019/control_loops/drivetrain/localizer.h
index 1571fec..d716535 100644
--- a/y2019/control_loops/drivetrain/localizer.h
+++ b/y2019/control_loops/drivetrain/localizer.h
@@ -54,14 +54,14 @@
     }
 
     if (!SanitizeTargets(targets)) {
-      LOG(ERROR, "Throwing out targets due to in insane values.\n");
+      AOS_LOG(ERROR, "Throwing out targets due to in insane values.\n");
       return;
     }
 
     if (t > HybridEkf::latest_t()) {
-      LOG(ERROR,
-          "target observations must be older than most recent encoder/gyro "
-          "update.\n");
+      AOS_LOG(ERROR,
+              "target observations must be older than most recent encoder/gyro "
+              "update.\n");
       return;
     }
 
@@ -111,15 +111,15 @@
       if (!(::std::isfinite(reading.heading) &&
             ::std::isfinite(reading.distance) &&
             ::std::isfinite(reading.skew) && ::std::isfinite(reading.height))) {
-        LOG(ERROR, "Got non-finite values in target.\n");
+        AOS_LOG(ERROR, "Got non-finite values in target.\n");
         return false;
       }
       if (reading.distance < 0) {
-        LOG(ERROR, "Got negative distance.\n");
+        AOS_LOG(ERROR, "Got negative distance.\n");
         return false;
       }
       if (::std::abs(::aos::math::NormalizeAngle(reading.skew)) > M_PI_2) {
-        LOG(ERROR, "Got skew > pi / 2.\n");
+        AOS_LOG(ERROR, "Got skew > pi / 2.\n");
         return false;
       }
     }
@@ -284,7 +284,7 @@
     }
 
     if (camera_views.size() == 0) {
-      LOG(DEBUG, "Unable to identify potential target matches.\n");
+      AOS_LOG(DEBUG, "Unable to identify potential target matches.\n");
       // If we can't get a match, provide H = zero, which will make this
       // correction step a nop.
       *h = [](const State &, const Input &) { return Output::Zero(); };
@@ -305,7 +305,7 @@
       for (size_t ii = 0; ii < target_views.size(); ++ii) {
         size_t view_idx = best_frames[ii];
         if (view_idx < 0 || view_idx >= camera_views.size()) {
-          LOG(ERROR, "Somehow, the view scorer failed.\n");
+          AOS_LOG(ERROR, "Somehow, the view scorer failed.\n");
           h_functions->push_back(
               [](const State &, const Input &) { return Output::Zero(); });
           dhdx_functions->push_back([](const State &) {
@@ -319,10 +319,10 @@
         const TargetView target_view = target_views[ii];
         const Scalar match_score = scores(ii, view_idx);
         if (match_score > kRejectionScore) {
-          LOG(DEBUG,
-              "Rejecting target at (%f, %f, %f, %f) due to high score.\n",
-              target_view.reading.heading, target_view.reading.distance,
-              target_view.reading.skew, target_view.reading.height);
+          AOS_LOG(DEBUG,
+                  "Rejecting target at (%f, %f, %f, %f) due to high score.\n",
+                  target_view.reading.heading, target_view.reading.distance,
+                  target_view.reading.skew, target_view.reading.height);
           h_functions->push_back(
               [](const State &, const Input &) { return Output::Zero(); });
           dhdx_functions->push_back([](const State &) {
@@ -456,7 +456,7 @@
       // If we reach here and best_match = -1, that means that no potential
       // targets were generated by the camera, and we should never have gotten
       // here.
-      CHECK(best_match != -1);
+      AOS_CHECK(best_match != -1);
       ::aos::SizedArray<bool, max_targets_per_frame> sub_views = used_views;
       sub_views[ii] = true;
       ::std::array<bool, num_targets> sub_targets = used_targets;
diff --git a/y2019/control_loops/drivetrain/replay_localizer.cc b/y2019/control_loops/drivetrain/replay_localizer.cc
index ce0ac09..93282c8 100644
--- a/y2019/control_loops/drivetrain/replay_localizer.cc
+++ b/y2019/control_loops/drivetrain/replay_localizer.cc
@@ -139,7 +139,7 @@
     replayer_.AddHandler<frc971::control_loops::drivetrain::LocalizerControl>(
         drivetrain, "localizer_control",
         [this](const frc971::control_loops::drivetrain::LocalizerControl &msg) {
-          LOG_STRUCT(DEBUG, "localizer_control", msg);
+          AOS_LOG_STRUCT(DEBUG, "localizer_control", msg);
           localizer_.ResetPosition(msg.sent_time, msg.x, msg.y, msg.theta,
                                    msg.theta_uncertainty,
                                    !msg.keep_current_theta);
@@ -186,7 +186,7 @@
       fd = open(filename, O_RDONLY);
     }
     if (fd == -1) {
-      PLOG(FATAL, "couldn't open file '%s' for reading", filename);
+      AOS_PLOG(FATAL, "couldn't open file '%s' for reading", filename);
     }
 
     replayer_.OpenFile(fd);
@@ -204,7 +204,7 @@
     }
     replayer_.CloseCurrentFile();
 
-    PCHECK(close(fd));
+    AOS_PCHECK(close(fd));
 
     Plot();
   }
diff --git a/y2019/control_loops/drivetrain/target_selector.cc b/y2019/control_loops/drivetrain/target_selector.cc
index a338181..3e43db9 100644
--- a/y2019/control_loops/drivetrain/target_selector.cc
+++ b/y2019/control_loops/drivetrain/target_selector.cc
@@ -25,13 +25,13 @@
     ball_mode_ = superstructure_goal_fetcher_->suction.gamepiece_mode == 0;
   }
   if (hint_fetcher_.Fetch()) {
-    LOG_STRUCT(DEBUG, "selector_hint", *hint_fetcher_);
+    AOS_LOG_STRUCT(DEBUG, "selector_hint", *hint_fetcher_);
     // suggested_target is unsigned so we don't check for >= 0.
     if (hint_fetcher_->suggested_target < 4) {
       target_hint_ =
           static_cast<SelectionHint>(hint_fetcher_->suggested_target);
     } else {
-      LOG(ERROR, "Got invalid suggested target.\n");
+      AOS_LOG(ERROR, "Got invalid suggested target.\n");
     }
   }
   *robot_pose_.mutable_pos() << state.x(), state.y(), 0.0;
diff --git a/y2019/control_loops/superstructure/superstructure.cc b/y2019/control_loops/superstructure/superstructure.cc
index ec9e2e5..ff9bb13 100644
--- a/y2019/control_loops/superstructure/superstructure.cc
+++ b/y2019/control_loops/superstructure/superstructure.cc
@@ -30,7 +30,7 @@
                                   SuperstructureQueue::Output *output,
                                   SuperstructureQueue::Status *status) {
   if (WasReset()) {
-    LOG(ERROR, "WPILib reset, restarting\n");
+    AOS_LOG(ERROR, "WPILib reset, restarting\n");
     elevator_.Reset();
     wrist_.Reset();
     intake_.Reset();
@@ -155,7 +155,7 @@
   new_status_light->blue = blue;
 
   if (!new_status_light.Send()) {
-    LOG(ERROR, "Failed to send lights.\n");
+    AOS_LOG(ERROR, "Failed to send lights.\n");
   }
 }