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/aos/actions/action_test.cc b/aos/actions/action_test.cc
index 45cfd62..178b2b0 100644
--- a/aos/actions/action_test.cc
+++ b/aos/actions/action_test.cc
@@ -75,7 +75,7 @@
 
   bool RunAction(const uint32_t &) override {
     while (!ShouldCancel()) {
-      LOG(FATAL, "NOT CANCELED!!\n");
+      AOS_LOG(FATAL, "NOT CANCELED!!\n");
     }
     return true;
   }
diff --git a/aos/actions/actions.cc b/aos/actions/actions.cc
index 11a7f03..528a8b2 100644
--- a/aos/actions/actions.cc
+++ b/aos/actions/actions.cc
@@ -6,25 +6,25 @@
 
 void ActionQueue::EnqueueAction(::std::unique_ptr<Action> action) {
   if (current_action_) {
-    LOG(INFO, "Queueing action, canceling prior\n");
+    AOS_LOG(INFO, "Queueing action, canceling prior\n");
     current_action_->Cancel();
     next_action_ = ::std::move(action);
   } else {
-    LOG(INFO, "Queueing action\n");
+    AOS_LOG(INFO, "Queueing action\n");
     current_action_ = ::std::move(action);
     current_action_->Start();
   }
 }
 
 void ActionQueue::CancelCurrentAction() {
-  LOG(INFO, "Canceling current action\n");
+  AOS_LOG(INFO, "Canceling current action\n");
   if (current_action_) {
     current_action_->Cancel();
   }
 }
 
 void ActionQueue::CancelAllActions() {
-  LOG(DEBUG, "Cancelling all actions\n");
+  AOS_LOG(DEBUG, "Cancelling all actions\n");
   if (current_action_) {
     current_action_->Cancel();
   }
@@ -34,10 +34,10 @@
 void ActionQueue::Tick() {
   if (current_action_) {
     if (!current_action_->Running()) {
-      LOG(INFO, "Action is done.\n");
+      AOS_LOG(INFO, "Action is done.\n");
       current_action_ = ::std::move(next_action_);
       if (current_action_) {
-        LOG(INFO, "Running next action\n");
+        AOS_LOG(INFO, "Running next action\n");
         current_action_->Start();
       }
     }
diff --git a/aos/actions/actions.h b/aos/actions/actions.h
index 430a978..e2b9ca8 100644
--- a/aos/actions/actions.h
+++ b/aos/actions/actions.h
@@ -124,17 +124,17 @@
         run_value_(run_counter_.fetch_add(1, ::std::memory_order_relaxed) |
                    ((getpid() & 0xFFFF) << 16)),
         params_(params) {
-    LOG(DEBUG, "Action %" PRIx32 " created on queue %s\n", run_value_,
-        goal_sender_->name());
+    AOS_LOG(DEBUG, "Action %" PRIx32 " created on queue %s\n", run_value_,
+            goal_sender_->name());
     // Clear out any old status messages from before now.
     status_fetcher_->Fetch();
     if (status_fetcher_->get()) {
-      LOG_STRUCT(DEBUG, "have status", *status_fetcher_->get());
+      AOS_LOG_STRUCT(DEBUG, "have status", *status_fetcher_->get());
     }
   }
 
   virtual ~TypedAction() {
-    LOG(DEBUG, "Calling destructor of %" PRIx32 "\n", run_value_);
+    AOS_LOG(DEBUG, "Calling destructor of %" PRIx32 "\n", run_value_);
     DoCancel();
   }
 
@@ -231,20 +231,21 @@
 template <typename T>
 void TypedAction<T>::DoCancel() {
   if (!sent_started_) {
-    LOG(INFO, "Action %" PRIx32 " on queue %s was never started\n", run_value_,
-        goal_sender_->name());
+    AOS_LOG(INFO, "Action %" PRIx32 " on queue %s was never started\n",
+            run_value_, goal_sender_->name());
   } else {
     if (interrupted_) {
-      LOG(INFO,
-          "Action %" PRIx32 " on queue %s was interrupted -> not cancelling\n",
-          run_value_, goal_sender_->name());
+      AOS_LOG(INFO,
+              "Action %" PRIx32
+              " on queue %s was interrupted -> not cancelling\n",
+              run_value_, goal_sender_->name());
     } else {
       if (sent_cancel_) {
-        LOG(DEBUG, "Action %" PRIx32 " on queue %s already cancelled\n",
-            run_value_, goal_sender_->name());
+        AOS_LOG(DEBUG, "Action %" PRIx32 " on queue %s already cancelled\n",
+                run_value_, goal_sender_->name());
       } else {
-        LOG(DEBUG, "Canceling action %" PRIx32 " on queue %s\n", run_value_,
-            goal_sender_->name());
+        AOS_LOG(DEBUG, "Canceling action %" PRIx32 " on queue %s\n", run_value_,
+                goal_sender_->name());
         {
           auto goal_message = goal_sender_->MakeMessage();
           goal_message->run = 0;
@@ -259,7 +260,7 @@
 template <typename T>
 bool TypedAction<T>::DoRunning() {
   if (!sent_started_) {
-    LOG(DEBUG, "haven't sent start message yet\n");
+    AOS_LOG(DEBUG, "haven't sent start message yet\n");
     return false;
   }
   if (has_started_) {
@@ -267,7 +268,7 @@
     CheckInterrupted();
   } else {
     while (status_fetcher_->FetchNext()) {
-      LOG_STRUCT(DEBUG, "got status", *status_fetcher_->get());
+      AOS_LOG_STRUCT(DEBUG, "got status", *status_fetcher_->get());
       CheckStarted();
       if (has_started_) CheckInterrupted();
     }
@@ -282,13 +283,13 @@
 
 template <typename T>
 bool TypedAction<T>::DoCheckIteration() {
-  CHECK(sent_started_);
+  AOS_CHECK(sent_started_);
   if (interrupted_) return true;
   CheckStarted();
   if (!status_fetcher_->FetchNext()) {
     return false;
   }
-  LOG_STRUCT(DEBUG, "got status", *status_fetcher_->get());
+  AOS_LOG_STRUCT(DEBUG, "got status", *status_fetcher_->get());
   CheckStarted();
   CheckInterrupted();
   if (has_started_ && (status_fetcher_->get() &&
@@ -307,20 +308,23 @@
          status_fetcher_->get()->last_running == run_value_)) {
       // It's currently running our instance.
       has_started_ = true;
-      LOG(DEBUG, "Action %" PRIx32 " on queue %s has been started\n",
-          run_value_, goal_sender_->name());
+      AOS_LOG(DEBUG, "Action %" PRIx32 " on queue %s has been started\n",
+              run_value_, goal_sender_->name());
     } else if (old_run_value_ != 0 &&
                status_fetcher_->get()->running == old_run_value_) {
-      LOG(DEBUG, "still running old instance %" PRIx32 "\n", old_run_value_);
+      AOS_LOG(DEBUG, "still running old instance %" PRIx32 "\n",
+              old_run_value_);
     } else {
-      LOG(WARNING, "Action %" PRIx32 " on queue %s interrupted by %" PRIx32
-                   " before starting\n",
-          run_value_, goal_sender_->name(), status_fetcher_->get()->running);
+      AOS_LOG(WARNING,
+              "Action %" PRIx32 " on queue %s interrupted by %" PRIx32
+              " before starting\n",
+              run_value_, goal_sender_->name(),
+              status_fetcher_->get()->running);
       has_started_ = true;
       interrupted_ = true;
     }
   } else {
-    LOG(WARNING, "No status message recieved.\n");
+    AOS_LOG(WARNING, "No status message recieved.\n");
   }
 }
 
@@ -329,9 +333,11 @@
   if (!interrupted_ && has_started_ && status_fetcher_->get()) {
     if (status_fetcher_->get()->running != 0 &&
         status_fetcher_->get()->running != run_value_) {
-      LOG(WARNING, "Action %" PRIx32 " on queue %s interrupted by %" PRIx32
-                   " after starting\n",
-          run_value_, goal_sender_->name(), status_fetcher_->get()->running);
+      AOS_LOG(WARNING,
+              "Action %" PRIx32 " on queue %s interrupted by %" PRIx32
+              " after starting\n",
+              run_value_, goal_sender_->name(),
+              status_fetcher_->get()->running);
     }
   }
 }
@@ -339,30 +345,30 @@
 template <typename T>
 void TypedAction<T>::DoStart() {
   if (!sent_started_) {
-    LOG(DEBUG, "Starting action %" PRIx32 "\n", run_value_);
+    AOS_LOG(DEBUG, "Starting action %" PRIx32 "\n", run_value_);
     goal_->run = run_value_;
     goal_->params = params_;
     sent_started_ = true;
     if (!goal_.Send()) {
-      LOG(ERROR, "sending goal for action %" PRIx32 " on queue %s failed\n",
-          run_value_, goal_sender_->name());
+      AOS_LOG(ERROR, "sending goal for action %" PRIx32 " on queue %s failed\n",
+              run_value_, goal_sender_->name());
       // Don't wait to see a message with it.
       has_started_ = true;
     }
     status_fetcher_->FetchNext();
     if (status_fetcher_->get()) {
-      LOG_STRUCT(DEBUG, "got status", *status_fetcher_->get());
+      AOS_LOG_STRUCT(DEBUG, "got status", *status_fetcher_->get());
     }
     if (status_fetcher_->get() && status_fetcher_->get()->running != 0) {
       old_run_value_ = status_fetcher_->get()->running;
-      LOG(INFO, "Action %" PRIx32 " on queue %s already running\n",
-          old_run_value_, goal_sender_->name());
+      AOS_LOG(INFO, "Action %" PRIx32 " on queue %s already running\n",
+              old_run_value_, goal_sender_->name());
     } else {
       old_run_value_ = 0;
     }
   } else {
-    LOG(WARNING, "Action %" PRIx32 " on queue %s already started\n", run_value_,
-        goal_sender_->name());
+    AOS_LOG(WARNING, "Action %" PRIx32 " on queue %s already started\n",
+            run_value_, goal_sender_->name());
   }
 }
 
diff --git a/aos/actions/actor.h b/aos/actions/actor.h
index b55b336..a9b75e6 100644
--- a/aos/actions/actor.h
+++ b/aos/actions/actor.h
@@ -31,7 +31,7 @@
       : event_loop_(event_loop),
         status_sender_(event_loop->MakeSender<StatusType>(name + ".status")),
         goal_fetcher_(event_loop->MakeFetcher<GoalType>(name + ".goal")) {
-    LOG(INFO, "Constructing action %s\n", name.c_str());
+    AOS_LOG(INFO, "Constructing action %s\n", name.c_str());
     event_loop->MakeWatcher(name + ".goal",
                             [this](const GoalType &goal) { HandleGoal(goal); });
 
@@ -43,7 +43,7 @@
       status_message->last_running = 0;
       status_message->success = !abort_;
       if (!status_message.Send()) {
-        LOG(ERROR, "Failed to send the status.\n");
+        AOS_LOG(ERROR, "Failed to send the status.\n");
       }
     });
   }
@@ -118,7 +118,7 @@
 
 template <class T>
 void ActorBase<T>::HandleGoal(const GoalType &goal) {
-  LOG_STRUCT(DEBUG, "action goal", goal);
+  AOS_LOG_STRUCT(DEBUG, "action goal", goal);
   switch (state_) {
     case State::WAITING_FOR_ACTION:
       if (goal.run) {
@@ -129,7 +129,7 @@
         status_message->last_running = 0;
         status_message->success = !abort_;
         if (!status_message.Send()) {
-          LOG(ERROR, "Failed to send the status.\n");
+          AOS_LOG(ERROR, "Failed to send the status.\n");
         }
         break;
       }
@@ -137,20 +137,20 @@
       ++running_count_;
       const uint32_t running_id = goal.run;
       current_id_ = running_id;
-      LOG(INFO, "Starting action %" PRIx32 "\n", running_id);
+      AOS_LOG(INFO, "Starting action %" PRIx32 "\n", running_id);
       {
         auto status_message = status_sender_.MakeMessage();
         status_message->running = running_id;
         status_message->last_running = 0;
         status_message->success = !abort_;
         if (!status_message.Send()) {
-          LOG(ERROR, "Failed to send the status.\n");
+          AOS_LOG(ERROR, "Failed to send the status.\n");
         }
       }
 
-      LOG_STRUCT(INFO, "goal", goal);
+      AOS_LOG_STRUCT(INFO, "goal", goal);
       abort_ = !RunAction(goal.params);
-      LOG(INFO, "Done with action %" PRIx32 "\n", running_id);
+      AOS_LOG(INFO, "Done with action %" PRIx32 "\n", running_id);
       current_id_ = 0u;
 
       {
@@ -160,19 +160,19 @@
         status_message->success = !abort_;
 
         if (!status_message.Send()) {
-          LOG(ERROR, "Failed to send the status.\n");
+          AOS_LOG(ERROR, "Failed to send the status.\n");
         } else {
-          LOG(INFO, "Sending Done status %" PRIx32 "\n", running_id);
+          AOS_LOG(INFO, "Sending Done status %" PRIx32 "\n", running_id);
         }
       }
 
       state_ = State::WAITING_FOR_STOPPED;
-      LOG(INFO, "Waiting for the action (%" PRIx32 ") to be stopped.\n",
-          running_id);
+      AOS_LOG(INFO, "Waiting for the action (%" PRIx32 ") to be stopped.\n",
+              running_id);
     } break;
     case State::WAITING_FOR_STOPPED:
       if (goal.run == 0) {
-        LOG(INFO, "Action stopped.\n");
+        AOS_LOG(INFO, "Action stopped.\n");
         state_ = State::WAITING_FOR_ACTION;
       }
       break;
@@ -194,7 +194,7 @@
     }
     if (end_time != ::aos::monotonic_clock::min_time &&
         ::aos::monotonic_clock::now() >= end_time) {
-      LOG(DEBUG, "WaitUntil timed out\n");
+      AOS_LOG(DEBUG, "WaitUntil timed out\n");
       return false;
     }
     phased_loop.SleepUntilNext();
@@ -211,11 +211,11 @@
 template <class T>
 bool ActorBase<T>::ShouldCancel() {
   if (goal_fetcher_.Fetch()) {
-    LOG_STRUCT(DEBUG, "goal queue", *goal_fetcher_);
+    AOS_LOG_STRUCT(DEBUG, "goal queue", *goal_fetcher_);
   }
   bool ans = !goal_fetcher_->run || goal_fetcher_->run != current_id_;
   if (ans) {
-    LOG(INFO, "Time to stop action\n");
+    AOS_LOG(INFO, "Time to stop action\n");
   }
   return ans;
 }
diff --git a/aos/condition.cc b/aos/condition.cc
index 1e137b7..0c81e2c 100644
--- a/aos/condition.cc
+++ b/aos/condition.cc
@@ -28,7 +28,7 @@
   const bool do_timeout = timeout != chrono::nanoseconds(0);
 
   if (do_timeout) {
-    PCHECK(clock_gettime(CLOCK_MONOTONIC, &end_time) == 0);
+    AOS_PCHECK(clock_gettime(CLOCK_MONOTONIC, &end_time) == 0);
     timeout += chrono::nanoseconds(end_time.tv_nsec);
     chrono::seconds timeout_seconds =
         chrono::duration_cast<chrono::seconds>(timeout);
diff --git a/aos/condition_test.cc b/aos/condition_test.cc
index 602513e..1e8d06c 100644
--- a/aos/condition_test.cc
+++ b/aos/condition_test.cc
@@ -150,7 +150,7 @@
     new (shared_) Shared();
   }
   ~ConditionTestProcess() {
-    CHECK_EQ(child_, -1);
+    AOS_CHECK_EQ(child_, -1);
   }
 
   void Start() {
@@ -162,7 +162,7 @@
       Run();
       exit(EXIT_SUCCESS);
     } else {  // in parent
-      CHECK_NE(child_, -1);
+      AOS_CHECK_NE(child_, -1);
 
       ASSERT_EQ(0, futex_wait(&shared_->ready));
 
@@ -189,7 +189,7 @@
         return ::testing::AssertionSuccess() << "already been too long";
       }
     } else {
-      CHECK_EQ(0, futex_wait(&shared_->done_delaying));
+      AOS_CHECK_EQ(0, futex_wait(&shared_->done_delaying));
     }
     ::std::this_thread::sleep_for(chrono::milliseconds(10));
     if (!shared_->finished) {
@@ -250,16 +250,16 @@
   }
 
   void Join() {
-    CHECK_NE(child_, -1);
+    AOS_CHECK_NE(child_, -1);
     int status;
     do {
-      CHECK_EQ(waitpid(child_, &status, 0), child_);
+      AOS_CHECK_EQ(waitpid(child_, &status, 0), child_);
     } while (!(WIFEXITED(status) || WIFSIGNALED(status)));
     child_ = -1;
   }
   void Kill() {
-    CHECK_NE(child_, -1);
-    PCHECK(kill(child_, SIGTERM));
+    AOS_CHECK_NE(child_, -1);
+    AOS_PCHECK(kill(child_, SIGTERM));
     Join();
   }
 
diff --git a/aos/controls/control_loop-tmpl.h b/aos/controls/control_loop-tmpl.h
index 4f48737..7628c26 100644
--- a/aos/controls/control_loop-tmpl.h
+++ b/aos/controls/control_loop-tmpl.h
@@ -28,26 +28,26 @@
   no_sensor_state_.Print();
   motors_off_log_.Print();
 
-  LOG_STRUCT(DEBUG, "position", position);
+  AOS_LOG_STRUCT(DEBUG, "position", position);
 
   // Fetch the latest control loop goal. If there is no new
   // goal, we will just reuse the old one.
   goal_fetcher_.Fetch();
   const GoalType *goal = goal_fetcher_.get();
   if (goal) {
-    LOG_STRUCT(DEBUG, "goal", *goal);
+    AOS_LOG_STRUCT(DEBUG, "goal", *goal);
   } else {
-    LOG_INTERVAL(no_goal_);
+    AOS_LOG_INTERVAL(no_goal_);
   }
 
   const bool new_robot_state = robot_state_fetcher_.Fetch();
   if (!robot_state_fetcher_.get()) {
-    LOG_INTERVAL(no_sensor_state_);
+    AOS_LOG_INTERVAL(no_sensor_state_);
     return;
   }
   if (sensor_reader_pid_ != robot_state_fetcher_->reader_pid) {
-    LOG(INFO, "new sensor reader PID %" PRId32 ", old was %" PRId32 "\n",
-        robot_state_fetcher_->reader_pid, sensor_reader_pid_);
+    AOS_LOG(INFO, "new sensor reader PID %" PRId32 ", old was %" PRId32 "\n",
+            robot_state_fetcher_->reader_pid, sensor_reader_pid_);
     reset_ = true;
     sensor_reader_pid_ = robot_state_fetcher_->reader_pid;
   }
@@ -70,7 +70,7 @@
   joystick_state_fetcher_.Fetch();
   if (motors_off) {
     if (joystick_state_fetcher_.get() && joystick_state_fetcher_->enabled) {
-      LOG_INTERVAL(motors_off_log_);
+      AOS_LOG_INTERVAL(motors_off_log_);
     }
     outputs_enabled = false;
   }
@@ -87,7 +87,7 @@
     RunIteration(goal, &position, output.get(), status.get());
 
     output->SetTimeToNow();
-    LOG_STRUCT(DEBUG, "output", *output);
+    AOS_LOG_STRUCT(DEBUG, "output", *output);
     output.Send();
   } else {
     // The outputs are disabled, so pass nullptr in for the output.
@@ -96,7 +96,7 @@
   }
 
   status->SetTimeToNow();
-  LOG_STRUCT(DEBUG, "status", *status);
+  AOS_LOG_STRUCT(DEBUG, "status", *status);
   status.Send();
 }
 
diff --git a/aos/controls/control_loop_test.h b/aos/controls/control_loop_test.h
index 85d610e..ff11987 100644
--- a/aos/controls/control_loop_test.h
+++ b/aos/controls/control_loop_test.h
@@ -98,7 +98,7 @@
       new_state->autonomous = false;
       new_state->team_id = team_id_;
 
-      LOG_STRUCT(INFO, "joystick_state", *new_state);
+      AOS_LOG_STRUCT(INFO, "joystick_state", *new_state);
       new_state.Send();
 
       last_ds_time_ = monotonic_now();
@@ -123,7 +123,7 @@
     new_state->voltage_roborio_in = battery_voltage_;
     new_state->voltage_battery = battery_voltage_;
 
-    LOG_STRUCT(INFO, "robot_state", *new_state);
+    AOS_LOG_STRUCT(INFO, "robot_state", *new_state);
     new_state.Send();
   }
 
diff --git a/aos/controls/polytope.h b/aos/controls/polytope.h
index 145b904..5248ea3 100644
--- a/aos/controls/polytope.h
+++ b/aos/controls/polytope.h
@@ -191,9 +191,9 @@
   if (error != dd_NoError || polyhedra == NULL) {
     dd_WriteErrorMessages(stderr, error);
     dd_FreeMatrix(matrix);
-    LOG_MATRIX(ERROR, "bad H", H);
-    LOG_MATRIX(ERROR, "bad k_", k);
-    LOG(FATAL, "dd_DDMatrix2Poly failed\n");
+    AOS_LOG_MATRIX(ERROR, "bad H", H);
+    AOS_LOG_MATRIX(ERROR, "bad k_", k);
+    AOS_LOG(FATAL, "dd_DDMatrix2Poly failed\n");
   }
 
   dd_MatrixPtr vertex_matrix = dd_CopyGenerators(polyhedra);
@@ -209,7 +209,7 @@
   }
 
   // Rays are unsupported right now.  This may change in the future.
-  CHECK_EQ(0, num_rays);
+  AOS_CHECK_EQ(0, num_rays);
 
   Eigen::Matrix<double, number_of_dimensions, Eigen::Dynamic> vertices(
       number_of_dimensions, num_vertices);
diff --git a/aos/controls/replay_control_loop.h b/aos/controls/replay_control_loop.h
index 1626c0a..23593ab 100644
--- a/aos/controls/replay_control_loop.h
+++ b/aos/controls/replay_control_loop.h
@@ -74,7 +74,7 @@
     CaptureMessage() {}
 
     void operator()(const S &message) {
-      CHECK(!have_new_message_);
+      AOS_CHECK(!have_new_message_);
       saved_message_ = message;
       have_new_message_ = true;
     }
@@ -118,14 +118,14 @@
     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);
   DoProcessFile();
   replayer_.CloseCurrentFile();
 
-  PCHECK(close(fd));
+  AOS_PCHECK(close(fd));
 }
 
 template <class T>
@@ -140,7 +140,7 @@
     // Send out the position message (after adjusting the time offset) so the
     // loop will run right now.
     if (!position_.have_new_message()) {
-      LOG(WARNING, "don't have a new position this cycle -> skipping\n");
+      AOS_LOG(WARNING, "don't have a new position this cycle -> skipping\n");
       status_.clear_new_message();
       position_.clear_new_message();
       output_.clear_new_message();
@@ -150,7 +150,7 @@
     {
       auto position_message = loop_group_->position.MakeMessage();
       *position_message = position_.saved_message();
-      CHECK(position_message.Send());
+      AOS_CHECK(position_message.Send());
     }
     position_.clear_new_message();
 
@@ -159,8 +159,8 @@
 
     // Point out if the status is different.
     if (!loop_group_->status->EqualsNoTime(status_.saved_message())) {
-      LOG_STRUCT(WARNING, "expected status", status_.saved_message());
-      LOG_STRUCT(WARNING, "got status", *loop_group_->status);
+      AOS_LOG_STRUCT(WARNING, "expected status", status_.saved_message());
+      AOS_LOG_STRUCT(WARNING, "got status", *loop_group_->status);
     }
     status_.clear_new_message();
 
@@ -169,17 +169,17 @@
     bool loop_new_output = loop_group_->output.FetchLatest();
     if (output_.have_new_message()) {
       if (!loop_new_output) {
-        LOG_STRUCT(WARNING, "no output, expected", output_.saved_message());
+        AOS_LOG_STRUCT(WARNING, "no output, expected", output_.saved_message());
       } else if (!loop_group_->output->EqualsNoTime(output_.saved_message())) {
-        LOG_STRUCT(WARNING, "expected output", output_.saved_message());
-        LOG_STRUCT(WARNING, "got output", *loop_group_->output);
+        AOS_LOG_STRUCT(WARNING, "expected output", output_.saved_message());
+        AOS_LOG_STRUCT(WARNING, "got output", *loop_group_->output);
       }
     } else if (loop_new_output) {
       if (zero_output_.have_new_message()) {
         if (!loop_group_->output->EqualsNoTime(zero_output_.saved_message())) {
-          LOG_STRUCT(WARNING, "expected null output",
-                     zero_output_.saved_message());
-          LOG_STRUCT(WARNING, "got output", *loop_group_->output);
+          AOS_LOG_STRUCT(WARNING, "expected null output",
+                         zero_output_.saved_message());
+          AOS_LOG_STRUCT(WARNING, "got output", *loop_group_->output);
         }
       } else {
         zero_output_(*loop_group_->output);
diff --git a/aos/dump_rtprio.cc b/aos/dump_rtprio.cc
index 2b821cf..12000f0 100644
--- a/aos/dump_rtprio.cc
+++ b/aos/dump_rtprio.cc
@@ -55,17 +55,17 @@
   int r;
   FILE *pid_max_file = fopen("/proc/sys/kernel/pid_max", "r");
   if (pid_max_file == nullptr) {
-    PLOG(FATAL, "fopen(\"/proc/sys/kernel/pid_max\")");
+    AOS_PLOG(FATAL, "fopen(\"/proc/sys/kernel/pid_max\")");
   }
-  CHECK_EQ(1, fscanf(pid_max_file, "%d", &r));
-  PCHECK(fclose(pid_max_file));
+  AOS_CHECK_EQ(1, fscanf(pid_max_file, "%d", &r));
+  AOS_PCHECK(fclose(pid_max_file));
   return r;
 }
 
 cpu_set_t find_all_cpus() {
   long nproc = sysconf(_SC_NPROCESSORS_CONF);
   if (nproc == -1) {
-    PLOG(FATAL, "sysconf(_SC_NPROCESSORS_CONF)");
+    AOS_PLOG(FATAL, "sysconf(_SC_NPROCESSORS_CONF)");
   }
   cpu_set_t r;
   CPU_ZERO(&r);
@@ -83,7 +83,7 @@
     return cpu_set_t();
   }
   if (result != 0) {
-    PLOG(FATAL, "sched_getaffinity(%d, %zu, %p)", process, sizeof(r), &r);
+    AOS_PLOG(FATAL, "sched_getaffinity(%d, %zu, %p)", process, sizeof(r), &r);
   }
   return r;
 }
@@ -96,7 +96,7 @@
     return sched_param();
   }
   if (result != 0) {
-    PLOG(FATAL, "sched_getparam(%d)", process);
+    AOS_PLOG(FATAL, "sched_getparam(%d)", process);
   }
   return r;
 }
@@ -108,7 +108,7 @@
     return 0;
   }
   if (scheduler == -1) {
-    PLOG(FATAL, "sched_getscheduler(%d)", process);
+    AOS_PLOG(FATAL, "sched_getscheduler(%d)", process);
   }
   return scheduler;
 }
@@ -126,8 +126,8 @@
       return "";
     }
     if (exe_size == -1) {
-      PLOG(FATAL, "readlink(%s, %p, %zu)", exe_filename.c_str(), exe_buffer,
-           sizeof(exe_buffer));
+      AOS_PLOG(FATAL, "readlink(%s, %p, %zu)", exe_filename.c_str(), exe_buffer,
+               sizeof(exe_buffer));
     }
     return ::std::string(exe_buffer, exe_size);
   }
@@ -141,7 +141,7 @@
     return 0;
   }
   if (errno != 0) {
-    PLOG(FATAL, "getpriority(PRIO_PROCESS, %d)", process);
+    AOS_PLOG(FATAL, "getpriority(PRIO_PROCESS, %d)", process);
   }
   return nice_value;
 }
@@ -154,7 +154,7 @@
     return;
   }
   if (stat == nullptr) {
-    PLOG(FATAL, "fopen(%s, \"r\")", stat_filename.c_str());
+    AOS_PLOG(FATAL, "fopen(%s, \"r\")", stat_filename.c_str());
   }
 
   char buffer[2048];
@@ -164,7 +164,7 @@
         *not_there = true;
         return;
       }
-      PLOG(FATAL, "fgets(%p, %zu, %p)", buffer, sizeof(buffer), stat);
+      AOS_PLOG(FATAL, "fgets(%p, %zu, %p)", buffer, sizeof(buffer), stat);
     }
   }
 
@@ -197,12 +197,12 @@
       field_start = i + 1;
     }
   }
-  PCHECK(fclose(stat));
+  AOS_PCHECK(fclose(stat));
 
   if (field < 4) {
-    LOG(FATAL, "couldn't get fields from /proc/%d/stat\n", process);
+    AOS_LOG(FATAL, "couldn't get fields from /proc/%d/stat\n", process);
   }
-  CHECK_EQ(pid, process);
+  AOS_CHECK_EQ(pid, process);
 }
 
 void read_status(int process, int ppid, int *pgrp, ::std::string *name,
@@ -215,7 +215,7 @@
     return;
   }
   if (status == nullptr) {
-    PLOG(FATAL, "fopen(%s, \"r\")", status_filename.c_str());
+    AOS_PLOG(FATAL, "fopen(%s, \"r\")", status_filename.c_str());
   }
 
   int pid = 0, status_ppid = 0;
@@ -223,7 +223,7 @@
     char buffer[1024];
     if (fgets(buffer, sizeof(buffer), status) == nullptr) {
       if (ferror(status)) {
-        PLOG(FATAL, "fgets(%p, %zu, %p)", buffer, sizeof(buffer), status);
+        AOS_PLOG(FATAL, "fgets(%p, %zu, %p)", buffer, sizeof(buffer), status);
       } else {
         break;
       }
@@ -239,9 +239,9 @@
       *pgrp = ::std::stoi(strip_string_prefix(5, line));
     }
   }
-  PCHECK(fclose(status));
-  CHECK_EQ(pid, process);
-  CHECK_EQ(status_ppid, ppid);
+  AOS_PCHECK(fclose(status));
+  AOS_CHECK_EQ(pid, process);
+  AOS_CHECK_EQ(status_ppid, ppid);
 }
 
 }  // namespace
diff --git a/aos/event.cc b/aos/event.cc
index dd43dc8..a0115dc 100644
--- a/aos/event.cc
+++ b/aos/event.cc
@@ -16,8 +16,8 @@
   while (__atomic_load_n(&impl_, __ATOMIC_SEQ_CST) == 0) {
     const int ret = futex_wait(&impl_);
     if (ret != 0) {
-      CHECK_EQ(-1, ret);
-      PLOG(FATAL, "futex_wait(%p) failed", &impl_);
+      AOS_CHECK_EQ(-1, ret);
+      AOS_PLOG(FATAL, "futex_wait(%p) failed", &impl_);
     }
   }
 }
@@ -37,8 +37,8 @@
     const int ret = futex_wait_timeout(&impl_, &timeout_timespec);
     if (ret != 0) {
       if (ret == 2) return false;
-      CHECK_EQ(-1, ret);
-      PLOG(FATAL, "futex_wait(%p) failed", &impl_);
+      AOS_CHECK_EQ(-1, ret);
+      AOS_PLOG(FATAL, "futex_wait(%p) failed", &impl_);
     }
   }
 }
@@ -47,7 +47,7 @@
 // to condition variable-based implementations.
 void Event::Set() {
   if (futex_set(&impl_) == -1) {
-    PLOG(FATAL, "futex_set(%p) failed", &impl_);
+    AOS_PLOG(FATAL, "futex_set(%p) failed", &impl_);
   }
 }
 
diff --git a/aos/events/BUILD b/aos/events/BUILD
index ef033f8..b69fc66 100644
--- a/aos/events/BUILD
+++ b/aos/events/BUILD
@@ -4,8 +4,8 @@
     hdrs = ["epoll.h"],
     visibility = ["//visibility:public"],
     deps = [
-        "//aos/logging",
         "//aos/time",
+        "@com_github_google_glog//:glog",
     ],
 )
 
diff --git a/aos/events/epoll.cc b/aos/events/epoll.cc
index 83f44c3..3da04cf 100644
--- a/aos/events/epoll.cc
+++ b/aos/events/epoll.cc
@@ -7,8 +7,8 @@
 #include <atomic>
 #include <vector>
 
-#include "aos/logging/logging.h"
 #include "aos/time/time.h"
+#include "glog/logging.h"
 
 namespace aos {
 namespace internal {
@@ -19,6 +19,8 @@
   Disable();
 }
 
+TimerFd::~TimerFd() { PCHECK(close(fd_) == 0); }
+
 void TimerFd::SetTime(monotonic_clock::time_point start,
                       monotonic_clock::duration interval) {
   struct itimerspec new_value;
@@ -56,7 +58,8 @@
   DeleteFd(quit_epoll_fd_);
   close(quit_signal_fd_);
   close(quit_epoll_fd_);
-  CHECK_EQ(fns_.size(), 0u);
+  CHECK_EQ(fns_.size(), 0u)
+      << ": Not all file descriptors were unregistered before shutting down.";
   close(epoll_fd_);
 }
 
@@ -96,14 +99,15 @@
   struct epoll_event event;
   event.events = EPOLLIN | EPOLLPRI;
   event.data.ptr = event_data.get();
-  PCHECK(epoll_ctl(epoll_fd_, EPOLL_CTL_ADD, fd, &event) != 0);
+  PCHECK(epoll_ctl(epoll_fd_, EPOLL_CTL_ADD, fd, &event) == 0)
+      << ": Failed to add fd " << fd;
   fns_.push_back(::std::move(event_data));
 }
 
 // Removes fd from the event loop.
 void EPoll::DeleteFd(int fd) {
   auto element = fns_.begin();
-  PCHECK(epoll_ctl(epoll_fd_, EPOLL_CTL_DEL, fd, nullptr) != 0);
+  PCHECK(epoll_ctl(epoll_fd_, EPOLL_CTL_DEL, fd, nullptr) == 0);
   while (fns_.end() != element) {
     if (element->get()->fd == fd) {
       fns_.erase(element);
@@ -111,7 +115,7 @@
     }
     ++element;
   }
-  LOG(FATAL, "fd %d not found\n", fd);
+  LOG(FATAL) << "fd " << fd << " not found";
 }
 
 }  // namespace internal
diff --git a/aos/events/epoll.h b/aos/events/epoll.h
index 29311c9..f6ebe95 100644
--- a/aos/events/epoll.h
+++ b/aos/events/epoll.h
@@ -8,7 +8,6 @@
 #include <atomic>
 #include <vector>
 
-#include "aos/logging/logging.h"
 #include "aos/time/time.h"
 
 namespace aos {
@@ -18,7 +17,7 @@
 class TimerFd {
  public:
   TimerFd();
-  ~TimerFd() { PCHECK(close(fd_) == 0); }
+  ~TimerFd();
 
   TimerFd(const TimerFd &) = delete;
   TimerFd &operator=(const TimerFd &) = delete;
diff --git a/aos/events/event-loop_param_test.cc b/aos/events/event-loop_param_test.cc
index 1dcc258..04343cc 100644
--- a/aos/events/event-loop_param_test.cc
+++ b/aos/events/event-loop_param_test.cc
@@ -5,7 +5,7 @@
 #include "gmock/gmock.h"
 #include "gtest/gtest.h"
 
-#include "aos/logging/queue_logging.h"
+#include "glog/logging.h"
 
 namespace aos {
 namespace testing {
@@ -564,7 +564,7 @@
       [&times, &loop1, this](int count) {
         EXPECT_EQ(count, 1);
         times.push_back(loop1->monotonic_now());
-        LOG(INFO, "%zu\n", times.size());
+        LOG(INFO) << times.size();
         if (times.size() == kCount) {
           this->Exit();
         }
diff --git a/aos/events/shm-event-loop.cc b/aos/events/shm-event-loop.cc
index 4984f59..5034f0b 100644
--- a/aos/events/shm-event-loop.cc
+++ b/aos/events/shm-event-loop.cc
@@ -128,7 +128,7 @@
       // Try joining.  If we fail, we weren't asleep on the condition in the
       // queue.  So hit it again and again until that's true.
       struct timespec end_time;
-      PCHECK(clock_gettime(CLOCK_REALTIME, &end_time) == 0);
+      AOS_PCHECK(clock_gettime(CLOCK_REALTIME, &end_time) == 0);
       while (true) {
         void *retval = nullptr;
         end_time.tv_nsec += 100000000;
@@ -138,7 +138,7 @@
         }
         int ret = pthread_timedjoin_np(pthread_, &retval, &end_time);
         if (ret == ETIMEDOUT) continue;
-        PCHECK(ret == 0);
+        AOS_PCHECK(ret == 0);
         break;
       }
     }
@@ -146,11 +146,11 @@
 
   // Starts the thread and waits until it is running.
   void Start() {
-    PCHECK(pthread_create(&pthread_, nullptr, &StaticRun, this) == 0);
+    AOS_PCHECK(pthread_create(&pthread_, nullptr, &StaticRun, this) == 0);
     IPCRecursiveMutexLocker locker(&thread_started_mutex_);
     if (locker.owner_died()) ::aos::Die("Owner died");
     while (!running_) {
-      CHECK(!thread_started_condition_.Wait());
+      AOS_CHECK(!thread_started_condition_.Wait());
     }
   }
 
diff --git a/aos/events/shm-event-loop_test.cc b/aos/events/shm-event-loop_test.cc
index 8af00f0..e0d0b49 100644
--- a/aos/events/shm-event-loop_test.cc
+++ b/aos/events/shm-event-loop_test.cc
@@ -22,9 +22,9 @@
     return ::std::move(loop);
   }
 
-  void Run() override { CHECK_NOTNULL(primary_event_loop_)->Run(); }
+  void Run() override { AOS_CHECK_NOTNULL(primary_event_loop_)->Run(); }
 
-  void Exit() override { CHECK_NOTNULL(primary_event_loop_)->Exit(); }
+  void Exit() override { AOS_CHECK_NOTNULL(primary_event_loop_)->Exit(); }
 
   void SleepFor(::std::chrono::nanoseconds duration) override {
     ::std::this_thread::sleep_for(duration);
@@ -61,9 +61,9 @@
 bool IsRealtime() {
   int scheduler;
   if ((scheduler = sched_getscheduler(0)) == -1) {
-    PLOG(FATAL, "sched_getscheduler(0) failed\n");
+    AOS_PLOG(FATAL, "sched_getscheduler(0) failed\n");
   }
-  LOG(INFO, "scheduler is %d\n", scheduler);
+  AOS_LOG(INFO, "scheduler is %d\n", scheduler);
   return scheduler == SCHED_FIFO || scheduler == SCHED_RR;
 }
 
diff --git a/aos/events/simulated-event-loop.h b/aos/events/simulated-event-loop.h
index 0828382..2fcc9d1 100644
--- a/aos/events/simulated-event-loop.h
+++ b/aos/events/simulated-event-loop.h
@@ -148,7 +148,7 @@
                           EventScheduler *scheduler)
       : type_(type), name_(name), scheduler_(scheduler){};
 
-  ~SimulatedQueue() { CHECK_EQ(0u, fetchers_.size()); }
+  ~SimulatedQueue() { AOS_CHECK_EQ(0u, fetchers_.size()); }
 
   // Makes a connected raw sender which calls Send below.
   ::std::unique_ptr<RawSender> MakeRawSender(EventLoop *event_loop);
diff --git a/aos/init.cc b/aos/init.cc
index 8ce70ea..fdb1800 100644
--- a/aos/init.cc
+++ b/aos/init.cc
@@ -78,9 +78,9 @@
   }
 
   // Don't give freed memory back to the OS.
-  CHECK_EQ(1, mallopt(M_TRIM_THRESHOLD, -1));
+  AOS_CHECK_EQ(1, mallopt(M_TRIM_THRESHOLD, -1));
   // Don't use mmap for large malloc chunks.
-  CHECK_EQ(1, mallopt(M_MMAP_MAX, 0));
+  AOS_CHECK_EQ(1, mallopt(M_MMAP_MAX, 0));
 
   if (&FLAGS_tcmalloc_release_rate) {
     // Tell tcmalloc not to return memory.
@@ -103,14 +103,14 @@
   InitStart();
   aos_core_create_shared_mem(false, for_realtime && ShouldBeRealtime());
   logging::RegisterQueueImplementation();
-  LOG(INFO, "%s initialized non-realtime\n", program_invocation_short_name);
+  AOS_LOG(INFO, "%s initialized non-realtime\n", program_invocation_short_name);
 }
 
 void InitCreate() {
   InitStart();
   aos_core_create_shared_mem(true, false);
   logging::RegisterQueueImplementation();
-  LOG(INFO, "%s created shm\n", program_invocation_short_name);
+  AOS_LOG(INFO, "%s created shm\n", program_invocation_short_name);
 }
 
 void Init(int relative_priority) {
@@ -148,7 +148,7 @@
     printf("no realtime for %s. see stderr\n", program_invocation_short_name);
   }
 
-  LOG(INFO, "%s initialized realtime\n", program_invocation_short_name);
+  AOS_LOG(INFO, "%s initialized realtime\n", program_invocation_short_name);
 }
 
 void Cleanup() {
@@ -167,7 +167,7 @@
   struct sched_param param;
   param.sched_priority = priority;
   if (sched_setscheduler(0, SCHED_FIFO, &param) == -1) {
-    PLOG(FATAL, "sched_setscheduler(0, SCHED_FIFO, %d) failed\n", priority);
+    AOS_PLOG(FATAL, "sched_setscheduler(0, SCHED_FIFO, %d) failed\n", priority);
   }
 }
 
@@ -175,7 +175,7 @@
   struct sched_param param;
   param.sched_priority = 0;
   if (sched_setscheduler(0, SCHED_OTHER, &param) == -1) {
-    PLOG(FATAL, "sched_setscheduler(0, SCHED_OTHER, 0) failed\n");
+    AOS_PLOG(FATAL, "sched_setscheduler(0, SCHED_OTHER, 0) failed\n");
   }
 }
 
@@ -183,15 +183,15 @@
   cpu_set_t cpuset;
   CPU_ZERO(&cpuset);
   CPU_SET(number, &cpuset);
-  PRCHECK(pthread_setaffinity_np(pthread_self(), sizeof(cpuset), &cpuset));
+  AOS_PRCHECK(pthread_setaffinity_np(pthread_self(), sizeof(cpuset), &cpuset));
 }
 
 void SetCurrentThreadName(const ::std::string &name) {
   if (name.size() > 16) {
-    LOG(FATAL, "thread name '%s' too long\n", name.c_str());
+    AOS_LOG(FATAL, "thread name '%s' too long\n", name.c_str());
   }
-  LOG(INFO, "this thread is changing to '%s'\n", name.c_str());
-  PCHECK(prctl(PR_SET_NAME, name.c_str()));
+  AOS_LOG(INFO, "this thread is changing to '%s'\n", name.c_str());
+  AOS_PCHECK(prctl(PR_SET_NAME, name.c_str()));
   logging::internal::ReloadThreadName();
 }
 
diff --git a/aos/input/action_joystick_input.cc b/aos/input/action_joystick_input.cc
index 4c3fef1..509f4c5 100644
--- a/aos/input/action_joystick_input.cc
+++ b/aos/input/action_joystick_input.cc
@@ -31,7 +31,7 @@
     }
     if (!data.GetControlBit(ControlBit::kEnabled)) {
       action_queue_.CancelAllActions();
-      LOG(DEBUG, "Canceling\n");
+      AOS_LOG(DEBUG, "Canceling\n");
     }
     drivetrain_input_reader_->HandleDrivetrain(data);
     HandleTeleop(data);
@@ -48,14 +48,14 @@
 }
 
 void ActionJoystickInput::StartAuto() {
-  LOG(INFO, "Starting auto mode\n");
+  AOS_LOG(INFO, "Starting auto mode\n");
   action_queue_.EnqueueAction(
       autonomous_action_factory_.Make(GetAutonomousMode()));
   auto_action_running_ = true;
 }
 
 void ActionJoystickInput::StopAuto() {
-  LOG(INFO, "Stopping auto mode\n");
+  AOS_LOG(INFO, "Stopping auto mode\n");
   action_queue_.CancelAllActions();
   auto_action_running_ = false;
   AutoEnded();
diff --git a/aos/input/action_joystick_input.h b/aos/input/action_joystick_input.h
index 2536a8d..3057ace 100644
--- a/aos/input/action_joystick_input.h
+++ b/aos/input/action_joystick_input.h
@@ -96,7 +96,7 @@
   virtual uint32_t GetAutonomousMode() {
     autonomous_mode_fetcher_.Fetch();
     if (autonomous_mode_fetcher_.get() == nullptr) {
-      LOG(WARNING, "no auto mode values\n");
+      AOS_LOG(WARNING, "no auto mode values\n");
       return 0;
     }
     return autonomous_mode_fetcher_->mode;
diff --git a/aos/input/drivetrain_input.cc b/aos/input/drivetrain_input.cc
index eddbdc5..a0bbf2c 100644
--- a/aos/input/drivetrain_input.cc
+++ b/aos/input/drivetrain_input.cc
@@ -100,7 +100,7 @@
   new_drivetrain_goal->linear.max_acceleration = 20.0;
 
   if (!new_drivetrain_goal.Send()) {
-    LOG(WARNING, "sending stick values failed\n");
+    AOS_LOG(WARNING, "sending stick values failed\n");
   }
 
   last_is_control_loop_driving_ = is_control_loop_driving;
diff --git a/aos/input/joystick_input.cc b/aos/input/joystick_input.cc
index 0bbba41..d1bd302 100644
--- a/aos/input/joystick_input.cc
+++ b/aos/input/joystick_input.cc
@@ -24,37 +24,37 @@
       for (int button = 1; button <= ButtonLocation::kButtons; ++button) {
         ButtonLocation location(joystick, button);
         if (data_.PosEdge(location)) {
-          LOG(INFO, "PosEdge(%d, %d)\n", joystick, button);
+          AOS_LOG(INFO, "PosEdge(%d, %d)\n", joystick, button);
         }
         if (data_.NegEdge(location)) {
-          LOG(INFO, "NegEdge(%d, %d)\n", joystick, button);
+          AOS_LOG(INFO, "NegEdge(%d, %d)\n", joystick, button);
         }
       }
       if (data_.GetPOV(joystick) != data_.GetOldPOV(joystick)) {
-        LOG(INFO, "POV %d %d->%d\n", joystick, data_.GetOldPOV(joystick),
-            data_.GetPOV(joystick));
+        AOS_LOG(INFO, "POV %d %d->%d\n", joystick, data_.GetOldPOV(joystick),
+                data_.GetPOV(joystick));
       }
     }
   }
   {
     using driver_station::ControlBit;
     if (data_.PosEdge(ControlBit::kFmsAttached)) {
-      LOG(INFO, "PosEdge(kFmsAttached)\n");
+      AOS_LOG(INFO, "PosEdge(kFmsAttached)\n");
     }
     if (data_.NegEdge(ControlBit::kFmsAttached)) {
-      LOG(INFO, "NegEdge(kFmsAttached)\n");
+      AOS_LOG(INFO, "NegEdge(kFmsAttached)\n");
     }
     if (data_.PosEdge(ControlBit::kAutonomous)) {
-      LOG(INFO, "PosEdge(kAutonomous)\n");
+      AOS_LOG(INFO, "PosEdge(kAutonomous)\n");
     }
     if (data_.NegEdge(ControlBit::kAutonomous)) {
-      LOG(INFO, "NegEdge(kAutonomous)\n");
+      AOS_LOG(INFO, "NegEdge(kAutonomous)\n");
     }
     if (data_.PosEdge(ControlBit::kEnabled)) {
-      LOG(INFO, "PosEdge(kEnabled)\n");
+      AOS_LOG(INFO, "PosEdge(kEnabled)\n");
     }
     if (data_.NegEdge(ControlBit::kEnabled)) {
-      LOG(INFO, "NegEdge(kEnabled)\n");
+      AOS_LOG(INFO, "NegEdge(kEnabled)\n");
     }
   }
 
diff --git a/aos/ipc_lib/BUILD b/aos/ipc_lib/BUILD
index 76c5324..1e8b118 100644
--- a/aos/ipc_lib/BUILD
+++ b/aos/ipc_lib/BUILD
@@ -192,6 +192,7 @@
         "//aos/logging",
         "//aos/time",
         "//aos/util:compiler_memory_barrier",
+        "@com_github_google_glog//:glog",
     ],
 )
 
diff --git a/aos/ipc_lib/aos_sync.cc b/aos/ipc_lib/aos_sync.cc
index 572b864..101a189 100644
--- a/aos/ipc_lib/aos_sync.cc
+++ b/aos/ipc_lib/aos_sync.cc
@@ -354,16 +354,16 @@
   return r;
 }
 
-// This gets called by functions before LOG(FATAL)ing with error messages that
-// would be incorrect if the error was caused by a process forking without
+// This gets called by functions before AOS_LOG(FATAL)ing with error messages
+// that would be incorrect if the error was caused by a process forking without
 // initialize_in_new_thread getting called in the fork.
 void check_cached_tid(pid_t tid) {
   pid_t actual = do_get_tid();
   if (tid != actual) {
-    LOG(FATAL,
-        "task %jd forked into %jd without letting aos_sync know"
-        " so we're not really sure what's going on\n",
-        static_cast<intmax_t>(tid), static_cast<intmax_t>(actual));
+    AOS_LOG(FATAL,
+            "task %jd forked into %jd without letting aos_sync know"
+            " so we're not really sure what's going on\n",
+            static_cast<intmax_t>(tid), static_cast<intmax_t>(actual));
   }
 }
 
@@ -379,7 +379,7 @@
 
 void *InstallAtforkHook() {
   if (pthread_atfork(NULL, NULL, atfork_child) != 0) {
-    PLOG(FATAL, "pthread_atfork(NULL, NULL, %p) failed", atfork_child);
+    AOS_PLOG(FATAL, "pthread_atfork(NULL, NULL, %p) failed", atfork_child);
   }
   return nullptr;
 }
@@ -475,8 +475,8 @@
   robust_head.pending_next = 0;
   if (syscall(SYS_set_robust_list, robust_head_next_value(), sizeof(robust_head)) !=
       0) {
-    PLOG(FATAL, "set_robust_list(%p, %zd) failed",
-         reinterpret_cast<void *>(robust_head.next), sizeof(robust_head));
+    AOS_PLOG(FATAL, "set_robust_list(%p, %zd) failed",
+             reinterpret_cast<void *>(robust_head.next), sizeof(robust_head));
   }
   if (kRobustListDebug) {
     printf("%" PRId32 ": init done\n", get_tid());
@@ -677,10 +677,11 @@
         }
         my_robust_list::robust_head.pending_next = 0;
         if (ret == -EDEADLK) {
-          LOG(FATAL, "multiple lock of %p by %" PRId32 "\n", m, tid);
+          AOS_LOG(FATAL, "multiple lock of %p by %" PRId32 "\n", m, tid);
         }
-        PELOG(FATAL, -ret, "FUTEX_LOCK_PI(%p(=%" PRIu32 "), 1, %p) failed",
-              &m->futex, __atomic_load_n(&m->futex, __ATOMIC_SEQ_CST), timeout);
+        AOS_PELOG(FATAL, -ret, "FUTEX_LOCK_PI(%p(=%" PRIu32 "), 1, %p) failed",
+                  &m->futex, __atomic_load_n(&m->futex, __ATOMIC_SEQ_CST),
+                  timeout);
       } else {
         if (kLockDebug) {
           printf("%" PRId32 ": %p kernel lock done\n", tid, m);
@@ -746,8 +747,8 @@
         continue;
       }
       my_robust_list::robust_head.pending_next = 0;
-      PELOG(FATAL, -ret, "FUTEX_CMP_REQUEUE_PI(%p, 1, %d, %p, *%p) failed", c,
-            number_requeue, &m->futex, c);
+      AOS_PELOG(FATAL, -ret, "FUTEX_CMP_REQUEUE_PI(%p, 1, %d, %p, *%p) failed",
+                c, number_requeue, &m->futex, c);
     } else {
       return;
     }
@@ -778,10 +779,11 @@
     my_robust_list::robust_head.pending_next = 0;
     check_cached_tid(tid);
     if ((value & FUTEX_TID_MASK) == 0) {
-      LOG(FATAL, "multiple unlock of aos_mutex %p by %" PRId32 "\n", m, tid);
+      AOS_LOG(FATAL, "multiple unlock of aos_mutex %p by %" PRId32 "\n", m,
+              tid);
     } else {
-      LOG(FATAL, "aos_mutex %p is locked by %" PRId32 ", not %" PRId32 "\n",
-          m, value & FUTEX_TID_MASK, tid);
+      AOS_LOG(FATAL, "aos_mutex %p is locked by %" PRId32 ", not %" PRId32 "\n",
+              m, value & FUTEX_TID_MASK, tid);
     }
   }
 
@@ -794,7 +796,7 @@
     const int ret = sys_futex_unlock_pi(&m->futex);
     if (ret != 0) {
       my_robust_list::robust_head.pending_next = 0;
-      PELOG(FATAL, -ret, "FUTEX_UNLOCK_PI(%p) failed", &m->futex);
+      AOS_PELOG(FATAL, -ret, "FUTEX_UNLOCK_PI(%p) failed", &m->futex);
     }
   } else {
     // There aren't any waiters, so no need to call into the kernel.
@@ -831,7 +833,8 @@
           return 4;
         }
         my_robust_list::robust_head.pending_next = 0;
-        PELOG(FATAL, -ret, "FUTEX_TRYLOCK_PI(%p, 0, NULL) failed", &m->futex);
+        AOS_PELOG(FATAL, -ret, "FUTEX_TRYLOCK_PI(%p, 0, NULL) failed",
+                  &m->futex);
       }
     }
   }
@@ -896,8 +899,9 @@
         continue;
       }
       my_robust_list::robust_head.pending_next = 0;
-      PELOG(FATAL, -ret, "FUTEX_WAIT_REQUEUE_PI(%p, %" PRIu32 ", %p) failed", c,
-            wait_start, &m->futex);
+      AOS_PELOG(FATAL, -ret,
+                "FUTEX_WAIT_REQUEUE_PI(%p, %" PRIu32 ", %p) failed", c,
+                wait_start, &m->futex);
     } else {
       // Record that the kernel relocked it for us.
       lock_pthread_mutex(m);
diff --git a/aos/ipc_lib/ipc_comparison.cc b/aos/ipc_lib/ipc_comparison.cc
index 2c73397..5ea1c8b 100644
--- a/aos/ipc_lib/ipc_comparison.cc
+++ b/aos/ipc_lib/ipc_comparison.cc
@@ -131,8 +131,8 @@
     size_t remaining = sizeof(*data);
     uint8_t *current = &(*data)[0];
     while (remaining > 0) {
-      const ssize_t result = PCHECK(read(fd, current, remaining));
-      CHECK_LE(static_cast<size_t>(result), remaining);
+      const ssize_t result = AOS_PCHECK(read(fd, current, remaining));
+      AOS_CHECK_LE(static_cast<size_t>(result), remaining);
       remaining -= result;
       current += result;
     }
@@ -142,8 +142,8 @@
     size_t remaining = sizeof(data);
     const uint8_t *current = &data[0];
     while (remaining > 0) {
-      const ssize_t result = PCHECK(write(fd, current, remaining));
-      CHECK_LE(static_cast<size_t>(result), remaining);
+      const ssize_t result = AOS_PCHECK(write(fd, current, remaining));
+      AOS_CHECK_LE(static_cast<size_t>(result), remaining);
       remaining -= result;
       current += result;
     }
@@ -157,15 +157,15 @@
 class PipePingPonger : public FDPingPonger {
  public:
   PipePingPonger() {
-    PCHECK(pipe(to_server));
-    PCHECK(pipe(from_server));
+    AOS_PCHECK(pipe(to_server));
+    AOS_PCHECK(pipe(from_server));
     Init(to_server[0], from_server[1], from_server[0], to_server[1]);
   }
   ~PipePingPonger() {
-    PCHECK(close(to_server[0]));
-    PCHECK(close(to_server[1]));
-    PCHECK(close(from_server[0]));
-    PCHECK(close(from_server[1]));
+    AOS_PCHECK(close(to_server[0]));
+    AOS_PCHECK(close(to_server[1]));
+    AOS_PCHECK(close(from_server[0]));
+    AOS_PCHECK(close(from_server[1]));
   }
 
  private:
@@ -181,10 +181,10 @@
     Init(server_read_, server_write_, client_read_, client_write_);
   }
   ~NamedPipePingPonger() {
-    PCHECK(close(server_read_));
-    PCHECK(close(client_write_));
-    PCHECK(close(client_read_));
-    PCHECK(close(server_write_));
+    AOS_PCHECK(close(server_read_));
+    AOS_PCHECK(close(client_write_));
+    AOS_PCHECK(close(client_read_));
+    AOS_PCHECK(close(server_write_));
   }
 
  private:
@@ -192,15 +192,15 @@
     {
       const int ret = unlink(name);
       if (ret == -1 && errno != ENOENT) {
-        PLOG(FATAL, "unlink(%s)", name);
+        AOS_PLOG(FATAL, "unlink(%s)", name);
       }
-      PCHECK(mkfifo(name, S_IWUSR | S_IRUSR));
+      AOS_PCHECK(mkfifo(name, S_IWUSR | S_IRUSR));
       // Have to open it nonblocking because the other end isn't open yet...
-      *read = PCHECK(open(name, O_RDONLY | O_NONBLOCK));
-      *write = PCHECK(open(name, O_WRONLY));
+      *read = AOS_PCHECK(open(name, O_RDONLY | O_NONBLOCK));
+      *write = AOS_PCHECK(open(name, O_WRONLY));
       {
-        const int flags = PCHECK(fcntl(*read, F_GETFL));
-        PCHECK(fcntl(*read, F_SETFL, flags & ~O_NONBLOCK));
+        const int flags = AOS_PCHECK(fcntl(*read, F_GETFL));
+        AOS_PCHECK(fcntl(*read, F_SETFL, flags & ~O_NONBLOCK));
       }
     }
   }
@@ -211,15 +211,15 @@
 class UnixPingPonger : public FDPingPonger {
  public:
   UnixPingPonger(int type) {
-    PCHECK(socketpair(AF_UNIX, type, 0, to_server));
-    PCHECK(socketpair(AF_UNIX, type, 0, from_server));
+    AOS_PCHECK(socketpair(AF_UNIX, type, 0, to_server));
+    AOS_PCHECK(socketpair(AF_UNIX, type, 0, from_server));
     Init(to_server[0], from_server[1], from_server[0], to_server[1]);
   }
   ~UnixPingPonger() {
-    PCHECK(close(to_server[0]));
-    PCHECK(close(to_server[1]));
-    PCHECK(close(from_server[0]));
-    PCHECK(close(from_server[1]));
+    AOS_PCHECK(close(to_server[0]));
+    AOS_PCHECK(close(to_server[1]));
+    AOS_PCHECK(close(from_server[0]));
+    AOS_PCHECK(close(from_server[1]));
   }
 
  private:
@@ -229,42 +229,44 @@
 class TCPPingPonger : public FDPingPonger {
  public:
   TCPPingPonger(bool nodelay) {
-    server_ = PCHECK(socket(AF_INET, SOCK_STREAM, 0));
+    server_ = AOS_PCHECK(socket(AF_INET, SOCK_STREAM, 0));
     if (nodelay) {
       const int yes = 1;
-      PCHECK(setsockopt(server_, IPPROTO_TCP, TCP_NODELAY, &yes, sizeof(yes)));
+      AOS_PCHECK(
+          setsockopt(server_, IPPROTO_TCP, TCP_NODELAY, &yes, sizeof(yes)));
     }
     {
       sockaddr_in server_address;
       memset(&server_address, 0, sizeof(server_address));
       server_address.sin_family = AF_INET;
       server_address.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
-      PCHECK(bind(server_, reinterpret_cast<sockaddr *>(&server_address),
-                  sizeof(server_address)));
+      AOS_PCHECK(bind(server_, reinterpret_cast<sockaddr *>(&server_address),
+                      sizeof(server_address)));
     }
-    PCHECK(listen(server_, 1));
+    AOS_PCHECK(listen(server_, 1));
 
-    client_ = PCHECK(socket(AF_INET, SOCK_STREAM, 0));
+    client_ = AOS_PCHECK(socket(AF_INET, SOCK_STREAM, 0));
     if (nodelay) {
       const int yes = 1;
-      PCHECK(setsockopt(client_, IPPROTO_TCP, TCP_NODELAY, &yes, sizeof(yes)));
+      AOS_PCHECK(
+          setsockopt(client_, IPPROTO_TCP, TCP_NODELAY, &yes, sizeof(yes)));
     }
     {
       sockaddr_in client_address;
       unsigned int length = sizeof(client_address);
-      PCHECK(getsockname(server_, reinterpret_cast<sockaddr *>(&client_address),
-                         &length));
-      PCHECK(connect(client_, reinterpret_cast<sockaddr *>(&client_address),
-                     length));
+      AOS_PCHECK(getsockname(
+          server_, reinterpret_cast<sockaddr *>(&client_address), &length));
+      AOS_PCHECK(connect(client_, reinterpret_cast<sockaddr *>(&client_address),
+                         length));
     }
-    server_connection_ = PCHECK(accept(server_, nullptr, 0));
+    server_connection_ = AOS_PCHECK(accept(server_, nullptr, 0));
 
     Init(server_connection_, server_connection_, client_, client_);
   }
   ~TCPPingPonger() {
-    PCHECK(close(client_));
-    PCHECK(close(server_connection_));
-    PCHECK(close(server_));
+    AOS_PCHECK(close(client_));
+    AOS_PCHECK(close(server_connection_));
+    AOS_PCHECK(close(server_));
   }
 
  private:
@@ -280,32 +282,32 @@
     Init(server_read_, server_write_, client_read_, client_write_);
   }
   ~UDPPingPonger() {
-    PCHECK(close(server_read_));
-    PCHECK(close(client_write_));
-    PCHECK(close(client_read_));
-    PCHECK(close(server_write_));
+    AOS_PCHECK(close(server_read_));
+    AOS_PCHECK(close(client_write_));
+    AOS_PCHECK(close(client_read_));
+    AOS_PCHECK(close(server_write_));
   }
 
  private:
   void CreatePair(int *server, int *client) {
-    *server = PCHECK(socket(AF_INET, SOCK_DGRAM, 0));
+    *server = AOS_PCHECK(socket(AF_INET, SOCK_DGRAM, 0));
     {
       sockaddr_in server_address;
       memset(&server_address, 0, sizeof(server_address));
       server_address.sin_family = AF_INET;
       server_address.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
       // server_address.sin_port = htons(server_ + 3000);
-      PCHECK(bind(*server, reinterpret_cast<sockaddr *>(&server_address),
-                  sizeof(server_address)));
+      AOS_PCHECK(bind(*server, reinterpret_cast<sockaddr *>(&server_address),
+                      sizeof(server_address)));
     }
-    *client = PCHECK(socket(AF_INET, SOCK_DGRAM, 0));
+    *client = AOS_PCHECK(socket(AF_INET, SOCK_DGRAM, 0));
     {
       sockaddr_in client_address;
       unsigned int length = sizeof(client_address);
-      PCHECK(getsockname(*server, reinterpret_cast<sockaddr *>(&client_address),
-                         &length));
-      PCHECK(connect(*client, reinterpret_cast<sockaddr *>(&client_address),
-                     length));
+      AOS_PCHECK(getsockname(
+          *server, reinterpret_cast<sockaddr *>(&client_address), &length));
+      AOS_PCHECK(connect(*client, reinterpret_cast<sockaddr *>(&client_address),
+                         length));
     }
   }
 
@@ -442,9 +444,9 @@
     AOSConditionVariable() : condition_(&mutex_) {}
 
    private:
-    void Lock() override { CHECK(!mutex_.Lock()); }
+    void Lock() override { AOS_CHECK(!mutex_.Lock()); }
     void Unlock() override { mutex_.Unlock(); }
-    void Wait() override { CHECK(!condition_.Wait()); }
+    void Wait() override { AOS_CHECK(!condition_.Wait()); }
     void Signal() override { condition_.Broadcast(); }
 
     Mutex mutex_;
@@ -487,40 +489,42 @@
     PthreadConditionVariable(bool pshared, bool pi) {
       {
         pthread_condattr_t cond_attr;
-        PRCHECK(pthread_condattr_init(&cond_attr));
+        AOS_PRCHECK(pthread_condattr_init(&cond_attr));
         if (pshared) {
-          PRCHECK(
+          AOS_PRCHECK(
               pthread_condattr_setpshared(&cond_attr, PTHREAD_PROCESS_SHARED));
         }
-        PRCHECK(pthread_cond_init(&condition_, &cond_attr));
-        PRCHECK(pthread_condattr_destroy(&cond_attr));
+        AOS_PRCHECK(pthread_cond_init(&condition_, &cond_attr));
+        AOS_PRCHECK(pthread_condattr_destroy(&cond_attr));
       }
 
       {
         pthread_mutexattr_t mutex_attr;
-        PRCHECK(pthread_mutexattr_init(&mutex_attr));
+        AOS_PRCHECK(pthread_mutexattr_init(&mutex_attr));
         if (pshared) {
-          PRCHECK(pthread_mutexattr_setpshared(&mutex_attr,
-                                               PTHREAD_PROCESS_SHARED));
+          AOS_PRCHECK(pthread_mutexattr_setpshared(&mutex_attr,
+                                                   PTHREAD_PROCESS_SHARED));
         }
         if (pi) {
-          PRCHECK(
+          AOS_PRCHECK(
               pthread_mutexattr_setprotocol(&mutex_attr, PTHREAD_PRIO_INHERIT));
         }
-        PRCHECK(pthread_mutex_init(&mutex_, nullptr));
-        PRCHECK(pthread_mutexattr_destroy(&mutex_attr));
+        AOS_PRCHECK(pthread_mutex_init(&mutex_, nullptr));
+        AOS_PRCHECK(pthread_mutexattr_destroy(&mutex_attr));
       }
     }
     ~PthreadConditionVariable() {
-      PRCHECK(pthread_mutex_destroy(&mutex_));
-      PRCHECK(pthread_cond_destroy(&condition_));
+      AOS_PRCHECK(pthread_mutex_destroy(&mutex_));
+      AOS_PRCHECK(pthread_cond_destroy(&condition_));
     }
 
    private:
-    void Lock() override { PRCHECK(pthread_mutex_lock(&mutex_)); }
-    void Unlock() override { PRCHECK(pthread_mutex_unlock(&mutex_)); }
-    void Wait() override { PRCHECK(pthread_cond_wait(&condition_, &mutex_)); }
-    void Signal() override { PRCHECK(pthread_cond_broadcast(&condition_)); }
+    void Lock() override { AOS_PRCHECK(pthread_mutex_lock(&mutex_)); }
+    void Unlock() override { AOS_PRCHECK(pthread_mutex_unlock(&mutex_)); }
+    void Wait() override {
+      AOS_PRCHECK(pthread_cond_wait(&condition_, &mutex_));
+    }
+    void Signal() override { AOS_PRCHECK(pthread_cond_broadcast(&condition_)); }
 
     pthread_cond_t condition_;
     pthread_mutex_t mutex_;
@@ -537,21 +541,21 @@
  private:
   class EventFDSemaphore : public SemaphoreInterface {
    public:
-    EventFDSemaphore() : fd_(PCHECK(eventfd(0, 0))) {}
-    ~EventFDSemaphore() { PCHECK(close(fd_)); }
+    EventFDSemaphore() : fd_(AOS_PCHECK(eventfd(0, 0))) {}
+    ~EventFDSemaphore() { AOS_PCHECK(close(fd_)); }
 
    private:
     void Get() override {
       uint64_t value;
       if (read(fd_, &value, sizeof(value)) != sizeof(value)) {
-        PLOG(FATAL, "reading from eventfd %d failed\n", fd_);
+        AOS_PLOG(FATAL, "reading from eventfd %d failed\n", fd_);
       }
-      CHECK_EQ(1u, value);
+      AOS_CHECK_EQ(1u, value);
     }
     void Put() override {
       uint64_t value = 1;
       if (write(fd_, &value, sizeof(value)) != sizeof(value)) {
-        PLOG(FATAL, "writing to eventfd %d failed\n", fd_);
+        AOS_PLOG(FATAL, "writing to eventfd %d failed\n", fd_);
       }
     }
 
@@ -569,7 +573,7 @@
  private:
   class SysvSemaphore : public SemaphoreInterface {
    public:
-    SysvSemaphore() : sem_id_(PCHECK(semget(IPC_PRIVATE, 1, 0600))) {}
+    SysvSemaphore() : sem_id_(AOS_PCHECK(semget(IPC_PRIVATE, 1, 0600))) {}
 
    private:
     void Get() override {
@@ -577,14 +581,14 @@
       op.sem_num = 0;
       op.sem_op = -1;
       op.sem_flg = 0;
-      PCHECK(semop(sem_id_, &op, 1));
+      AOS_PCHECK(semop(sem_id_, &op, 1));
     }
     void Put() override {
       struct sembuf op;
       op.sem_num = 0;
       op.sem_op = 1;
       op.sem_flg = 0;
-      PCHECK(semop(sem_id_, &op, 1));
+      AOS_PCHECK(semop(sem_id_, &op, 1));
     }
 
     const int sem_id_;
@@ -605,8 +609,8 @@
     PosixSemaphore(sem_t *sem) : sem_(sem) {}
 
    private:
-    void Get() override { PCHECK(sem_wait(sem_)); }
-    void Put() override { PCHECK(sem_post(sem_)); }
+    void Get() override { AOS_PCHECK(sem_wait(sem_)); }
+    void Put() override { AOS_PCHECK(sem_post(sem_)); }
 
     sem_t *const sem_;
   };
@@ -615,18 +619,18 @@
 class SysvQueuePingPonger : public StaticPingPonger {
  public:
   SysvQueuePingPonger()
-      : ping_(PCHECK(msgget(IPC_PRIVATE, 0600))),
-        pong_(PCHECK(msgget(IPC_PRIVATE, 0600))) {}
+      : ping_(AOS_PCHECK(msgget(IPC_PRIVATE, 0600))),
+        pong_(AOS_PCHECK(msgget(IPC_PRIVATE, 0600))) {}
 
   const Data *Ping() override {
     {
       Message to_send;
       memcpy(&to_send.data, PingData(), sizeof(Data));
-      PCHECK(msgsnd(ping_, &to_send, sizeof(Data), 0));
+      AOS_PCHECK(msgsnd(ping_, &to_send, sizeof(Data), 0));
     }
     {
       Message received;
-      PCHECK(msgrcv(pong_, &received, sizeof(Data), 1, 0));
+      AOS_PCHECK(msgrcv(pong_, &received, sizeof(Data), 1, 0));
       memcpy(&pong_received_, &received.data, sizeof(Data));
     }
     return &pong_received_;
@@ -635,7 +639,7 @@
   const Data *Wait() override {
     {
       Message received;
-      PCHECK(msgrcv(ping_, &received, sizeof(Data), 1, 0));
+      AOS_PCHECK(msgrcv(ping_, &received, sizeof(Data), 1, 0));
       memcpy(&ping_received_, &received.data, sizeof(Data));
     }
     return &ping_received_;
@@ -644,7 +648,7 @@
   virtual void Pong() override {
     Message to_send;
     memcpy(&to_send.data, PongData(), sizeof(Data));
-    PCHECK(msgsnd(pong_, &to_send, sizeof(Data), 0));
+    AOS_PCHECK(msgsnd(pong_, &to_send, sizeof(Data), 0));
   }
 
  private:
@@ -662,35 +666,37 @@
  public:
   PosixQueuePingPonger() : ping_(Open("/ping")), pong_(Open("/pong")) {}
   ~PosixQueuePingPonger() {
-    PCHECK(mq_close(ping_));
-    PCHECK(mq_close(pong_));
+    AOS_PCHECK(mq_close(ping_));
+    AOS_PCHECK(mq_close(pong_));
   }
 
   const Data *Ping() override {
-    PCHECK(mq_send(ping_, static_cast<char *>(static_cast<void *>(PingData())),
-                   sizeof(Data), 1));
-    PCHECK(mq_receive(pong_,
-                      static_cast<char *>(static_cast<void *>(&pong_received_)),
-                      sizeof(Data), nullptr));
+    AOS_PCHECK(mq_send(ping_,
+                       static_cast<char *>(static_cast<void *>(PingData())),
+                       sizeof(Data), 1));
+    AOS_PCHECK(mq_receive(
+        pong_, static_cast<char *>(static_cast<void *>(&pong_received_)),
+        sizeof(Data), nullptr));
     return &pong_received_;
   }
 
   const Data *Wait() override {
-    PCHECK(mq_receive(ping_,
-                      static_cast<char *>(static_cast<void *>(&ping_received_)),
-                      sizeof(Data), nullptr));
+    AOS_PCHECK(mq_receive(
+        ping_, static_cast<char *>(static_cast<void *>(&ping_received_)),
+        sizeof(Data), nullptr));
     return &ping_received_;
   }
 
   virtual void Pong() override {
-    PCHECK(mq_send(pong_, static_cast<char *>(static_cast<void *>(PongData())),
-                   sizeof(Data), 1));
+    AOS_PCHECK(mq_send(pong_,
+                       static_cast<char *>(static_cast<void *>(PongData())),
+                       sizeof(Data), 1));
   }
 
  private:
   mqd_t Open(const char *name) {
     if (mq_unlink(name) == -1 && errno != ENOENT) {
-      PLOG(FATAL, "mq_unlink(%s) failed", name);
+      AOS_PLOG(FATAL, "mq_unlink(%s) failed", name);
     }
     struct mq_attr attr;
     attr.mq_flags = 0;
@@ -699,7 +705,7 @@
     attr.mq_curmsgs = 0;
     const mqd_t r = mq_open(name, O_CREAT | O_RDWR | O_EXCL, 0600, &attr);
     if (r == reinterpret_cast<mqd_t>(-1)) {
-      PLOG(FATAL, "mq_open(%s, O_CREAT | O_RDWR | O_EXCL) failed", name);
+      AOS_PLOG(FATAL, "mq_open(%s, O_CREAT | O_RDWR | O_EXCL) failed", name);
     }
     return r;
   }
@@ -712,12 +718,12 @@
  public:
   PosixUnnamedSemaphorePingPonger(int pshared)
       : PosixSemaphorePingPonger(&ping_sem_, &pong_sem_) {
-    PCHECK(sem_init(&ping_sem_, pshared, 0));
-    PCHECK(sem_init(&pong_sem_, pshared, 0));
+    AOS_PCHECK(sem_init(&ping_sem_, pshared, 0));
+    AOS_PCHECK(sem_init(&pong_sem_, pshared, 0));
   }
   ~PosixUnnamedSemaphorePingPonger() {
-    PCHECK(sem_destroy(&ping_sem_));
-    PCHECK(sem_destroy(&pong_sem_));
+    AOS_PCHECK(sem_destroy(&ping_sem_));
+    AOS_PCHECK(sem_destroy(&pong_sem_));
   }
 
  private:
@@ -730,18 +736,18 @@
       : PosixSemaphorePingPonger(ping_sem_ = Open("/ping"),
                                  pong_sem_ = Open("/pong")) {}
   ~PosixNamedSemaphorePingPonger() {
-    PCHECK(sem_close(ping_sem_));
-    PCHECK(sem_close(pong_sem_));
+    AOS_PCHECK(sem_close(ping_sem_));
+    AOS_PCHECK(sem_close(pong_sem_));
   }
 
  private:
   sem_t *Open(const char *name) {
     if (sem_unlink(name) == -1 && errno != ENOENT) {
-      PLOG(FATAL, "shm_unlink(%s) failed", name);
+      AOS_PLOG(FATAL, "shm_unlink(%s) failed", name);
     }
     sem_t *const r = sem_open(name, O_CREAT | O_RDWR | O_EXCL, 0600, 0);
     if (r == SEM_FAILED) {
-      PLOG(FATAL, "sem_open(%s, O_CREAT | O_RDWR | O_EXCL) failed", name);
+      AOS_PLOG(FATAL, "sem_open(%s, O_CREAT | O_RDWR | O_EXCL) failed", name);
     }
     return r;
   }
@@ -756,14 +762,14 @@
         pong_queue_(RawQueue::Fetch("pong", sizeof(Data), 0, 1)) {}
 
   Data *PingData() override {
-    CHECK_EQ(nullptr, ping_to_send_);
+    AOS_CHECK_EQ(nullptr, ping_to_send_);
     ping_to_send_ = static_cast<Data *>(ping_queue_->GetMessage());
     return ping_to_send_;
   }
 
   const Data *Ping() override {
-    CHECK_NE(nullptr, ping_to_send_);
-    CHECK(ping_queue_->WriteMessage(ping_to_send_, RawQueue::kBlock));
+    AOS_CHECK_NE(nullptr, ping_to_send_);
+    AOS_CHECK(ping_queue_->WriteMessage(ping_to_send_, RawQueue::kBlock));
     ping_to_send_ = nullptr;
     pong_queue_->FreeMessage(pong_received_);
     pong_received_ =
@@ -779,14 +785,14 @@
   }
 
   Data *PongData() override {
-    CHECK_EQ(nullptr, pong_to_send_);
+    AOS_CHECK_EQ(nullptr, pong_to_send_);
     pong_to_send_ = static_cast<Data *>(pong_queue_->GetMessage());
     return pong_to_send_;
   }
 
   void Pong() override {
-    CHECK_NE(nullptr, pong_to_send_);
-    CHECK(pong_queue_->WriteMessage(pong_to_send_, RawQueue::kBlock));
+    AOS_CHECK_NE(nullptr, pong_to_send_);
+    AOS_CHECK(pong_queue_->WriteMessage(pong_to_send_, RawQueue::kBlock));
     pong_to_send_ = nullptr;
   }
 
@@ -887,7 +893,7 @@
     memset(*to_send, i % 123, sizeof(*to_send));
     const PingPongerInterface::Data *received = ping_ponger->Ping();
     for (size_t ii = 0; ii < sizeof(*received); ++ii) {
-      CHECK_EQ(((i % 123) + 1) % 255, (*received)[ii]);
+      AOS_CHECK_EQ(((i % 123) + 1) % 255, (*received)[ii]);
     }
   }
 
@@ -903,14 +909,14 @@
   ping_ponger->Ping();
   server.join();
 
-  LOG(INFO, "Took %f seconds to send %" PRId32 " messages\n",
-      ::aos::time::DurationInSeconds(end - start), FLAGS_messages);
+  AOS_LOG(INFO, "Took %f seconds to send %" PRId32 " messages\n",
+          ::aos::time::DurationInSeconds(end - start), FLAGS_messages);
   const chrono::nanoseconds per_message = (end - start) / FLAGS_messages;
   if (per_message >= chrono::seconds(1)) {
-    LOG(INFO, "More than 1 second per message ?!?\n");
+    AOS_LOG(INFO, "More than 1 second per message ?!?\n");
   } else {
-    LOG(INFO, "That is %" PRId32 " nanoseconds per message\n",
-        static_cast<int>(per_message.count()));
+    AOS_LOG(INFO, "That is %" PRId32 " nanoseconds per message\n",
+            static_cast<int>(per_message.count()));
   }
 
   return 0;
diff --git a/aos/ipc_lib/lockless_queue.cc b/aos/ipc_lib/lockless_queue.cc
index fb9c0b6..cd0e2ae 100644
--- a/aos/ipc_lib/lockless_queue.cc
+++ b/aos/ipc_lib/lockless_queue.cc
@@ -13,6 +13,7 @@
 #include "aos/ipc_lib/lockless_queue_memory.h"
 #include "aos/logging/logging.h"
 #include "aos/util/compiler_memory_barrier.h"
+#include "glog/logging.h"
 
 namespace aos {
 namespace ipc_lib {
@@ -490,7 +491,7 @@
   }
 
   if (sender_index_ == -1) {
-    LOG(FATAL, "Too many senders\n");
+    LOG(FATAL) << "Too many senders";
   }
 
   ::aos::ipc_lib::Sender *s = memory_->GetSender(sender_index_);
diff --git a/aos/ipc_lib/lockless_queue_death_test.cc b/aos/ipc_lib/lockless_queue_death_test.cc
index 100821c..7a68273 100644
--- a/aos/ipc_lib/lockless_queue_death_test.cc
+++ b/aos/ipc_lib/lockless_queue_death_test.cc
@@ -15,10 +15,10 @@
 #include "aos/ipc_lib/aos_sync.h"
 #include "aos/ipc_lib/lockless_queue_memory.h"
 #include "aos/libc/aos_strsignal.h"
-#include "aos/logging/logging.h"
 #include "aos/testing/prevent_exit.h"
 #include "aos/testing/test_logging.h"
 #include "gflags/gflags.h"
+#include "glog/logging.h"
 #include "gtest/gtest.h"
 
 namespace aos {
@@ -148,12 +148,11 @@
 // Calls mprotect(2) for the entire shared memory region with the given prot.
 void ShmProtectOrDie(int prot) {
   GlobalState *my_global_state = global_state.load(::std::memory_order_relaxed);
-  if (mprotect(my_global_state->lockless_queue_memory,
-               my_global_state->lockless_queue_memory_size, prot) == -1) {
-    PLOG(FATAL, "mprotect(%p, %zu, %x) failed",
-         my_global_state->lockless_queue_memory,
-         my_global_state->lockless_queue_memory_size, prot);
-  }
+  PCHECK(mprotect(my_global_state->lockless_queue_memory,
+                  my_global_state->lockless_queue_memory_size, prot) != -1)
+      << ": mprotect(" << my_global_state->lockless_queue_memory << ", "
+      << my_global_state->lockless_queue_memory_size << ", 0x" << std::hex
+      << prot << ") failed";
 }
 
 // Checks a write into the queue and conditionally dies.  Tracks the write.
@@ -277,13 +276,13 @@
     SigactionType real_sigaction =
         reinterpret_cast<SigactionType>(dlsym(RTLD_NEXT, "sigaction"));
     if (sigaction == real_sigaction) {
-      LOG(WARNING, "failed to work around tsan signal handling weirdness\n");
+      LOG(WARNING) << "failed to work around tsan signal handling weirdness";
     }
-    PCHECK(real_sigaction(signal, &action, old_action));
+    PCHECK(real_sigaction(signal, &action, old_action) == 0);
     return;
   }
 #endif
-  PCHECK(sigaction(signal, &action, old_action));
+  PCHECK(sigaction(signal, &action, old_action) == 0);
 }
 
 #endif  // ifndef __ARM_EABI__
@@ -318,9 +317,7 @@
   if (!prepare_in_child) prepare(my_global_state->lockless_queue_memory);
 
   const pid_t pid = fork();
-  if (pid == -1) {
-    PLOG(FATAL, "fork() failed\n");
-  }
+  PCHECK(pid != -1) << ": fork() failed";
   if (pid == 0) {
     // Run the test.
     ::aos::testing::PreventExit();
@@ -350,12 +347,13 @@
       pid_t waited_on = waitpid(pid, &status, 0);
       if (waited_on == -1) {
         if (errno == EINTR) continue;
-        PLOG(FATAL, "waitpid(%jd, %p, 0) failed\n", static_cast<intmax_t>(pid),
-             &status);
+        PCHECK(false) << ": waitpid(" << static_cast<intmax_t>(pid) << ", "
+                      << &status << ", 0) failed";
       }
       if (waited_on != pid) {
-        LOG(FATAL, "waitpid got child %jd instead of %jd\n",
-            static_cast<intmax_t>(waited_on), static_cast<intmax_t>(pid));
+        PCHECK(false) << ": waitpid got child "
+                      << static_cast<intmax_t>(waited_on) << " instead of "
+                      << static_cast<intmax_t>(pid);
       }
       if (WIFEXITED(status)) {
         if (WEXITSTATUS(status) == 0) return true;
diff --git a/aos/ipc_lib/queue.cc b/aos/ipc_lib/queue.cc
index 295e854..5b6a0fa 100644
--- a/aos/ipc_lib/queue.cc
+++ b/aos/ipc_lib/queue.cc
@@ -172,7 +172,7 @@
   MessageHeader *header = __atomic_load_n(&free_messages_, __ATOMIC_RELAXED);
   do {
     if (__builtin_expect(header == nullptr, 0)) {
-      LOG(FATAL, "overused pool of queue %p (%s)\n", this, name_);
+      AOS_LOG(FATAL, "overused pool of queue %p (%s)\n", this, name_);
     }
   } while (__builtin_expect(
       !__atomic_compare_exchange_n(&free_messages_, &header, header->next, true,
@@ -196,8 +196,8 @@
                 "need to revalidate size/alignent assumptions");
 
   if (queue_length < 1) {
-    LOG(FATAL, "queue length %d of %s needs to be at least 1\n", queue_length,
-        name);
+    AOS_LOG(FATAL, "queue length %d of %s needs to be at least 1\n",
+            queue_length, name);
   }
 
   const size_t name_size = strlen(name) + 1;
@@ -249,8 +249,8 @@
     printf("fetching queue %s\n", name);
   }
   if (mutex_lock(&global_core->mem_struct->queues.lock) != 0) {
-    LOG(FATAL, "mutex_lock(%p) failed\n",
-        &global_core->mem_struct->queues.lock);
+    AOS_LOG(FATAL, "mutex_lock(%p) failed\n",
+            &global_core->mem_struct->queues.lock);
   }
   RawQueue *current =
       static_cast<RawQueue *>(global_core->mem_struct->queues.pointer);
@@ -309,7 +309,7 @@
 
   {
     IPCMutexLocker locker(&data_lock_);
-    CHECK(!locker.owner_died());
+    AOS_CHECK(!locker.owner_died());
 
     int new_end;
     while (true) {
@@ -334,7 +334,7 @@
         if (kWriteDebug) {
           printf("queue: going to wait for writable_ of %p\n", this);
         }
-        CHECK(!writable_.Wait());
+        AOS_CHECK(!writable_.Wait());
       }
     }
     data_[data_end_] = msg;
@@ -390,7 +390,7 @@
         if (wait_result == Condition::WaitResult::kOk) {
           break;
         }
-        CHECK(wait_result != Condition::WaitResult::kOwnerDied);
+        AOS_CHECK(wait_result != Condition::WaitResult::kOwnerDied);
         if (wait_result == Condition::WaitResult::kTimeout) {
           return false;
         }
@@ -427,7 +427,7 @@
   void *msg = NULL;
 
   IPCMutexLocker locker(&data_lock_);
-  CHECK(!locker.owner_died());
+  AOS_CHECK(!locker.owner_died());
 
   if (!ReadCommonStart(options, nullptr, chrono::nanoseconds(0))) {
     if (kReadDebug) {
@@ -490,7 +490,7 @@
   void *msg = NULL;
 
   IPCMutexLocker locker(&data_lock_);
-  CHECK(!locker.owner_died());
+  AOS_CHECK(!locker.owner_died());
 
   if (!ReadCommonStart(options, index, timeout)) {
     if (kReadDebug) {
diff --git a/aos/ipc_lib/queue.h b/aos/ipc_lib/queue.h
index b93cc42..5b68f2e 100644
--- a/aos/ipc_lib/queue.h
+++ b/aos/ipc_lib/queue.h
@@ -90,10 +90,10 @@
     static constexpr Options<RawQueue> kWriteFailureOptions =
         kNonBlock | kBlock | kOverride;
     if (!options.NoOthersSet(kWriteFailureOptions)) {
-      LOG(FATAL, "illegal write options in %x\n", options.printable());
+      AOS_LOG(FATAL, "illegal write options in %x\n", options.printable());
     }
     if (!options.ExactlyOneSet(kWriteFailureOptions)) {
-      LOG(FATAL, "invalid write options %x\n", options.printable());
+      AOS_LOG(FATAL, "invalid write options %x\n", options.printable());
     }
     return DoWriteMessage(msg, options);
   }
@@ -123,7 +123,7 @@
     CheckReadOptions(options);
     static constexpr Options<RawQueue> kFromEndAndPeek = kFromEnd | kPeek;
     if (options.AllSet(kFromEndAndPeek)) {
-      LOG(FATAL, "ReadMessageIndex(kFromEnd | kPeek) is not allowed\n");
+      AOS_LOG(FATAL, "ReadMessageIndex(kFromEnd | kPeek) is not allowed\n");
     }
     return DoReadMessageIndex(options, index, timeout);
   }
@@ -161,11 +161,11 @@
     static constexpr Options<RawQueue> kValidOptions =
         kPeek | kFromEnd | kNonBlock | kBlock;
     if (!options.NoOthersSet(kValidOptions)) {
-      LOG(FATAL, "illegal read options in %x\n", options.printable());
+      AOS_LOG(FATAL, "illegal read options in %x\n", options.printable());
     }
     static constexpr Options<RawQueue> kBlockChoices = kNonBlock | kBlock;
     if (!options.ExactlyOneSet(kBlockChoices)) {
-      LOG(FATAL, "invalid read options %x\n", options.printable());
+      AOS_LOG(FATAL, "invalid read options %x\n", options.printable());
     }
   }
 
diff --git a/aos/ipc_lib/raw_queue_test.cc b/aos/ipc_lib/raw_queue_test.cc
index ab98b1f..aa3b335 100644
--- a/aos/ipc_lib/raw_queue_test.cc
+++ b/aos/ipc_lib/raw_queue_test.cc
@@ -99,23 +99,25 @@
             printf("process %jd was already dead\n",
                    static_cast<intmax_t>(pid_));
           } else {
-            PLOG(FATAL, "kill(SIGKILL, %jd) failed",
-                 static_cast<intmax_t>(pid_));
+            AOS_PLOG(FATAL, "kill(SIGKILL, %jd) failed",
+                     static_cast<intmax_t>(pid_));
           }
         }
       }
       const pid_t ret = wait(NULL);
       if (ret == -1) {
-        LOG(WARNING, "wait(NULL) failed."
-            " child %jd might still be alive\n",
-            static_cast<intmax_t>(pid_));
+        AOS_LOG(WARNING,
+                "wait(NULL) failed."
+                " child %jd might still be alive\n",
+                static_cast<intmax_t>(pid_));
       } else if (ret == 0) {
-        LOG(WARNING, "child %jd wasn't waitable. it might still be alive\n",
-            static_cast<intmax_t>(pid_));
+        AOS_LOG(WARNING, "child %jd wasn't waitable. it might still be alive\n",
+                static_cast<intmax_t>(pid_));
       } else if (ret != pid_) {
-        LOG(WARNING, "child %d is now confirmed dead"
-            ", but child %jd might still be alive\n",
-            ret, static_cast<intmax_t>(pid_));
+        AOS_LOG(WARNING,
+                "child %d is now confirmed dead"
+                ", but child %jd might still be alive\n",
+                ret, static_cast<intmax_t>(pid_));
       }
     }
 
@@ -188,16 +190,16 @@
     switch (pid) {
       case 0:  // child
         if (kForkSleep != chrono::milliseconds(0)) {
-          LOG(INFO, "pid %jd sleeping for %" PRId64 "ns\n",
-              static_cast<intmax_t>(getpid()), kForkSleep.count());
+          AOS_LOG(INFO, "pid %jd sleeping for %" PRId64 "ns\n",
+                  static_cast<intmax_t>(getpid()), kForkSleep.count());
           this_thread::sleep_for(kForkSleep);
         }
         ::aos::testing::PreventExit();
         function(arg);
-        CHECK_NE(-1, futex_set(done));
+        AOS_CHECK_NE(-1, futex_set(done));
         exit(EXIT_SUCCESS);
       case -1:  // parent failure
-        PLOG(ERROR, "fork() failed");
+        AOS_PLOG(ERROR, "fork() failed");
         return std::unique_ptr<ForkedProcess>();
       default:  // parent
         return std::unique_ptr<ForkedProcess>(new ForkedProcess(pid, done));
@@ -237,7 +239,7 @@
     static_cast<char *>(fatal_failure)[0] = '\0';
     children_[id] = ForkExecute(Hangs_, to_call).release();
     if (!children_[id]) return AssertionFailure() << "ForkExecute failed";
-    CHECK_EQ(0, futex_wait(&to_call->started));
+    AOS_CHECK_EQ(0, futex_wait(&to_call->started));
     to_calls_[id] = reinterpret_cast<FunctionToCall<void> *>(to_call);
     return AssertionSuccess();
   }
diff --git a/aos/ipc_lib/shared_mem.c b/aos/ipc_lib/shared_mem.c
index e8edc9e..da55ebc 100644
--- a/aos/ipc_lib/shared_mem.c
+++ b/aos/ipc_lib/shared_mem.c
@@ -61,7 +61,7 @@
       if (shm == -1 && errno == EEXIST) {
         printf("shared_mem: going to shm_unlink(%s)\n", global_core->shm_name);
         if (shm_unlink(global_core->shm_name) == -1) {
-          PLOG(WARNING, "shm_unlink(%s) failed", global_core->shm_name);
+          AOS_PLOG(WARNING, "shm_unlink(%s) failed", global_core->shm_name);
           break;
         }
       } else {
@@ -73,12 +73,12 @@
     global_core->owner = 0;
   }
   if (shm == -1) {
-    PLOG(FATAL, "shm_open(%s, O_RDWR [| O_CREAT | O_EXCL, 0|0666) failed",
-         global_core->shm_name);
+    AOS_PLOG(FATAL, "shm_open(%s, O_RDWR [| O_CREAT | O_EXCL, 0|0666) failed",
+             global_core->shm_name);
   }
   if (global_core->owner) {
     if (ftruncate(shm, SIZEOFSHMSEG) == -1) {
-      PLOG(FATAL, "fruncate(%d, 0x%zx) failed", shm, (size_t)SIZEOFSHMSEG);
+      AOS_PLOG(FATAL, "fruncate(%d, 0x%zx) failed", shm, (size_t)SIZEOFSHMSEG);
     }
   }
   int flags = MAP_SHARED | MAP_FIXED;
@@ -86,8 +86,8 @@
   void *shm_address = mmap((void *)SHM_START, SIZEOFSHMSEG,
                            PROT_READ | PROT_WRITE, flags, shm, 0);
   if (shm_address == MAP_FAILED) {
-    PLOG(FATAL, "shared_mem: mmap(%p, 0x%zx, stuff, %x, %d, 0) failed",
-         (void *)SHM_START, (size_t)SIZEOFSHMSEG, flags, shm);
+    AOS_PLOG(FATAL, "shared_mem: mmap(%p, 0x%zx, stuff, %x, %d, 0) failed",
+             (void *)SHM_START, (size_t)SIZEOFSHMSEG, flags, shm);
   }
   if (create) {
     printf("shared_mem: creating %s, shm at: %p\n", global_core->shm_name,
@@ -96,14 +96,14 @@
     printf("shared_mem: not creating, shm at: %p\n", shm_address);
   }
   if (close(shm) == -1) {
-    PLOG(WARNING, "close(%d(=shm) failed", shm);
+    AOS_PLOG(WARNING, "close(%d(=shm) failed", shm);
   }
   if (shm_address != (void *)SHM_START) {
-    LOG(FATAL, "shm isn't at hard-coded %p. at %p instead\n",
-        (void *)SHM_START, shm_address);
+    AOS_LOG(FATAL, "shm isn't at hard-coded %p. at %p instead\n",
+            (void *)SHM_START, shm_address);
   }
   aos_core_use_address_as_shared_mem(shm_address, SIZEOFSHMSEG);
-  LOG(INFO, "shared_mem: end of create_shared_mem owner=%d\n",
+  AOS_LOG(INFO, "shared_mem: end of create_shared_mem owner=%d\n",
           global_core->owner);
 }
 
@@ -118,7 +118,7 @@
     futex_set(&global_core->mem_struct->creation_condition);
   } else {
     if (futex_wait(&global_core->mem_struct->creation_condition) != 0) {
-      LOG(FATAL, "waiting on creation_condition failed\n");
+      AOS_LOG(FATAL, "waiting on creation_condition failed\n");
     }
   }
 }
@@ -126,12 +126,13 @@
 void aos_core_free_shared_mem() {
   void *shm_address = global_core->shared_mem;
   if (munmap((void *)SHM_START, SIZEOFSHMSEG) == -1) {
-    PLOG(FATAL, "munmap(%p, 0x%zx) failed", shm_address,
-         (size_t)SIZEOFSHMSEG);
+    AOS_PLOG(FATAL, "munmap(%p, 0x%zx) failed", shm_address,
+             (size_t)SIZEOFSHMSEG);
   }
   if (global_core->owner) {
     if (shm_unlink(global_core->shm_name)) {
-      PLOG(FATAL, "shared_mem: shm_unlink(%s) failed", global_core->shm_name);
+      AOS_PLOG(FATAL, "shared_mem: shm_unlink(%s) failed",
+               global_core->shm_name);
     }
   }
 }
diff --git a/aos/ipc_lib/signalfd.cc b/aos/ipc_lib/signalfd.cc
index 1679b46..045444b 100644
--- a/aos/ipc_lib/signalfd.cc
+++ b/aos/ipc_lib/signalfd.cc
@@ -18,7 +18,7 @@
   }
   // Then build a signalfd.  Make it nonblocking so it works well with an epoll
   // loop, and have it close on exec.
-  PCHECK(fd_ = signalfd(-1, &mask_, SFD_NONBLOCK | SFD_CLOEXEC));
+  AOS_PCHECK(fd_ = signalfd(-1, &mask_, SFD_NONBLOCK | SFD_CLOEXEC));
   // Now that we have a consumer of the signal, block the signals so the
   // signalfd gets them.
   pthread_sigmask(SIG_BLOCK, &mask_, nullptr);
@@ -27,7 +27,7 @@
 SignalFd::~SignalFd() {
   // Unwind the constructor.  Unblock the signals and close the fd.
   pthread_sigmask(SIG_UNBLOCK, &mask_, nullptr);
-  PCHECK(close(fd_));
+  AOS_PCHECK(close(fd_));
 }
 
 signalfd_siginfo SignalFd::Read() {
diff --git a/aos/libc/aos_strsignal.cc b/aos/libc/aos_strsignal.cc
index 77f0b90..a3331f9 100644
--- a/aos/libc/aos_strsignal.cc
+++ b/aos/libc/aos_strsignal.cc
@@ -8,8 +8,8 @@
   static thread_local char buffer[512];
 
   if (signal >= SIGRTMIN && signal <= SIGRTMAX) {
-    CHECK(snprintf(buffer, sizeof(buffer), "Real-time signal %d",
-                   signal - SIGRTMIN) > 0);
+    AOS_CHECK(snprintf(buffer, sizeof(buffer), "Real-time signal %d",
+                       signal - SIGRTMIN) > 0);
     return buffer;
   }
 
@@ -17,6 +17,6 @@
     return sys_siglist[signal];
   }
 
-  CHECK(snprintf(buffer, sizeof(buffer), "Unknown signal %d", signal) > 0);
+  AOS_CHECK(snprintf(buffer, sizeof(buffer), "Unknown signal %d", signal) > 0);
   return buffer;
 }
diff --git a/aos/logging/binary_log_file.cc b/aos/logging/binary_log_file.cc
index ca62b73..9ea5c82 100644
--- a/aos/logging/binary_log_file.cc
+++ b/aos/logging/binary_log_file.cc
@@ -24,8 +24,8 @@
     : fd_(fd), writable_(writable), offset_(0), current_(0), position_(0) {
   // Check to make sure that mmap will allow mmaping in chunks of kPageSize.
   if (SystemPageSize() > kPageSize || (kPageSize % SystemPageSize()) != 0) {
-    LOG(FATAL, "system page size (%lu) not factor of kPageSize (%zd).\n",
-        SystemPageSize(), kPageSize);
+    AOS_LOG(FATAL, "system page size (%lu) not factor of kPageSize (%zd).\n",
+            SystemPageSize(), kPageSize);
   }
 
   MapNextPage();
@@ -36,14 +36,14 @@
 }
 
 void LogFileAccessor::SkipToLastSeekablePage() {
-  CHECK(definitely_use_mmap());
+  AOS_CHECK(definitely_use_mmap());
 
   struct stat info;
   if (fstat(fd_, &info) == -1) {
-    PLOG(FATAL, "fstat(%d, %p) failed", fd_, &info);
+    AOS_PLOG(FATAL, "fstat(%d, %p) failed", fd_, &info);
   }
 
-  CHECK((info.st_size % kPageSize) == 0);
+  AOS_CHECK((info.st_size % kPageSize) == 0);
   const auto last_readable_page_number = (info.st_size / kPageSize) - 1;
   const auto last_seekable_page_number =
       last_readable_page_number / kSeekPages * kSeekPages;
@@ -66,7 +66,7 @@
 
   struct stat info;
   if (fstat(fd_, &info) == -1) {
-    PLOG(FATAL, "fstat(%d, %p) failed", fd_, &info);
+    AOS_PLOG(FATAL, "fstat(%d, %p) failed", fd_, &info);
   }
   bool r = offset_ == static_cast<off_t>(info.st_size - kPageSize);
   is_last_page_ = r ? Maybe::kYes : Maybe::kNo;
@@ -76,7 +76,7 @@
 void LogFileAccessor::MapNextPage() {
   if (writable_) {
     if (ftruncate(fd_, offset_ + kPageSize) == -1) {
-      PLOG(FATAL, "ftruncate(%d, %zd) failed", fd_, kPageSize);
+      AOS_PLOG(FATAL, "ftruncate(%d, %zd) failed", fd_, kPageSize);
     }
   }
 
@@ -85,49 +85,51 @@
     while (todo > 0) {
       ssize_t result = read(fd_, current_ + (kPageSize - todo), todo);
       if (result == -1) {
-        PLOG(FATAL, "read(%d, %p, %zu) failed", fd_,
-             current_ + (kPageSize - todo), todo);
+        AOS_PLOG(FATAL, "read(%d, %p, %zu) failed", fd_,
+                 current_ + (kPageSize - todo), todo);
       } else if (result == 0) {
         memset(current_, 0, todo);
         result = todo;
       }
       todo -= result;
     }
-    CHECK_EQ(0, todo);
+    AOS_CHECK_EQ(0, todo);
   } else {
     current_ = static_cast<char *>(
         mmap(NULL, kPageSize, PROT_READ | (writable_ ? PROT_WRITE : 0),
              MAP_SHARED, fd_, offset_));
     if (current_ == MAP_FAILED) {
       if (!writable_ && use_read_ == Maybe::kUnknown && errno == ENODEV) {
-        LOG(INFO, "Falling back to reading the file using read(2).\n");
+        AOS_LOG(INFO, "Falling back to reading the file using read(2).\n");
         use_read_ = Maybe::kYes;
         current_ = new char[kPageSize];
         MapNextPage();
         return;
       } else {
-        PLOG(FATAL,
-             "mmap(NULL, %zd, PROT_READ [ | PROT_WRITE], MAP_SHARED, %d, %jd)"
-             " failed",
-             kPageSize, fd_, static_cast<intmax_t>(offset_));
+        AOS_PLOG(
+            FATAL,
+            "mmap(NULL, %zd, PROT_READ [ | PROT_WRITE], MAP_SHARED, %d, %jd)"
+            " failed",
+            kPageSize, fd_, static_cast<intmax_t>(offset_));
       }
     } else {
       use_read_ = Maybe::kNo;
     }
     if (madvise(current_, kPageSize, MADV_SEQUENTIAL | MADV_WILLNEED) == -1) {
-      PLOG(WARNING, "madvise(%p, %zd, MADV_SEQUENTIAL | MADV_WILLNEED) failed",
-           current_, kPageSize);
+      AOS_PLOG(WARNING,
+               "madvise(%p, %zd, MADV_SEQUENTIAL | MADV_WILLNEED) failed",
+               current_, kPageSize);
     }
   }
   offset_ += kPageSize;
 }
 
 void LogFileAccessor::Unmap(void *location) {
-  CHECK_NE(Maybe::kUnknown, use_read_);
+  AOS_CHECK_NE(Maybe::kUnknown, use_read_);
 
   if (use_read_ == Maybe::kNo) {
     if (munmap(location, kPageSize) == -1) {
-      PLOG(FATAL, "munmap(%p, %zd) failed", location, kPageSize);
+      AOS_PLOG(FATAL, "munmap(%p, %zd) failed", location, kPageSize);
     }
   }
   is_last_page_ = Maybe::kUnknown;
@@ -140,7 +142,7 @@
     r = static_cast<LogFileMessageHeader *>(
         static_cast<void *>(&current()[position()]));
     if (wait) {
-      CHECK(definitely_use_mmap());
+      AOS_CHECK(definitely_use_mmap());
       if (futex_wait(&r->marker) != 0) continue;
     }
     if (r->marker == 2) {
@@ -158,7 +160,7 @@
   if (position() >= kPageSize) {
     // It's a lot better to blow up here rather than getting SIGBUS errors the
     // next time we try to read...
-    LOG(FATAL, "corrupt log file running over page size\n");
+    AOS_LOG(FATAL, "corrupt log file running over page size\n");
   }
   return r;
 }
@@ -189,31 +191,31 @@
     action.sa_flags = SA_RESETHAND | SA_SIGINFO;
     struct sigaction previous_bus, previous_segv;
     if (sigaction(SIGBUS, &action, &previous_bus) == -1) {
-      PLOG(FATAL, "sigaction(SIGBUS(=%d), %p, %p) failed",
-           SIGBUS, &action, &previous_bus);
+      AOS_PLOG(FATAL, "sigaction(SIGBUS(=%d), %p, %p) failed", SIGBUS, &action,
+               &previous_bus);
     }
     if (sigaction(SIGSEGV, &action, &previous_segv) == -1) {
-      PLOG(FATAL, "sigaction(SIGSEGV(=%d), %p, %p) failed",
-           SIGSEGV, &action, &previous_segv);
+      AOS_PLOG(FATAL, "sigaction(SIGSEGV(=%d), %p, %p) failed", SIGSEGV,
+               &action, &previous_segv);
     }
 
     char __attribute__((unused)) c = current()[0];
 
     if (sigaction(SIGBUS, &previous_bus, NULL) == -1) {
-      PLOG(FATAL, "sigaction(SIGBUS(=%d), %p, NULL) failed",
-           SIGBUS, &previous_bus);
+      AOS_PLOG(FATAL, "sigaction(SIGBUS(=%d), %p, NULL) failed", SIGBUS,
+               &previous_bus);
     }
     if (sigaction(SIGSEGV, &previous_segv, NULL) == -1) {
-      PLOG(FATAL, "sigaction(SIGSEGV(=%d), %p, NULL) failed",
-           SIGSEGV, &previous_segv);
+      AOS_PLOG(FATAL, "sigaction(SIGSEGV(=%d), %p, NULL) failed", SIGSEGV,
+               &previous_segv);
     }
   } else {
     if (fault_address == current()) {
-      LOG(FATAL, "could not read 1 byte at offset 0x%jx into log file\n",
-          static_cast<uintmax_t>(offset()));
+      AOS_LOG(FATAL, "could not read 1 byte at offset 0x%jx into log file\n",
+              static_cast<uintmax_t>(offset()));
     } else {
-      LOG(FATAL, "faulted at %p, not %p like we were (maybe) supposed to\n",
-          fault_address, current());
+      AOS_LOG(FATAL, "faulted at %p, not %p like we were (maybe) supposed to\n",
+              fault_address, current());
     }
   }
 }
@@ -234,7 +236,7 @@
     ++next_message_page;
   }
   const off_t current_seekable_page = next_message_page / kSeekPages;
-  CHECK_LE(*cookie, current_seekable_page);
+  AOS_CHECK_LE(*cookie, current_seekable_page);
   const bool r = *cookie != current_seekable_page;
   *cookie = current_seekable_page;
   return r;
@@ -252,8 +254,8 @@
   if (futex_set_value(
           static_cast<aos_futex *>(static_cast<void *>(&temp[position()])),
           2) == -1) {
-    PLOG(WARNING, "readers will hang because futex_set_value(%p, 2) failed",
-         &temp[position()]);
+    AOS_PLOG(WARNING, "readers will hang because futex_set_value(%p, 2) failed",
+             &temp[position()]);
   }
   Unmap(temp);
 }
diff --git a/aos/logging/binary_log_writer.cc b/aos/logging/binary_log_writer.cc
index e335b53..be19d45 100644
--- a/aos/logging/binary_log_writer.cc
+++ b/aos/logging/binary_log_writer.cc
@@ -42,8 +42,8 @@
   char buffer[1024];
   ssize_t size = type.Serialize(buffer, sizeof(buffer));
   if (size == -1) {
-    LOG(WARNING, "%zu-byte buffer is too small to serialize type %s\n",
-        sizeof(buffer), type.name.c_str());
+    AOS_LOG(WARNING, "%zu-byte buffer is too small to serialize type %s\n",
+            sizeof(buffer), type.name.c_str());
     return;
   }
   LogFileMessageHeader *const output =
@@ -78,7 +78,7 @@
       if (errno == 0) {
         break;
       } else {
-        PLOG(FATAL, "readdir(%p) failed", d);
+        AOS_PLOG(FATAL, "readdir(%p) failed", d);
       }
     } else {
       if (sscanf(dir->d_name, "aos_log-%d", &index) == 1) {
@@ -97,15 +97,16 @@
     previous[len] = '\0';
   } else {
     previous[0] = '\0';
-    LOG(INFO, "Could not find aos_log-current\n");
+    AOS_LOG(INFO, "Could not find aos_log-current\n");
     printf("Could not find aos_log-current\n");
   }
   if (asprintf(filename, "%s/aos_log-%03d", directory, fileindex) == -1) {
     PDie("couldn't create final name");
   }
-  LOG(INFO, "Created log file (aos_log-%d) in directory (%s). Previous file "
-            "was (%s).\n",
-      fileindex, directory, previous);
+  AOS_LOG(INFO,
+          "Created log file (aos_log-%d) in directory (%s). Previous file "
+          "was (%s).\n",
+          fileindex, directory, previous);
   printf("Created log file (aos_log-%d) in directory (%s). Previous file was "
          "(%s).\n",
          fileindex, directory, previous);
@@ -138,7 +139,7 @@
   char test_device[10];
   for (char i = 'a'; i < 'z'; ++i) {
     snprintf(test_device, sizeof(test_device), "/dev/sd%c", i);
-    LOG(INFO, "Trying to access %s\n", test_device);
+    AOS_LOG(INFO, "Trying to access %s\n", test_device);
     if (access(test_device, F_OK) != -1) {
       snprintf(device, device_size, "sd%c", i);
       return true;
@@ -157,13 +158,13 @@
   {
     char dev_name[8];
     while (!FindDevice(dev_name, sizeof(dev_name))) {
-      LOG(INFO, "Waiting for a device\n");
+      AOS_LOG(INFO, "Waiting for a device\n");
       printf("Waiting for a device\n");
       sleep(5);
     }
     snprintf(folder, sizeof(folder), "/media/%s1", dev_name);
     while (!FoundThumbDrive(folder)) {
-      LOG(INFO, "Waiting for %s\n", folder);
+      AOS_LOG(INFO, "Waiting for %s\n", folder);
       printf("Waiting for %s\n", folder);
       sleep(1);
     }
@@ -175,21 +176,21 @@
   const char *folder = configuration::GetLoggingDirectory();
   if (access(folder, R_OK | W_OK) == -1) {
 #endif
-    LOG(FATAL, "folder '%s' does not exist. please create it\n", folder);
+    AOS_LOG(FATAL, "folder '%s' does not exist. please create it\n", folder);
   }
-  LOG(INFO, "logging to folder '%s'\n", folder);
+  AOS_LOG(INFO, "logging to folder '%s'\n", folder);
 
   char *tmp;
   AllocateLogName(&tmp, folder);
   char *tmp2;
   if (asprintf(&tmp2, "%s/aos_log-current", folder) == -1) {
-    PLOG(WARNING, "couldn't create current symlink name");
+    AOS_PLOG(WARNING, "couldn't create current symlink name");
   } else {
     if (unlink(tmp2) == -1 && (errno != EROFS && errno != ENOENT)) {
-      LOG(WARNING, "unlink('%s') failed", tmp2);
+      AOS_LOG(WARNING, "unlink('%s') failed", tmp2);
     }
     if (symlink(tmp, tmp2) == -1) {
-      PLOG(WARNING, "symlink('%s', '%s') failed", tmp, tmp2);
+      AOS_PLOG(WARNING, "symlink('%s', '%s') failed", tmp, tmp2);
     }
     free(tmp2);
   }
@@ -197,7 +198,7 @@
                 S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);
   free(tmp);
   if (fd == -1) {
-    PLOG(FATAL, "opening file '%s' failed", tmp);
+    AOS_PLOG(FATAL, "opening file '%s' failed", tmp);
   }
   LogFileWriter writer(fd);
 
@@ -234,7 +235,7 @@
       output_length +=
           sizeof(msg->matrix.type) + sizeof(uint32_t) + sizeof(uint16_t) +
           sizeof(uint16_t) + msg->matrix.string_length;
-      CHECK(MessageType::IsPrimitive(msg->matrix.type));
+      AOS_CHECK(MessageType::IsPrimitive(msg->matrix.type));
     }
     LogFileMessageHeader *const output = writer.GetWritePosition(output_length);
     char *output_strings = reinterpret_cast<char *>(output) + sizeof(*output);
@@ -289,8 +290,8 @@
         memcpy(position, &cols, sizeof(cols));
         position += sizeof(cols);
         output->message_size += sizeof(rows) + sizeof(cols);
-        CHECK_EQ(msg->message_length,
-                 MessageType::Sizeof(msg->matrix.type) * rows * cols);
+        AOS_CHECK_EQ(msg->message_length,
+                     MessageType::Sizeof(msg->matrix.type) * rows * cols);
 
         memcpy(position, msg->matrix.data, msg->message_length + length);
         output->message_size += length;
@@ -301,8 +302,8 @@
 
     if (output->message_size - msg->message_length !=
         output_length - raw_output_length) {
-      LOG(FATAL, "%zu != %zu\n", output->message_size - msg->message_length,
-          output_length - raw_output_length);
+      AOS_LOG(FATAL, "%zu != %zu\n", output->message_size - msg->message_length,
+              output_length - raw_output_length);
     }
 
     futex_set(&output->marker);
diff --git a/aos/logging/implementations.cc b/aos/logging/implementations.cc
index 273c583..632d90b 100644
--- a/aos/logging/implementations.cc
+++ b/aos/logging/implementations.cc
@@ -21,15 +21,15 @@
 
 // The root LogImplementation. It only logs to stderr/stdout.
 // Some of the things specified in the LogImplementation documentation doesn't
-// apply here (mostly the parts about being able to use LOG) because this is the
-// root one.
+// apply here (mostly the parts about being able to use AOS_LOG) because this is
+// the root one.
 class RootLogImplementation : public SimpleLogImplementation {
  public:
   void have_other_implementation() { only_implementation_ = false; }
 
  private:
   void set_next(LogImplementation *) override {
-    LOG(FATAL, "can't have a next logger from here\n");
+    AOS_LOG(FATAL, "can't have a next logger from here\n");
   }
 
   __attribute__((format(GOOD_PRINTF_FORMAT_TYPE, 3, 0)))
@@ -68,8 +68,7 @@
 
   if (pthread_atfork(NULL /*prepare*/, NULL /*parent*/,
                      NewContext /*child*/) != 0) {
-    LOG(FATAL, "pthread_atfork(NULL, NULL, %p) failed\n",
-        NewContext);
+    AOS_LOG(FATAL, "pthread_atfork(NULL, NULL, %p) failed\n", NewContext);
   }
 
   return NULL;
@@ -116,7 +115,8 @@
   FillInMessageBase(level, monotonic_now, message);
 
   if (message_string.size() + size > sizeof(message->structure.serialized)) {
-    LOG(FATAL,
+    AOS_LOG(
+        FATAL,
         "serialized struct %s (size %zd + %zd > %zd) and message %s too big\n",
         type->name.c_str(), message_string.size(), size,
         sizeof(message->structure.serialized), message_string.c_str());
@@ -135,7 +135,7 @@
                          const ::std::string &message_string, uint32_t type_id,
                          int rows, int cols, const void *data,
                          LogMessage *message) {
-  CHECK(MessageType::IsPrimitive(type_id));
+  AOS_CHECK(MessageType::IsPrimitive(type_id));
   message->matrix.type = type_id;
 
   const auto element_size = MessageType::Sizeof(type_id);
@@ -145,9 +145,10 @@
   message->message_length = rows * cols * element_size;
   if (message_string.size() + message->message_length >
       sizeof(message->matrix.data)) {
-    LOG(FATAL, "%dx%d matrix of type %" PRIu32
-               " (size %u) and message %s is too big\n",
-        rows, cols, type_id, element_size, message_string.c_str());
+    AOS_LOG(FATAL,
+            "%dx%d matrix of type %" PRIu32
+            " (size %u) and message %s is too big\n",
+            rows, cols, type_id, element_size, message_string.c_str());
   }
   message->matrix.string_length = message_string.size();
   memcpy(message->matrix.data, message_string.data(),
@@ -187,15 +188,17 @@
               buffer, &output_length,
               message.structure.serialized + message.structure.string_length,
               &input_length, type_cache::Get(message.structure.type_id))) {
-        LOG(FATAL,
+        AOS_LOG(
+            FATAL,
             "printing message (%.*s) of type %s into %zu-byte buffer failed\n",
             static_cast<int>(message.message_length), message.message,
             type_cache::Get(message.structure.type_id).name.c_str(),
             sizeof(buffer));
       }
       if (input_length > 0) {
-        LOG(WARNING, "%zu extra bytes on message of type %s\n", input_length,
-            type_cache::Get(message.structure.type_id).name.c_str());
+        AOS_LOG(WARNING, "%zu extra bytes on message of type %s\n",
+                input_length,
+                type_cache::Get(message.structure.type_id).name.c_str());
       }
       fprintf(output, AOS_LOGGING_BASE_FORMAT "%.*s: %.*s\n", BASE_ARGS,
               static_cast<int>(message.structure.string_length),
@@ -208,17 +211,17 @@
       if (message.message_length !=
           static_cast<size_t>(message.matrix.rows * message.matrix.cols *
                               MessageType::Sizeof(message.matrix.type))) {
-        LOG(FATAL, "expected %d bytes of matrix data but have %zu\n",
-            message.matrix.rows * message.matrix.cols *
-                MessageType::Sizeof(message.matrix.type),
-            message.message_length);
+        AOS_LOG(FATAL, "expected %d bytes of matrix data but have %zu\n",
+                message.matrix.rows * message.matrix.cols *
+                    MessageType::Sizeof(message.matrix.type),
+                message.message_length);
       }
       if (!PrintMatrix(buffer, &output_length,
                        message.matrix.data + message.matrix.string_length,
                        message.matrix.type, message.matrix.rows,
                        message.matrix.cols)) {
-        LOG(FATAL, "printing %dx%d matrix of type %" PRIu32 " failed\n",
-            message.matrix.rows, message.matrix.cols, message.matrix.type);
+        AOS_LOG(FATAL, "printing %dx%d matrix of type %" PRIu32 " failed\n",
+                message.matrix.rows, message.matrix.cols, message.matrix.type);
       }
       fprintf(output, AOS_LOGGING_BASE_FORMAT "%.*s: %.*s\n", BASE_ARGS,
               static_cast<int>(message.matrix.string_length),
@@ -236,16 +239,17 @@
     const MessageType *type, const ::std::function<size_t(char *)> &serialize) {
   char serialized[1024];
   if (size > sizeof(serialized)) {
-    LOG(FATAL, "structure of type %s too big to serialize\n",
-        type->name.c_str());
+    AOS_LOG(FATAL, "structure of type %s too big to serialize\n",
+            type->name.c_str());
   }
   size_t used = serialize(serialized);
   char printed[1024];
   size_t printed_bytes = sizeof(printed);
   if (!PrintMessage(printed, &printed_bytes, serialized, &used, *type)) {
-    LOG(FATAL, "PrintMessage(%p, %p(=%zd), %p, %p(=%zd), %p(name=%s)) failed\n",
-        printed, &printed_bytes, printed_bytes, serialized, &used, used, type,
-        type->name.c_str());
+    AOS_LOG(FATAL,
+            "PrintMessage(%p, %p(=%zd), %p, %p(=%zd), %p(name=%s)) failed\n",
+            printed, &printed_bytes, printed_bytes, serialized, &used, used,
+            type, type->name.c_str());
   }
   DoLogVariadic(level, "%.*s: %.*s\n", static_cast<int>(message.size()),
                 message.data(),
@@ -258,16 +262,17 @@
   char serialized[1024];
   if (static_cast<size_t>(rows * cols * MessageType::Sizeof(type_id)) >
       sizeof(serialized)) {
-    LOG(FATAL, "matrix of size %u too big to serialize\n",
-        rows * cols * MessageType::Sizeof(type_id));
+    AOS_LOG(FATAL, "matrix of size %u too big to serialize\n",
+            rows * cols * MessageType::Sizeof(type_id));
   }
   SerializeMatrix(type_id, serialized, data, rows, cols);
   char printed[1024];
   size_t printed_bytes = sizeof(printed);
   if (!PrintMatrix(printed, &printed_bytes, serialized, type_id, rows, cols)) {
-    LOG(FATAL, "PrintMatrix(%p, %p(=%zd), %p, %" PRIu32 ", %d, %d) failed\n",
-        printed, &printed_bytes, printed_bytes, serialized, type_id, rows,
-        cols);
+    AOS_LOG(FATAL,
+            "PrintMatrix(%p, %p(=%zd), %p, %" PRIu32 ", %d, %d) failed\n",
+            printed, &printed_bytes, printed_bytes, serialized, type_id, rows,
+            cols);
   }
   DoLogVariadic(level, "%.*s: %.*s\n", static_cast<int>(message.size()),
                 message.data(),
@@ -311,8 +316,10 @@
   internal::Context *context = internal::Context::Get();
 
   if (implementation->next() != NULL) {
-    LOG(FATAL, "%p already has a next implementation, but it's not"
-        " being used yet\n", implementation);
+    AOS_LOG(FATAL,
+            "%p already has a next implementation, but it's not"
+            " being used yet\n",
+            implementation);
   }
 
   LogImplementation *old = context->implementation;
@@ -348,7 +355,7 @@
 LogMessage *GetMessageOrDie() {
   LogMessage *message = static_cast<LogMessage *>(queue->GetMessage());
   if (message == NULL) {
-    LOG(FATAL, "%p->GetMessage() failed\n", queue);
+    AOS_LOG(FATAL, "%p->GetMessage() failed\n", queue);
   } else {
     return message;
   }
diff --git a/aos/logging/implementations_test.cc b/aos/logging/implementations_test.cc
index ecf66e9..2accf35 100644
--- a/aos/logging/implementations_test.cc
+++ b/aos/logging/implementations_test.cc
@@ -63,17 +63,17 @@
     }
     internal::Context *context = internal::Context::Get();
     if (log_implementation->message().source != context->source) {
-      LOG(FATAL, "got a message from %" PRIu32 ", but we're %" PRIu32 "\n",
-          static_cast<uint32_t>(log_implementation->message().source),
-          static_cast<uint32_t>(context->source));
+      AOS_LOG(FATAL, "got a message from %" PRIu32 ", but we're %" PRIu32 "\n",
+              static_cast<uint32_t>(log_implementation->message().source),
+              static_cast<uint32_t>(context->source));
     }
     if (log_implementation->message().name_length != context->name_size ||
         memcmp(log_implementation->message().name, context->name,
                context->name_size) !=
             0) {
-      LOG(FATAL, "got a message from %.*s, but we're %s\n",
-          static_cast<int>(log_implementation->message().name_length),
-          log_implementation->message().name, context->name);
+      AOS_LOG(FATAL, "got a message from %.*s, but we're %s\n",
+              static_cast<int>(log_implementation->message().name_length),
+              log_implementation->message().name, context->name);
     }
     if (strstr(log_implementation->message().message, message.c_str())
         == NULL) {
@@ -110,26 +110,26 @@
 // correctly.
 TEST_F(LoggingTest, Basic) {
   EXPECT_FALSE(WasAnythingLogged());
-  LOG(INFO, "test log 1\n");
+  AOS_LOG(INFO, "test log 1\n");
   EXPECT_TRUE(WasLogged(INFO, "test log 1\n"));
-  LOG(INFO, "test log 1.5\n");
+  AOS_LOG(INFO, "test log 1.5\n");
   // there's a subtle typo on purpose...
   EXPECT_FALSE(WasLogged(INFO, "test log 15\n"));
-  LOG(ERROR, "test log 2=%d\n", 55);
+  AOS_LOG(ERROR, "test log 2=%d\n", 55);
   EXPECT_TRUE(WasLogged(ERROR, "test log 2=55\n"));
-  LOG(ERROR, "test log 3\n");
+  AOS_LOG(ERROR, "test log 3\n");
   EXPECT_FALSE(WasLogged(WARNING, "test log 3\n"));
-  LOG(WARNING, "test log 4\n");
+  AOS_LOG(WARNING, "test log 4\n");
   EXPECT_TRUE(WasAnythingLogged());
 }
 TEST_F(LoggingTest, Cork) {
   static const int begin_line = __LINE__;
-  LOG_CORK("first part ");
-  LOG_CORK("second part (=%d) ", 19);
+  AOS_LOG_CORK("first part ");
+  AOS_LOG_CORK("second part (=%d) ", 19);
   EXPECT_FALSE(WasAnythingLogged());
-  LOG_CORK("third part ");
+  AOS_LOG_CORK("third part ");
   static const int end_line = __LINE__;
-  LOG_UNCORK(WARNING, "last part %d\n", 5);
+  AOS_LOG_UNCORK(WARNING, "last part %d\n", 5);
   std::stringstream expected;
   expected << "implementations_test.cc: ";
   expected << (begin_line + 1);
@@ -142,27 +142,24 @@
 }
 
 TEST_F(LoggingDeathTest, Fatal) {
-  ASSERT_EXIT(LOG(FATAL, "this should crash it\n"),
-              ::testing::KilledBySignal(SIGABRT),
-              "this should crash it");
+  ASSERT_EXIT(AOS_LOG(FATAL, "this should crash it\n"),
+              ::testing::KilledBySignal(SIGABRT), "this should crash it");
 }
 
 TEST_F(LoggingDeathTest, PCHECK) {
-  EXPECT_DEATH(PCHECK(fprintf(stdin, "nope")),
+  EXPECT_DEATH(AOS_PCHECK(fprintf(stdin, "nope")),
                ".*fprintf\\(stdin, \"nope\"\\).*failed.*");
 }
 
-TEST_F(LoggingTest, PCHECK) {
-  EXPECT_EQ(7, PCHECK(printf("abc123\n")));
-}
+TEST_F(LoggingTest, PCHECK) { EXPECT_EQ(7, AOS_PCHECK(printf("abc123\n"))); }
 
 TEST_F(LoggingTest, PrintfDirectives) {
-  LOG(INFO, "test log %%1 %%d\n");
+  AOS_LOG(INFO, "test log %%1 %%d\n");
   EXPECT_TRUE(WasLogged(INFO, "test log %1 %d\n"));
-  LOG_DYNAMIC(WARNING, "test log %%2 %%f\n");
+  AOS_LOG_DYNAMIC(WARNING, "test log %%2 %%f\n");
   EXPECT_TRUE(WasLogged(WARNING, "test log %2 %f\n"));
-  LOG_CORK("log 3 part %%1 %%d ");
-  LOG_UNCORK(DEBUG, "log 3 part %%2 %%f\n");
+  AOS_LOG_CORK("log 3 part %%1 %%d ");
+  AOS_LOG_UNCORK(DEBUG, "log 3 part %%2 %%f\n");
   EXPECT_TRUE(WasLogged(DEBUG, "log 3 part %1 %d log 3 part %2 %f\n"));
 }
 
@@ -173,7 +170,7 @@
 
   monotonic_clock::time_point start = monotonic_clock::now();
   for (long i = 0; i < kTimingCycles; ++i) {
-    LOG(INFO, "a\n");
+    AOS_LOG(INFO, "a\n");
   }
   monotonic_clock::time_point end = monotonic_clock::now();
   auto diff = end - start;
@@ -183,7 +180,7 @@
 
   start = monotonic_clock::now();
   for (long i = 0; i < kTimingCycles; ++i) {
-    LOG(INFO, "something longer than just \"a\" to log to test timing\n");
+    AOS_LOG(INFO, "something longer than just \"a\" to log to test timing\n");
   }
   end = monotonic_clock::now();
   diff = end - start;
diff --git a/aos/logging/interface.cc b/aos/logging/interface.cc
index fb3b60e..bcd8470 100644
--- a/aos/logging/interface.cc
+++ b/aos/logging/interface.cc
@@ -21,7 +21,7 @@
   const int ret = vsnprintf(output, size, format, ap);
   typedef ::std::common_type<typeof(ret), typeof(size)>::type RetType;
   if (ret < 0) {
-    PLOG(FATAL, "vsnprintf(%p, %zd, %s, args) failed",
+    AOS_PLOG(FATAL, "vsnprintf(%p, %zd, %s, args) failed",
          output, size, format);
   } else if (static_cast<RetType>(ret) >= static_cast<RetType>(size)) {
     // Overwrite the '\0' at the end of the existing data and
@@ -84,8 +84,9 @@
     context->cork_data.function = function;
   } else {
     if (strcmp(context->cork_data.function, function) != 0) {
-      LOG(FATAL, "started corking data in function %s but then moved to %s\n",
-          context->cork_data.function, function);
+      AOS_LOG(FATAL,
+              "started corking data in function %s but then moved to %s\n",
+              context->cork_data.function, function);
     }
   }
 
diff --git a/aos/logging/log_displayer.cc b/aos/logging/log_displayer.cc
index 0480b4b..e63bdc3 100644
--- a/aos/logging/log_displayer.cc
+++ b/aos/logging/log_displayer.cc
@@ -75,28 +75,28 @@
       "possible arguments for the -n option cannot be shown. log_displayer\n"
       "looks for start_list.txt in the current working directory and in\n"
       "%s.\n\n", ::aos::configuration::GetRootDirectory());
-      PLOG(FATAL, "Unable to open start_list.txt");
+      AOS_PLOG(FATAL, "Unable to open start_list.txt");
     }
   }
 
   // Get file size.
   if (fseek(start_list, 0, SEEK_END)) {
-    PLOG(FATAL, "fseek() failed while reading start_list.txt");
+    AOS_PLOG(FATAL, "fseek() failed while reading start_list.txt");
   }
   int size = ftell(start_list);
   if (size < 0) {
-    PLOG(FATAL, "ftell() failed while reading start_list.txt");
+    AOS_PLOG(FATAL, "ftell() failed while reading start_list.txt");
   }
   rewind(start_list);
 
   ::std::unique_ptr<char[]> contents(new char[size + 1]);
   if (contents == NULL) {
-    LOG(FATAL, "malloc() failed while reading start_list.txt.\n");
+    AOS_LOG(FATAL, "malloc() failed while reading start_list.txt.\n");
   }
   size_t bytes_read = fread(contents.get(), 1, size, start_list);
   if (bytes_read < static_cast<size_t>(size)) {
-    LOG(FATAL, "Read %zu bytes from start_list.txt, expected %d.\n",
-        bytes_read, size);
+    AOS_LOG(FATAL, "Read %zu bytes from start_list.txt, expected %d.\n",
+            bytes_read, size);
   }
 
   // printf doesn't like strings without the \0.
@@ -104,7 +104,7 @@
   fprintf(stderr, "\nPossible arguments for the -n option:\n%s", contents.get());
 
   if (fclose(start_list)) {
-    LOG(FATAL, "fclose() failed.\n");
+    AOS_LOG(FATAL, "fclose() failed.\n");
   }
 
   exit(EXIT_SUCCESS);
@@ -249,7 +249,7 @@
       ::aos::logging::log_str(filter_level), filename);
 
   if (fd == -1) {
-    PLOG(FATAL, "couldn't open file '%s' for reading", filename);
+    AOS_PLOG(FATAL, "couldn't open file '%s' for reading", filename);
   }
   ::aos::logging::linux_code::LogFileReader reader(fd);
 
@@ -272,16 +272,17 @@
       ::aos::MessageType *type = ::aos::MessageType::Deserialize(
           reinterpret_cast<const char *>(msg + 1), &bytes);
       if (type == nullptr) {
-        LOG(INFO, "Trying old version of type decoding.\n");
+        AOS_LOG(INFO, "Trying old version of type decoding.\n");
         bytes = msg->message_size;
         type = ::aos::MessageType::Deserialize(
             reinterpret_cast<const char *>(msg + 1), &bytes, false);
       }
 
       if (type == nullptr) {
-        LOG(WARNING, "Error deserializing MessageType of size %" PRIx32
-                     " starting at %zx.\n",
-            msg->message_size, reader.file_offset(msg + 1));
+        AOS_LOG(WARNING,
+                "Error deserializing MessageType of size %" PRIx32
+                " starting at %zx.\n",
+                msg->message_size, reader.file_offset(msg + 1));
       } else {
         ::aos::type_cache::Add(*type);
       }
@@ -357,14 +358,15 @@
             (sizeof(type_id) + sizeof(uint32_t) + string_length);
         if (!PrintMessage(buffer, &output_length, position + string_length,
                           &input_length, ::aos::type_cache::Get(type_id))) {
-          LOG(FATAL, "printing message (%.*s) of type %s into %zu-byte buffer "
-                     "failed\n",
-              static_cast<int>(string_length), position,
-              ::aos::type_cache::Get(type_id).name.c_str(), sizeof(buffer));
+          AOS_LOG(FATAL,
+                  "printing message (%.*s) of type %s into %zu-byte buffer "
+                  "failed\n",
+                  static_cast<int>(string_length), position,
+                  ::aos::type_cache::Get(type_id).name.c_str(), sizeof(buffer));
         }
         if (input_length > 0) {
-          LOG(WARNING, "%zu extra bytes on message of type %s\n",
-              input_length, ::aos::type_cache::Get(type_id).name.c_str());
+          AOS_LOG(WARNING, "%zu extra bytes on message of type %s\n",
+                  input_length, ::aos::type_cache::Get(type_id).name.c_str());
         }
         fprintf(stdout, AOS_LOGGING_BASE_FORMAT "%.*s: %.*s\n", BASE_ARGS,
                 static_cast<int>(string_length), position,
@@ -390,20 +392,21 @@
             msg->message_size -
             (sizeof(type) + sizeof(uint32_t) + sizeof(uint16_t) +
              sizeof(uint16_t) + string_length);
-        CHECK_EQ(matrix_bytes, ::aos::MessageType::Sizeof(type) * rows * cols);
+        AOS_CHECK_EQ(matrix_bytes,
+                     ::aos::MessageType::Sizeof(type) * rows * cols);
         char buffer[4096];
         size_t output_length = sizeof(buffer);
         if (!::aos::PrintMatrix(buffer, &output_length,
                                 position + string_length, type, rows, cols)) {
-          LOG(FATAL, "printing %dx%d matrix of type %" PRIu32 " failed\n", rows,
-              cols, type);
+          AOS_LOG(FATAL, "printing %dx%d matrix of type %" PRIu32 " failed\n",
+                  rows, cols, type);
         }
         fprintf(stdout, AOS_LOGGING_BASE_FORMAT "%.*s: %.*s\n", BASE_ARGS,
                 static_cast<int>(string_length), position,
                 static_cast<int>(sizeof(buffer) - output_length), buffer);
       } break;
       case LogFileMessageHeader::MessageType::kStructType:
-        LOG(FATAL, "shouldn't get here\n");
+        AOS_LOG(FATAL, "shouldn't get here\n");
         break;
     }
 #undef BASE_ARGS
diff --git a/aos/logging/logging.h b/aos/logging/logging.h
index 6682098..bd9b103 100644
--- a/aos/logging/logging.h
+++ b/aos/logging/logging.h
@@ -4,14 +4,14 @@
 // This file contains the logging client interface. It works with both C and C++
 // code.
 
-#include <stdio.h>
+#include <errno.h>
 #include <stdint.h>
+#include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <errno.h>
 
-#include "aos/macros.h"
 #include "aos/libc/aos_strerror.h"
+#include "aos/macros.h"
 
 #ifdef __cplusplus
 extern "C" {
@@ -19,16 +19,16 @@
 
 typedef uint8_t log_level;
 
-#define DECL_LEVELS \
-DECL_LEVEL(DEBUG, 0); /* stuff that gets printed out every cycle */ \
-DECL_LEVEL(INFO, 1); /* things like PosEdge/NegEdge */ \
-/* things that might still work if they happen occasionally */ \
-DECL_LEVEL(WARNING, 2); \
-/*-1 so that vxworks macro of same name will have same effect if used*/ \
-DECL_LEVEL(ERROR, -1); /* errors */ \
-/* serious errors. the logging code will terminate the process/task */ \
-DECL_LEVEL(FATAL, 4); \
-DECL_LEVEL(LOG_UNKNOWN, 5); /* unknown logging level */
+#define DECL_LEVELS                                                       \
+  DECL_LEVEL(DEBUG, 0); /* stuff that gets printed out every cycle */     \
+  DECL_LEVEL(INFO, 1);  /* things like PosEdge/NegEdge */                 \
+  /* things that might still work if they happen occasionally */          \
+  DECL_LEVEL(WARNING, 2);                                                 \
+  /*-1 so that vxworks macro of same name will have same effect if used*/ \
+  DECL_LEVEL(ERROR, -1); /* errors */                                     \
+  /* serious errors. the logging code will terminate the process/task */  \
+  DECL_LEVEL(FATAL, 4);                                                   \
+  DECL_LEVEL(LOG_UNKNOWN, 5); /* unknown logging level */
 #define DECL_LEVEL(name, value) static const log_level name = value;
 DECL_LEVELS;
 #undef DECL_LEVEL
@@ -40,14 +40,14 @@
 // Actually implements the basic logging call.
 // Does not check that level is valid.
 void log_do(log_level level, const char *format, ...)
-  __attribute__((format(GOOD_PRINTF_FORMAT_TYPE, 2, 3)));
+    __attribute__((format(GOOD_PRINTF_FORMAT_TYPE, 2, 3)));
 
 void log_cork(int line, const char *function, const char *format, ...)
-  __attribute__((format(GOOD_PRINTF_FORMAT_TYPE, 3, 4)));
+    __attribute__((format(GOOD_PRINTF_FORMAT_TYPE, 3, 4)));
 // Implements the uncork logging call.
 void log_uncork(int line, const char *function, log_level level,
                 const char *file, const char *format, ...)
-  __attribute__((format(GOOD_PRINTF_FORMAT_TYPE, 5, 6)));
+    __attribute__((format(GOOD_PRINTF_FORMAT_TYPE, 5, 6)));
 
 #ifdef __cplusplus
 }
@@ -64,7 +64,7 @@
 #define LOG_SOURCENAME __FILE__
 
 // The basic logging call.
-#define LOG(level, format, args...)                                        \
+#define AOS_LOG(level, format, args...)                                    \
   do {                                                                     \
     log_do(level, LOG_SOURCENAME ": " STRINGIFY(__LINE__) ": %s: " format, \
            LOG_CURRENT_FUNCTION, ##args);                                  \
@@ -78,39 +78,39 @@
 
 // Same as LOG except appends " due to %d (%s)\n" (formatted with errno and
 // aos_strerror(errno)) to the message.
-#define PLOG(level, format, args...) PELOG(level, errno, format, ##args)
+#define AOS_PLOG(level, format, args...) AOS_PELOG(level, errno, format, ##args)
 
 // Like PLOG except allows specifying an error other than errno.
-#define PELOG(level, error_in, format, args...)           \
-  do {                                                    \
-    const int error = error_in;                           \
-    LOG(level, format " due to %d (%s)\n", ##args, error, \
-        aos_strerror(error));                             \
+#define AOS_PELOG(level, error_in, format, args...)           \
+  do {                                                        \
+    const int error = error_in;                               \
+    AOS_LOG(level, format " due to %d (%s)\n", ##args, error, \
+            aos_strerror(error));                             \
   } while (0);
 
 // Allows format to not be a string constant.
-#define LOG_DYNAMIC(level, format, args...)                             \
-  do {                                                                  \
-    static char log_buf[LOG_MESSAGE_LEN];                               \
-    int ret = snprintf(log_buf, sizeof(log_buf), format, ##args);       \
-    if (ret < 0 || (uintmax_t)ret >= LOG_MESSAGE_LEN) {                 \
-      LOG(ERROR, "next message was too long so not subbing in args\n"); \
-      LOG(level, "%s", format);                                         \
-    } else {                                                            \
-      LOG(level, "%s", log_buf);                                        \
-    }                                                                   \
+#define AOS_LOG_DYNAMIC(level, format, args...)                             \
+  do {                                                                      \
+    static char log_buf[LOG_MESSAGE_LEN];                                   \
+    int ret = snprintf(log_buf, sizeof(log_buf), format, ##args);           \
+    if (ret < 0 || (uintmax_t)ret >= LOG_MESSAGE_LEN) {                     \
+      AOS_LOG(ERROR, "next message was too long so not subbing in args\n"); \
+      AOS_LOG(level, "%s", format);                                         \
+    } else {                                                                \
+      AOS_LOG(level, "%s", log_buf);                                        \
+    }                                                                       \
   } while (0)
 
 // Allows "bottling up" multiple log fragments which can then all be logged in
 // one message with LOG_UNCORK.
 // Calls from a given thread/task will be grouped together.
-#define LOG_CORK(format, args...)                             \
+#define AOS_LOG_CORK(format, args...)                         \
   do {                                                        \
     log_cork(__LINE__, LOG_CURRENT_FUNCTION, format, ##args); \
   } while (0)
 // Actually logs all of the saved up log fragments (including format and args on
 // the end).
-#define LOG_UNCORK(level, format, args...)                                    \
+#define AOS_LOG_UNCORK(level, format, args...)                                \
   do {                                                                        \
     log_uncork(__LINE__, LOG_CURRENT_FUNCTION, level, LOG_SOURCENAME, format, \
                ##args);                                                       \
@@ -162,16 +162,16 @@
 // controlled by NDEBUG, so the check will be executed regardless of
 // compilation mode.  Therefore, it is safe to do things like:
 //    CHECK(fp->Write(x) == 4)
-#define CHECK(condition)                          \
-  if (__builtin_expect(!(condition), 0)) {        \
-    LOG(FATAL, "CHECK(%s) failed\n", #condition); \
+#define AOS_CHECK(condition)                          \
+  if (__builtin_expect(!(condition), 0)) {            \
+    AOS_LOG(FATAL, "CHECK(%s) failed\n", #condition); \
   }
 
 // Helper functions for CHECK_OP macro.
 // The (int, int) specialization works around the issue that the compiler
 // will not instantiate the template version of the function on values of
 // unnamed enum type.
-#define DEFINE_CHECK_OP_IMPL(name, op)                                       \
+#define AOS_DEFINE_CHECK_OP_IMPL(name, op)                                   \
   template <typename T1, typename T2>                                        \
   inline void LogImpl##name(const T1 &v1, const T2 &v2,                      \
                             const char *exprtext) {                          \
@@ -192,47 +192,47 @@
 // base/logging.h provides its own #defines for the simpler names EQ, NE, etc.
 // This happens if, for example, those are used as token names in a
 // yacc grammar.
-DEFINE_CHECK_OP_IMPL(Check_EQ, ==)  // Compilation error with CHECK_EQ(NULL, x)?
-DEFINE_CHECK_OP_IMPL(Check_NE, !=)  // Use CHECK(x == NULL) instead.
-DEFINE_CHECK_OP_IMPL(Check_LE, <=)
-DEFINE_CHECK_OP_IMPL(Check_LT, < )
-DEFINE_CHECK_OP_IMPL(Check_GE, >=)
-DEFINE_CHECK_OP_IMPL(Check_GT, > )
+AOS_DEFINE_CHECK_OP_IMPL(Check_EQ, ==)  // Compilation error with CHECK_EQ(NULL, x)?
+AOS_DEFINE_CHECK_OP_IMPL(Check_NE, !=)  // Use CHECK(x == NULL) instead.
+AOS_DEFINE_CHECK_OP_IMPL(Check_LE, <=)
+AOS_DEFINE_CHECK_OP_IMPL(Check_LT, <)
+AOS_DEFINE_CHECK_OP_IMPL(Check_GE, >=)
+AOS_DEFINE_CHECK_OP_IMPL(Check_GT, >)
 
-#define CHECK_OP(name, op, val1, val2)  \
-  ::aos::LogImplCheck##name(val1, val2, \
+#define AOS_CHECK_OP(name, op, val1, val2) \
+  ::aos::LogImplCheck##name(val1, val2,    \
                             STRINGIFY(val1) STRINGIFY(op) STRINGIFY(val2))
 
-#define CHECK_EQ(val1, val2) CHECK_OP(_EQ, ==, val1, val2)
-#define CHECK_NE(val1, val2) CHECK_OP(_NE, !=, val1, val2)
-#define CHECK_LE(val1, val2) CHECK_OP(_LE, <=, val1, val2)
-#define CHECK_LT(val1, val2) CHECK_OP(_LT, < , val1, val2)
-#define CHECK_GE(val1, val2) CHECK_OP(_GE, >=, val1, val2)
-#define CHECK_GT(val1, val2) CHECK_OP(_GT, > , val1, val2)
+#define AOS_CHECK_EQ(val1, val2) AOS_CHECK_OP(_EQ, ==, val1, val2)
+#define AOS_CHECK_NE(val1, val2) AOS_CHECK_OP(_NE, !=, val1, val2)
+#define AOS_CHECK_LE(val1, val2) AOS_CHECK_OP(_LE, <=, val1, val2)
+#define AOS_CHECK_LT(val1, val2) AOS_CHECK_OP(_LT, <, val1, val2)
+#define AOS_CHECK_GE(val1, val2) AOS_CHECK_OP(_GE, >=, val1, val2)
+#define AOS_CHECK_GT(val1, val2) AOS_CHECK_OP(_GT, >, val1, val2)
 
 // A small helper for CHECK_NOTNULL().
 template <typename T>
-inline T* CheckNotNull(const char *value_name, T *t) {
+inline T *CheckNotNull(const char *value_name, T *t) {
   if (t == NULL) {
-    LOG(FATAL, "'%s' must not be NULL\n", value_name);
+    AOS_LOG(FATAL, "'%s' must not be NULL\n", value_name);
   }
   return t;
 }
 
 // Check that the input is non NULL.  This very useful in constructor
 // initializer lists.
-#define CHECK_NOTNULL(val) ::aos::CheckNotNull(STRINGIFY(val), val)
+#define AOS_CHECK_NOTNULL(val) ::aos::CheckNotNull(STRINGIFY(val), val)
 
 inline int CheckSyscall(const char *syscall_string, int value) {
   if (__builtin_expect(value == -1, false)) {
-    PLOG(FATAL, "%s failed", syscall_string);
+    AOS_PLOG(FATAL, "%s failed", syscall_string);
   }
   return value;
 }
 
 inline void CheckSyscallReturn(const char *syscall_string, int value) {
   if (__builtin_expect(value != 0, false)) {
-    PELOG(FATAL, value, "%s failed", syscall_string);
+    AOS_PELOG(FATAL, value, "%s failed", syscall_string);
   }
 }
 
@@ -240,16 +240,17 @@
 // useful for quickly checking syscalls where it's not very useful to print out
 // the values of any of the arguments. Returns the result otherwise.
 //
-// Example: const int fd = PCHECK(open("/tmp/whatever", O_WRONLY))
-#define PCHECK(syscall) ::aos::CheckSyscall(STRINGIFY(syscall), syscall)
+// Example: const int fd = AOS_PCHECK(open("/tmp/whatever", O_WRONLY))
+#define AOS_PCHECK(syscall) ::aos::CheckSyscall(STRINGIFY(syscall), syscall)
 
 // PELOG(FATAL)s with the result of syscall if it returns anything other than 0.
 // This is useful for quickly checking things like many of the pthreads
 // functions where it's not very useful to print out the values of any of the
 // arguments.
 //
-// Example: PRCHECK(munmap(address, length))
-#define PRCHECK(syscall) ::aos::CheckSyscallReturn(STRINGIFY(syscall), syscall)
+// Example: AOS_PRCHECK(munmap(address, length))
+#define AOS_PRCHECK(syscall) \
+  ::aos::CheckSyscallReturn(STRINGIFY(syscall), syscall)
 
 }  // namespace aos
 
diff --git a/aos/logging/matrix_logging.h b/aos/logging/matrix_logging.h
index 630e85e..ef51d56 100644
--- a/aos/logging/matrix_logging.h
+++ b/aos/logging/matrix_logging.h
@@ -15,7 +15,7 @@
 
 // Logs the contents of a matrix and a constant string.
 // matrix must be an instance of an Eigen matrix (or something similar).
-#define LOG_MATRIX(level, message, matrix)                          \
+#define AOS_LOG_MATRIX(level, message, matrix)                      \
   do {                                                              \
     static const ::std::string kAosLoggingMessage(                  \
         LOG_SOURCENAME ": " STRINGIFY(__LINE__) ": " message);      \
diff --git a/aos/logging/queue_logging.h b/aos/logging/queue_logging.h
index a390412..fdebcc3 100644
--- a/aos/logging/queue_logging.h
+++ b/aos/logging/queue_logging.h
@@ -15,7 +15,7 @@
 
 // Logs the contents of a structure (or Queue message) and a constant string.
 // structure must be an instance of one of the generated queue types.
-#define LOG_STRUCT(level, message, structure)                       \
+#define AOS_LOG_STRUCT(level, message, structure)                   \
   do {                                                              \
     static const ::std::string kAosLoggingMessage(                  \
         LOG_SOURCENAME ": " STRINGIFY(__LINE__) ": " message);      \
diff --git a/aos/logging/replay.h b/aos/logging/replay.h
index 45a4cd2..6604591 100644
--- a/aos/logging/replay.h
+++ b/aos/logging/replay.h
@@ -57,11 +57,13 @@
   void AddHandler(const ::std::string &process_name,
                   const ::std::string &log_message,
                   ::std::function<void(const T &message)> handler) {
-    CHECK(handlers_.emplace(
-        ::std::piecewise_construct,
-        ::std::forward_as_tuple(process_name, log_message),
-        ::std::forward_as_tuple(::std::unique_ptr<StructHandlerInterface>(
-            new TypedStructHandler<T>(handler)))).second);
+    AOS_CHECK(handlers_
+                  .emplace(::std::piecewise_construct,
+                           ::std::forward_as_tuple(process_name, log_message),
+                           ::std::forward_as_tuple(
+                               ::std::unique_ptr<StructHandlerInterface>(
+                                   new TypedStructHandler<T>(handler))))
+                  .second);
   }
 
   // Adds a handler which takes messages and places them directly on a queue.
@@ -98,10 +100,11 @@
     void HandleStruct(::aos::monotonic_clock::time_point log_time,
                       uint32_t type_id, const void *data,
                       size_t data_size) override {
-      CHECK_EQ(type_id, T::GetType()->id);
+      AOS_CHECK_EQ(type_id, T::GetType()->id);
       T message;
-      CHECK_EQ(data_size, T::Size());
-      CHECK_EQ(data_size, message.Deserialize(static_cast<const char *>(data)));
+      AOS_CHECK_EQ(data_size, T::Size());
+      AOS_CHECK_EQ(data_size,
+                   message.Deserialize(static_cast<const char *>(data)));
       message.sent_time = log_time;
       handler_(message);
     }
@@ -119,11 +122,11 @@
                                  T::kQueueLength)) {}
 
     void operator()(const T &message) {
-      LOG_STRUCT(DEBUG, "re-sending", message);
+      AOS_LOG_STRUCT(DEBUG, "re-sending", message);
       void *raw_message = queue_->GetMessage();
-      CHECK_NOTNULL(raw_message);
+      AOS_CHECK_NOTNULL(raw_message);
       memcpy(raw_message, &message, sizeof(message));
-      CHECK(queue_->WriteMessage(raw_message, RawQueue::kOverride));
+      AOS_CHECK(queue_->WriteMessage(raw_message, RawQueue::kOverride));
     }
 
    private:
diff --git a/aos/mutex/mutex.cc b/aos/mutex/mutex.cc
index a35f0cd..c5570aa 100644
--- a/aos/mutex/mutex.cc
+++ b/aos/mutex/mutex.cc
@@ -19,8 +19,8 @@
   } else if (ret == 1) {
     return true;
   } else {
-    LOG(FATAL, "mutex_grab(%p(=%" PRIu32 ")) failed with %d\n",
-        &impl_, impl_.futex, ret);
+    AOS_LOG(FATAL, "mutex_grab(%p(=%" PRIu32 ")) failed with %d\n", &impl_,
+            impl_.futex, ret);
   }
 }
 
@@ -38,8 +38,8 @@
     case 4:
       return State::kLockFailed;
     default:
-      LOG(FATAL, "mutex_trylock(%p(=%" PRIu32 ")) failed with %d\n",
-          &impl_, impl_.futex, ret);
+      AOS_LOG(FATAL, "mutex_trylock(%p(=%" PRIu32 ")) failed with %d\n", &impl_,
+              impl_.futex, ret);
   }
 }
 
diff --git a/aos/network/team_number.cc b/aos/network/team_number.cc
index 4e3f472..c4fa5c2 100644
--- a/aos/network/team_number.cc
+++ b/aos/network/team_number.cc
@@ -47,7 +47,7 @@
 ::std::string GetHostname() {
   char buf[256];
   buf[sizeof(buf) - 1] = '\0';
-  PCHECK(gethostname(buf, sizeof(buf) - 1));
+  AOS_PCHECK(gethostname(buf, sizeof(buf) - 1));
   return buf;
 }
 
@@ -59,16 +59,16 @@
   const char *override_number = getenv("AOS_TEAM_NUMBER");
   if (override_number != nullptr) {
     if (!::aos::util::StringToNumber(override_number, &r)) {
-      LOG(FATAL, "error parsing AOS_TEAM_NUMBER '%s'\n", override_number);
+      AOS_LOG(FATAL, "error parsing AOS_TEAM_NUMBER '%s'\n", override_number);
     }
-    LOG(WARNING, "team number overridden by AOS_TEAM_NUMBER to %" PRIu16 "\n",
-        r);
+    AOS_LOG(WARNING,
+            "team number overridden by AOS_TEAM_NUMBER to %" PRIu16 "\n", r);
   } else {
     int error = internal::ParseTeamNumber(GetHostname(), &r);
     if (error) {
-      LOG(FATAL, "Invalid hostname %s\n", GetHostname().c_str());
+      AOS_LOG(FATAL, "Invalid hostname %s\n", GetHostname().c_str());
     }
-    LOG(INFO, "team number is %" PRIu16 "\n", r);
+    AOS_LOG(INFO, "team number is %" PRIu16 "\n", r);
   }
   return &r;
 }
diff --git a/aos/protobuf/stack_arena.cc b/aos/protobuf/stack_arena.cc
index da9b004..c085fcb 100644
--- a/aos/protobuf/stack_arena.cc
+++ b/aos/protobuf/stack_arena.cc
@@ -4,11 +4,11 @@
 namespace protobuf {
 
 void FatalArenaBlockAlloc(size_t) {
-  LOG(FATAL, "trying to allocate in arena code");
+  AOS_LOG(FATAL, "trying to allocate in arena code");
 }
 
 void FatalArenaBlockDealloc(void*, size_t) {
-  LOG(FATAL, "trying to deallocate in arena code");
+  AOS_LOG(FATAL, "trying to deallocate in arena code");
 }
 
 }  // namespace protobuf
diff --git a/aos/protobuf/stack_arena_test.cc b/aos/protobuf/stack_arena_test.cc
index c9eb5e8..a07ceea 100644
--- a/aos/protobuf/stack_arena_test.cc
+++ b/aos/protobuf/stack_arena_test.cc
@@ -22,7 +22,7 @@
 
   TestStruct* msg =
       google::protobuf::Arena::Create<TestStruct>(stack_arena.arena());
-  CHECK_NOTNULL(msg);
+  AOS_CHECK_NOTNULL(msg);
 }
 
 }  // namespace
diff --git a/aos/queue_types.cc b/aos/queue_types.cc
index 367d54a..a48c5a0 100644
--- a/aos/queue_types.cc
+++ b/aos/queue_types.cc
@@ -188,7 +188,7 @@
     output += output_bytes_before - *output_bytes;
     input = static_cast<const char *>(input) + type.super_size;
     first = false;
-    CHECK(start_input_bytes == (*input_bytes + 8));
+    AOS_CHECK(start_input_bytes == (*input_bytes + 8));
   } else {
     *input_bytes -= type.super_size;
     input = static_cast<const char *>(input) + type.super_size;
@@ -247,7 +247,7 @@
 
 bool PrintMatrix(char *output, size_t *output_bytes, const void *input,
                  uint32_t type_id, int rows, int cols) {
-  CHECK(MessageType::IsPrimitive(type_id));
+  AOS_CHECK(MessageType::IsPrimitive(type_id));
   const size_t element_size = MessageType::Sizeof(type_id);
 
   if (*output_bytes < 1) return false;
@@ -288,7 +288,7 @@
                       &input_bytes, type_id)) {
         return false;
       }
-      CHECK_EQ(0u, input_bytes);
+      AOS_CHECK_EQ(0u, input_bytes);
       // Update the output pointer.
       output += output_bytes_before - *output_bytes;
     }
@@ -309,7 +309,7 @@
   char *const output = static_cast<char *>(output_void);
   const char *const input = static_cast<const char *>(input_void);
 
-  CHECK(MessageType::IsPrimitive(type_id));
+  AOS_CHECK(MessageType::IsPrimitive(type_id));
   const size_t element_size = MessageType::Sizeof(type_id);
 
   for (int i = 0; i < rows * cols; ++i) {
@@ -327,7 +327,7 @@
         to_network<8>(&input[i * element_size], &output[i * element_size]);
         break;
       default:
-        LOG(FATAL, "illegal primitive type size %zu\n", element_size);
+        AOS_LOG(FATAL, "illegal primitive type size %zu\n", element_size);
     }
   }
 }
@@ -392,15 +392,15 @@
       c = c->next;
     }
   } else {
-    LOG(INFO, "FYI: no shm. going to LOG(FATAL) now\n");
+    AOS_LOG(INFO, "FYI: no shm. going to LOG(FATAL) now\n");
   }
 
-  LOG(FATAL, "MessageType for id 0x%" PRIx32 " not found\n", type_id);
+  AOS_LOG(FATAL, "MessageType for id 0x%" PRIx32 " not found\n", type_id);
 }
 
 void AddShm(uint32_t type_id) {
   if (!aos_core_is_init()) {
-    LOG(FATAL, "can't AddShm(%" PRIu32 ") without shm!\n", type_id);
+    AOS_LOG(FATAL, "can't AddShm(%" PRIu32 ") without shm!\n", type_id);
   }
 
   const MessageType::Field **fields;
@@ -414,7 +414,7 @@
     number_fields = cached.type.number_fields;
 
     if (mutex_lock(&global_core->mem_struct->queue_types.lock) != 0) {
-      LOG(FATAL, "locking queue_types lock failed\n");
+      AOS_LOG(FATAL, "locking queue_types lock failed\n");
     }
     volatile ShmType *current = static_cast<volatile ShmType *>(
         global_core->mem_struct->queue_types.pointer);
@@ -432,8 +432,8 @@
     char buffer[1024];
     ssize_t size = cached.type.Serialize(buffer, sizeof(buffer));
     if (size == -1) {
-      LOG(FATAL, "type %s is too big to fit into %zd bytes\n",
-          cached.type.name.c_str(), sizeof(buffer));
+      AOS_LOG(FATAL, "type %s is too big to fit into %zd bytes\n",
+              cached.type.name.c_str(), sizeof(buffer));
     }
 
     volatile ShmType *shm =
diff --git a/aos/queue_types_test.cc b/aos/queue_types_test.cc
index 91a1f74..6503f02 100644
--- a/aos/queue_types_test.cc
+++ b/aos/queue_types_test.cc
@@ -167,7 +167,7 @@
   input_bytes = sizeof(kData) + kExtraInputBytes;
   to_network(&kData, input);
   output_bytes = kString.size() + 1;
-  CHECK_LE(output_bytes, sizeof(output));
+  ASSERT_LE(output_bytes, sizeof(output));
   ASSERT_TRUE(PrintField(output, &output_bytes, input, &input_bytes,
                          Structure::GetType()->fields[2]->type));
   EXPECT_EQ(kExtraInputBytes, input_bytes);
@@ -211,7 +211,7 @@
     "struct_int:973, struct_float:3.140000}]}";
 
 TEST_F(PrintMessageTest, Basic) {
-  CHECK_GE(sizeof(input), kTestMessage1.Size());
+  ASSERT_GE(sizeof(input), kTestMessage1.Size());
   input_bytes = kTestMessage1.Serialize(input);
   output_bytes = sizeof(output);
   ASSERT_TRUE(PrintMessage(output, &output_bytes, input, &input_bytes,
@@ -221,7 +221,7 @@
 }
 
 TEST_F(PrintMessageTest, OutputTooSmall) {
-  CHECK_GE(sizeof(input), kTestMessage1.Size());
+  ASSERT_GE(sizeof(input), kTestMessage1.Size());
   input_bytes = kTestMessage1.Serialize(input);
   output_bytes = kTestMessage1String.size();
   EXPECT_FALSE(PrintMessage(output, &output_bytes, input, &input_bytes,
@@ -236,7 +236,7 @@
 }
 
 TEST_F(PrintMessageTest, Structure) {
-  CHECK_GE(sizeof(input), kTestStructure1.Size());
+  ASSERT_GE(sizeof(input), kTestStructure1.Size());
   input_bytes = kTestStructure1.Serialize(input);
   output_bytes = sizeof(output);
   ASSERT_TRUE(PrintMessage(output, &output_bytes, input, &input_bytes,
@@ -260,7 +260,7 @@
 }
 
 TEST_F(PrintMessageTest, Array) {
-  CHECK_GE(sizeof(input), kTestMessageWithArrays.Size());
+  ASSERT_GE(sizeof(input), kTestMessageWithArrays.Size());
   input_bytes = kTestMessageWithArrays.Serialize(input);
   output_bytes = sizeof(output);
   ASSERT_TRUE(PrintMessage(output, &output_bytes, input, &input_bytes,
diff --git a/aos/scoped/scoped_fd.cc b/aos/scoped/scoped_fd.cc
index a570df0..74f8882 100644
--- a/aos/scoped/scoped_fd.cc
+++ b/aos/scoped/scoped_fd.cc
@@ -7,7 +7,7 @@
 void ScopedFD::Close() {
   if (fd_ != -1) {
     if (close(fd_) == -1) {
-      PLOG(WARNING, "close(%d) failed", fd_);
+      AOS_PLOG(WARNING, "close(%d) failed", fd_);
     }
   }
 }
diff --git a/aos/seasocks/seasocks_logger.cc b/aos/seasocks/seasocks_logger.cc
index dad9970..53d05e8 100644
--- a/aos/seasocks/seasocks_logger.cc
+++ b/aos/seasocks/seasocks_logger.cc
@@ -26,7 +26,7 @@
       aos_level = DEBUG;
       break;
   }
-  LOG(aos_level, "Seasocks: %s\n", message);
+  AOS_LOG(aos_level, "Seasocks: %s\n", message);
 }
 
 }  // namespace seasocks
diff --git a/aos/starter/starter.cc b/aos/starter/starter.cc
index bb72523..8b137ff 100644
--- a/aos/starter/starter.cc
+++ b/aos/starter/starter.cc
@@ -73,7 +73,7 @@
   void operator()(event *evt) {
     if (evt == NULL) return;
     if (event_del(evt) != 0) {
-      LOG(WARNING, "event_del(%p) failed\n", evt);
+      AOS_LOG(WARNING, "event_del(%p) failed\n", evt);
     }
   }
 };
@@ -115,11 +115,11 @@
   // After calling this method, this object won't really be doing much of
   // anything besides possibly running its callback or something.
   void RemoveWatch() {
-    CHECK_NE(watch_, -1);
-    CHECK_EQ(watch_to_remove_, -1);
+    AOS_CHECK_NE(watch_, -1);
+    AOS_CHECK_EQ(watch_to_remove_, -1);
 
     if (inotify_rm_watch(notify_fd, watch_) == -1) {
-      PLOG(WARNING, "inotify_rm_watch(%d, %d) failed", notify_fd, watch_);
+      AOS_PLOG(WARNING, "inotify_rm_watch(%d, %d) failed", notify_fd, watch_);
     }
     watch_to_remove_ = watch_;
     watch_ = -1;
@@ -140,16 +140,16 @@
   void RemoveWatchFromMap() {
     int watch = watch_to_remove_;
     if (watch == -1) {
-      CHECK_NE(watch_, -1);
+      AOS_CHECK_NE(watch_, -1);
       watch = watch_;
     }
     if (watchers[watch] != this) {
-      LOG(WARNING, "watcher for %s (%p) didn't find itself in the map\n",
-          filename_.c_str(), this);
+      AOS_LOG(WARNING, "watcher for %s (%p) didn't find itself in the map\n",
+              filename_.c_str(), this);
     } else {
       watchers.erase(watch);
     }
-    LOG(DEBUG, "removed watch ID %d\n", watch);
+    AOS_LOG(DEBUG, "removed watch ID %d\n", watch);
     if (watch_to_remove_ == -1) {
       watch_ = -1;
     } else {
@@ -158,19 +158,20 @@
   }
 
   void CreateWatch() {
-    CHECK_EQ(watch_, -1);
+    AOS_CHECK_EQ(watch_, -1);
     watch_ = inotify_add_watch(notify_fd, filename_.c_str(),
                                create_ ? IN_CREATE : (IN_ATTRIB |
                                                      IN_MODIFY |
                                                      IN_DELETE_SELF |
                                                      IN_MOVE_SELF));
     if (watch_ == -1) {
-      PLOG(FATAL, "inotify_add_watch(%d, %s,"
-                  " %s ? IN_CREATE : (IN_ATTRIB | IN_MODIFY)) failed",
-           notify_fd, filename_.c_str(), create_ ? "true" : "false");
+      AOS_PLOG(FATAL,
+               "inotify_add_watch(%d, %s,"
+               " %s ? IN_CREATE : (IN_ATTRIB | IN_MODIFY)) failed",
+               notify_fd, filename_.c_str(), create_ ? "true" : "false");
     }
     watchers[watch_] = this;
-    LOG(DEBUG, "watch for %s is %d\n", filename_.c_str(), watch_);
+    AOS_LOG(DEBUG, "watch for %s is %d\n", filename_.c_str(), watch_);
   }
 
   // This gets set up as the callback for EV_READ on the inotify file
@@ -179,7 +180,7 @@
     unsigned int to_read;
     // Use FIONREAD to figure out how many bytes there are to read.
     if (ioctl(notify_fd, FIONREAD, &to_read) < 0) {
-      PLOG(FATAL, "FIONREAD(%d, %p) failed", notify_fd, &to_read);
+      AOS_PLOG(FATAL, "FIONREAD(%d, %p) failed", notify_fd, &to_read);
     }
     inotify_event *notifyevt = static_cast<inotify_event *>(malloc(to_read));
     const char *end = reinterpret_cast<char *>(notifyevt) + to_read;
@@ -187,11 +188,11 @@
 
     ssize_t ret = read(notify_fd, notifyevt, to_read);
     if (ret < 0) {
-      PLOG(FATAL, "read(%d, %p, %u) failed", notify_fd, notifyevt, to_read);
+      AOS_PLOG(FATAL, "read(%d, %p, %u) failed", notify_fd, notifyevt, to_read);
     }
     if (static_cast<size_t>(ret) != to_read) {
-      LOG(ERROR, "read(%d, %p, %u) returned %zd instead of %u\n",
-          notify_fd, notifyevt, to_read, ret, to_read);
+      AOS_LOG(ERROR, "read(%d, %p, %u) returned %zd instead of %u\n", notify_fd,
+              notifyevt, to_read, ret, to_read);
       return;
     }
 
@@ -199,9 +200,9 @@
     // multiple events at once.
     while (reinterpret_cast<char *>(notifyevt) < end) {
       if (watchers.count(notifyevt->wd) != 1) {
-        LOG(WARNING, "couldn't find whose watch ID %d is\n", notifyevt->wd);
+        AOS_LOG(WARNING, "couldn't find whose watch ID %d is\n", notifyevt->wd);
       } else {
-        LOG(DEBUG, "mask=%" PRIu32 "\n", notifyevt->mask);
+        AOS_LOG(DEBUG, "mask=%" PRIu32 "\n", notifyevt->mask);
         // If the watch was removed.
         if (notifyevt->mask & IN_IGNORED) {
           watchers[notifyevt->wd]->WatchDeleted();
@@ -221,15 +222,15 @@
   // INotifyReadable calls this method whenever the watch for our file gets
   // removed somehow.
   void WatchDeleted() {
-    LOG(DEBUG, "watch for %s deleted\n", filename_.c_str());
+    AOS_LOG(DEBUG, "watch for %s deleted\n", filename_.c_str());
     RemoveWatchFromMap();
     CreateWatch();
   }
 
   // INotifyReadable calls this method whenever the watch for our file triggers.
   void FileNotified(const char *filename) {
-    CHECK_NE(watch_, -1);
-    LOG(DEBUG, "got a notification for %s\n", filename_.c_str());
+    AOS_CHECK_NE(watch_, -1);
+    AOS_LOG(DEBUG, "got a notification for %s\n", filename_.c_str());
 
     if (!check_filename_.empty()) {
       if (filename == NULL) {
@@ -280,7 +281,7 @@
   errno = 0;
   FILE *pipe = popen(command.c_str(), "r");
   if (pipe == NULL) {
-    PLOG(FATAL, "popen(\"%s\", \"r\") failed", command.c_str());
+    AOS_PLOG(FATAL, "popen(\"%s\", \"r\") failed", command.c_str());
   }
 
   // result_size is how many bytes result is currently allocated to.
@@ -292,7 +293,7 @@
       result_size *= 2;
       void *new_result = realloc(result.get(), result_size);
       if (new_result == NULL) {
-        PLOG(FATAL, "realloc(%p, %zd) failed", result.get(), result_size);
+        AOS_PLOG(FATAL, "realloc(%p, %zd) failed", result.get(), result_size);
       } else {
         result.release();
         result = unique_c_ptr<char>(static_cast<char *>(new_result));
@@ -304,8 +305,8 @@
     // because of an error.
     if (ret < result_size - read) {
       if (ferror(pipe)) {
-        PLOG(FATAL, "couldn't finish reading output of \"%s\"\n",
-             command.c_str());
+        AOS_PLOG(FATAL, "couldn't finish reading output of \"%s\"\n",
+                 command.c_str());
       }
     }
     read += ret;
@@ -314,7 +315,8 @@
     }
 
     if (feof(pipe)) {
-      LOG(FATAL, "`%s` failed. didn't print a whole line\n", command.c_str());
+      AOS_LOG(FATAL, "`%s` failed. didn't print a whole line\n",
+              command.c_str());
     }
   }
 
@@ -323,11 +325,11 @@
 
   int child_status = pclose(pipe);
   if (child_status == -1) {
-    PLOG(FATAL, "pclose(%p) failed", pipe);
+    AOS_PLOG(FATAL, "pclose(%p) failed", pipe);
   }
 
   if (child_status != 0) {
-    LOG(FATAL, "`%s` failed. return %d\n", command.c_str(), child_status);
+    AOS_LOG(FATAL, "`%s` failed. return %d\n", command.c_str(), child_status);
   }
 
   return std::string(result.get());
@@ -347,8 +349,8 @@
     time_timeval.tv_usec = usec.count();
   }
   if (evtimer_add(timeout.release(), &time_timeval) != 0) {
-    LOG(FATAL, "evtimer_add(%p, %p) failed\n", timeout.release(),
-        &time_timeval);
+    AOS_LOG(FATAL, "evtimer_add(%p, %p) failed\n", timeout.release(),
+            &time_timeval);
   }
 }
 
@@ -399,7 +401,7 @@
       monotonic_clock::time_point oldest = restarts_.front();
       restarts_.pop();
       if (monotonic_clock::now() <= kMaxRestartsTime + oldest) {
-        LOG(WARNING, "process %s getting restarted too often\n", name());
+        AOS_LOG(WARNING, "process %s getting restarted too often\n", name());
         Timeout(kResumeWait, StaticStart, this);
         return;
       }
@@ -439,7 +441,7 @@
   }
 
   void FileModified() {
-    LOG(DEBUG, "file for %s modified\n", name());
+    AOS_LOG(DEBUG, "file for %s modified\n", name());
     struct timeval restart_time_timeval;
     {
       ::std::chrono::seconds sec =
@@ -453,14 +455,14 @@
     }
     // This will reset the timeout again if it hasn't run yet.
     if (evtimer_add(restart_timeout.get(), &restart_time_timeval) != 0) {
-      LOG(FATAL, "evtimer_add(%p, %p) failed\n", restart_timeout.get(),
-          &restart_time_timeval);
+      AOS_LOG(FATAL, "evtimer_add(%p, %p) failed\n", restart_timeout.get(),
+              &restart_time_timeval);
     }
     waiting_to_restart.insert(this);
   }
 
   static void StaticDoRestart(int, short, void *) {
-    LOG(DEBUG, "restarting everything that needs it\n");
+    AOS_LOG(DEBUG, "restarting everything that needs it\n");
     if (waiting_to_restart.find(core.get()) != waiting_to_restart.end()) {
       core->DoRestart();
       waiting_to_restart.erase(core.get());
@@ -477,12 +479,12 @@
     if (stat_at_start_valid_) {
       struct stat current_stat;
       if (stat(original_binary_.c_str(), &current_stat) == -1) {
-        PLOG(FATAL, "stat(%s, %p) failed",
-             original_binary_.c_str(), &current_stat);
+        AOS_PLOG(FATAL, "stat(%s, %p) failed", original_binary_.c_str(),
+                 &current_stat);
       }
       if (current_stat.st_mtime == stat_at_start_.st_mtime) {
-        LOG(DEBUG, "ignoring trigger for %s because mtime didn't change\n",
-            name());
+        AOS_LOG(DEBUG, "ignoring trigger for %s because mtime didn't change\n",
+                name());
         return;
       }
     }
@@ -492,16 +494,16 @@
       exit(0);
     }
     if (pid_ != -1) {
-      LOG(DEBUG, "sending SIGTERM to child %d to restart it\n", pid_);
+      AOS_LOG(DEBUG, "sending SIGTERM to child %d to restart it\n", pid_);
       if (kill(pid_, SIGTERM) == -1) {
-        PLOG(WARNING, "kill(%d, SIGTERM) failed", pid_);
+        AOS_PLOG(WARNING, "kill(%d, SIGTERM) failed", pid_);
       }
       CheckDiedStatus *status = new CheckDiedStatus();
       status->self = this;
       status->old_pid = pid_;
       Timeout(kProcessDieTime, StaticCheckDied, status);
     } else {
-      LOG(WARNING, "%s restart attempted but not running\n", name());
+      AOS_LOG(WARNING, "%s restart attempted but not running\n", name());
     }
   }
 
@@ -514,9 +516,9 @@
   // Checks to see if the child using the PID old_pid is still running.
   void CheckDied(pid_t old_pid) {
     if (pid_ == old_pid) {
-      LOG(WARNING, "child %d refused to die\n", old_pid);
+      AOS_LOG(WARNING, "child %d refused to die\n", old_pid);
       if (kill(old_pid, SIGKILL) == -1) {
-        PLOG(WARNING, "kill(%d, SIGKILL) failed", old_pid);
+        AOS_PLOG(WARNING, "kill(%d, SIGKILL) failed", old_pid);
       }
     }
   }
@@ -528,10 +530,10 @@
   // Actually starts the child.
   void Start() {
     if (pid_ != -1) {
-      LOG(WARNING, "calling Start() but already have child %d running\n",
-          pid_);
+      AOS_LOG(WARNING, "calling Start() but already have child %d running\n",
+              pid_);
       if (kill(pid_, SIGKILL) == -1) {
-        PLOG(WARNING, "kill(%d, SIGKILL) failed", pid_);
+        AOS_PLOG(WARNING, "kill(%d, SIGKILL) failed", pid_);
         return;
       }
       pid_ = -1;
@@ -540,16 +542,16 @@
     // Remove the name that we run from (ie from a previous execution) and then
     // hard link the real filename to it.
     if (unlink(binary_.c_str()) != 0 && errno != ENOENT) {
-      PLOG(FATAL, "removing %s failed", binary_.c_str());
+      AOS_PLOG(FATAL, "removing %s failed", binary_.c_str());
     }
     if (link(original_binary_.c_str(), binary_.c_str()) != 0) {
-      PLOG(FATAL, "link('%s', '%s') failed",
-           original_binary_.c_str(), binary_.c_str());
+      AOS_PLOG(FATAL, "link('%s', '%s') failed", original_binary_.c_str(),
+               binary_.c_str());
     }
 
     if (stat(original_binary_.c_str(), &stat_at_start_) == -1) {
-      PLOG(FATAL, "stat(%s, %p) failed",
-           original_binary_.c_str(), &stat_at_start_);
+      AOS_PLOG(FATAL, "stat(%s, %p) failed", original_binary_.c_str(),
+               &stat_at_start_);
     }
     stat_at_start_valid_ = true;
 
@@ -563,13 +565,13 @@
       // The const_cast is safe because no code that might care if it gets
       // modified can run afterwards.
       execv(binary_.c_str(), const_cast<char **>(argv));
-      PLOG(FATAL, "execv(%s, %p) failed", binary_.c_str(), argv);
+      AOS_PLOG(FATAL, "execv(%s, %p) failed", binary_.c_str(), argv);
       _exit(EXIT_FAILURE);
     }
     if (pid_ == -1) {
-      PLOG(FATAL, "forking to run \"%s\" failed", binary_.c_str());
+      AOS_PLOG(FATAL, "forking to run \"%s\" failed", binary_.c_str());
     }
-    LOG(DEBUG, "started \"%s\" successfully\n", binary_.c_str());
+    AOS_LOG(DEBUG, "started \"%s\" successfully\n", binary_.c_str());
   }
 
   // A history of the times that this process has been restarted.
@@ -672,7 +674,7 @@
     siginfo_t infop;
     infop.si_pid = 0;
     if (waitid(P_ALL, 0, &infop, WEXITED | WSTOPPED | WNOHANG) != 0) {
-      PLOG(WARNING, "waitid failed");
+      AOS_PLOG(WARNING, "waitid failed");
       continue;
     }
     // If there are no more child process deaths to process.
@@ -686,38 +688,41 @@
     if (child) {
       switch (infop.si_code) {
         case CLD_EXITED:
-          LOG(WARNING, "child %d (%s) exited with status %d\n",
-              pid, child->name(), status);
+          AOS_LOG(WARNING, "child %d (%s) exited with status %d\n", pid,
+                  child->name(), status);
           break;
         case CLD_DUMPED:
-          LOG(INFO, "child %d actually dumped core. "
-              "falling through to killed by signal case\n", pid);
+          AOS_LOG(INFO,
+                  "child %d actually dumped core. "
+                  "falling through to killed by signal case\n",
+                  pid);
         case CLD_KILLED:
           // If somebody (possibly us) sent it SIGTERM that means that they just
           // want it to stop, so it stopping isn't a WARNING.
-          LOG((status == SIGTERM) ? DEBUG : WARNING,
-              "child %d (%s) was killed by signal %d (%s)\n",
-              pid, child->name(), status, aos_strsignal(status));
+          AOS_LOG((status == SIGTERM) ? DEBUG : WARNING,
+                  "child %d (%s) was killed by signal %d (%s)\n", pid,
+                  child->name(), status, aos_strsignal(status));
           break;
         case CLD_STOPPED:
-          LOG(WARNING, "child %d (%s) was stopped by signal %d "
-              "(giving it a SIGCONT(%d))\n",
-              pid, child->name(), status, SIGCONT);
+          AOS_LOG(WARNING,
+                  "child %d (%s) was stopped by signal %d "
+                  "(giving it a SIGCONT(%d))\n",
+                  pid, child->name(), status, SIGCONT);
           kill(pid, SIGCONT);
           continue;
         default:
-          LOG(WARNING, "something happened to child %d (%s) (killing it)\n",
-              pid, child->name());
+          AOS_LOG(WARNING, "something happened to child %d (%s) (killing it)\n",
+                  pid, child->name());
           kill(pid, SIGKILL);
           continue;
       }
     } else {
-      LOG(WARNING, "couldn't find a Child for pid %d\n", pid);
+      AOS_LOG(WARNING, "couldn't find a Child for pid %d\n", pid);
       return;
     }
 
     if (child == core) {
-      LOG(FATAL, "core died\n");
+      AOS_LOG(FATAL, "core died\n");
     }
     child->ProcessDied();
   }
@@ -736,12 +741,12 @@
   // fail due to lack of permissions if we do not manually set the UID to admin.
 #ifdef AOS_ARCHITECTURE_arm_frc
   if (setuid(0) != 0) {
-    PLOG(FATAL, "setuid(0) failed");
+    AOS_PLOG(FATAL, "setuid(0) failed");
   }
 #endif
 
   if (setpgid(0 /*self*/, 0 /*make PGID the same as PID*/) != 0) {
-    PLOG(FATAL, "setpgid(0, 0) failed");
+    AOS_PLOG(FATAL, "setpgid(0, 0) failed");
   }
 
   // Make sure that we kill all children when we exit.
@@ -765,7 +770,7 @@
   // will never use, and the roboRIO doesn't have enough RAM to handle it.
   // This is in here instead of starter.sh because starter.sh doesn't run with
   // permissions on a roboRIO.
-  CHECK(system("echo 0 > /proc/sys/vm/overcommit_memory") == 0);
+  AOS_CHECK(system("echo 0 > /proc/sys/vm/overcommit_memory") == 0);
 #endif
   
   libevent_base = EventBaseUniquePtr(event_base_new());
@@ -776,10 +781,10 @@
   const int result =
       ::aos::util::RunCommand(("touch '" + core_touch_file + "'").c_str());
   if (result == -1) {
-    PLOG(FATAL, "running `touch '%s'` failed\n", core_touch_file.c_str());
+    AOS_PLOG(FATAL, "running `touch '%s'` failed\n", core_touch_file.c_str());
   } else if (!WIFEXITED(result) || WEXITSTATUS(result) != 0) {
-    LOG(FATAL, "`touch '%s'` gave result %x\n", core_touch_file.c_str(),
-        result);
+    AOS_LOG(FATAL, "`touch '%s'` gave result %x\n", core_touch_file.c_str(),
+            result);
   }
   FileWatch core_touch_file_watch(core_touch_file, Run, NULL);
   core = unique_ptr<Child>(
@@ -787,19 +792,19 @@
 
   FILE *pid_file = fopen("/tmp/starter.pid", "w");
   if (pid_file == NULL) {
-    PLOG(FATAL, "fopen(\"/tmp/starter.pid\", \"w\") failed");
+    AOS_PLOG(FATAL, "fopen(\"/tmp/starter.pid\", \"w\") failed");
   } else {
     if (fprintf(pid_file, "%d", core->pid()) == -1) {
-      PLOG(WARNING, "fprintf(%p, \"%%d\", %d) failed",
-           pid_file, core->pid());
+      AOS_PLOG(WARNING, "fprintf(%p, \"%%d\", %d) failed", pid_file,
+               core->pid());
     }
     fclose(pid_file);
   }
 
-  LOG(INFO, "waiting for %s to appear\n", core_touch_file.c_str());
+  AOS_LOG(INFO, "waiting for %s to appear\n", core_touch_file.c_str());
 
   event_base_dispatch(libevent_base.get());
-  LOG(FATAL, "event_base_dispatch(%p) returned\n", libevent_base.get());
+  AOS_LOG(FATAL, "event_base_dispatch(%p) returned\n", libevent_base.get());
 }
 
 // This is the callback for when core creates the file indicating that it has
@@ -820,7 +825,7 @@
       break;
     }
     if (list_file.rdstate() != 0) {
-      LOG(FATAL, "reading input file %s failed\n", child_list_file);
+      AOS_LOG(FATAL, "reading input file %s failed\n", child_list_file);
     }
     children.push_back(unique_ptr<Child>(new Child(child_name)));
   }
diff --git a/aos/stl_mutex/stl_mutex.h b/aos/stl_mutex/stl_mutex.h
index b88ac8e..4e14557 100644
--- a/aos/stl_mutex/stl_mutex.h
+++ b/aos/stl_mutex/stl_mutex.h
@@ -31,7 +31,7 @@
         owner_died_ = true;
         break;
       default:
-        LOG(FATAL, "mutex_grab(%p) failed with %d\n", &native_handle_, ret);
+        AOS_LOG(FATAL, "mutex_grab(%p) failed with %d\n", &native_handle_, ret);
     }
   }
 
@@ -46,12 +46,13 @@
       case 4:
         return false;
       default:
-        LOG(FATAL, "mutex_trylock(%p) failed with %d\n", &native_handle_, ret);
+        AOS_LOG(FATAL, "mutex_trylock(%p) failed with %d\n", &native_handle_,
+                ret);
     }
   }
 
   void unlock() {
-    CHECK(!owner_died_);
+    AOS_CHECK(!owner_died_);
     mutex_unlock(&native_handle_);
   }
 
@@ -83,20 +84,20 @@
 
   void lock() {
     if (mutex_islocked(mutex_.native_handle())) {
-      CHECK(!owner_died());
+      AOS_CHECK(!owner_died());
       ++recursive_locks_;
     } else {
       mutex_.lock();
       if (mutex_.owner_died()) {
         recursive_locks_ = 0;
       } else {
-        CHECK_EQ(0, recursive_locks_);
+        AOS_CHECK_EQ(0, recursive_locks_);
       }
     }
   }
   bool try_lock() {
     if (mutex_islocked(mutex_.native_handle())) {
-      CHECK(!owner_died());
+      AOS_CHECK(!owner_died());
       ++recursive_locks_;
       return true;
     } else {
@@ -104,7 +105,7 @@
         if (mutex_.owner_died()) {
           recursive_locks_ = 0;
         } else {
-          CHECK_EQ(0, recursive_locks_);
+          AOS_CHECK_EQ(0, recursive_locks_);
         }
         return true;
       } else {
diff --git a/aos/testing/prevent_exit.cc b/aos/testing/prevent_exit.cc
index 3190698..ed6644b 100644
--- a/aos/testing/prevent_exit.cc
+++ b/aos/testing/prevent_exit.cc
@@ -16,7 +16,7 @@
 }  // namespace
 
 void PreventExit() {
-  CHECK_EQ(atexit(TerminateExitHandler), 0);
+  AOS_CHECK_EQ(atexit(TerminateExitHandler), 0);
 }
 
 }  // namespace testing
diff --git a/aos/testing/test_logging_test.cc b/aos/testing/test_logging_test.cc
index 9dd6eba..f39c6cf 100644
--- a/aos/testing/test_logging_test.cc
+++ b/aos/testing/test_logging_test.cc
@@ -16,11 +16,11 @@
 
   ::std::thread thread([]() {
     for (int i = 0; i < 1000; ++i) {
-      LOG(INFO, "test from thread\n");
+      AOS_LOG(INFO, "test from thread\n");
     }
   });
   for (int i = 0; i < 1000; ++i) {
-    LOG(INFO, "not from thread\n");
+    AOS_LOG(INFO, "not from thread\n");
   }
   thread.join();
 }
diff --git a/aos/testing/test_shm.cc b/aos/testing/test_shm.cc
index f7ddfcb..e9a637a 100644
--- a/aos/testing/test_shm.cc
+++ b/aos/testing/test_shm.cc
@@ -22,7 +22,7 @@
   // "shared" memory.
   void *memory = mmap(NULL, kCoreSize, PROT_READ | PROT_WRITE,
                       MAP_SHARED | MAP_ANONYMOUS, -1, 0);
-  CHECK_NE(memory, MAP_FAILED);
+  AOS_CHECK_NE(memory, MAP_FAILED);
 
   aos_core_use_address_as_shared_mem(memory, kCoreSize);
 
@@ -30,7 +30,7 @@
 }
 
 TestSharedMemory::~TestSharedMemory() {
-  PCHECK(munmap(global_core->mem_struct, kCoreSize));
+  AOS_PCHECK(munmap(global_core->mem_struct, kCoreSize));
   global_core = NULL;
 }
 
diff --git a/aos/time/BUILD b/aos/time/BUILD
index 6570490..e08ef7b 100644
--- a/aos/time/BUILD
+++ b/aos/time/BUILD
@@ -12,9 +12,9 @@
     deps = [
         "//aos:macros",
         "//aos/ipc_lib:shared_mem",
-        "//aos/logging",
         "//aos/mutex",
         "//aos/type_traits",
+        "@com_github_google_glog//:glog",
     ],
 )
 
diff --git a/aos/time/time.cc b/aos/time/time.cc
index 7661daf..9736009 100644
--- a/aos/time/time.cc
+++ b/aos/time/time.cc
@@ -12,8 +12,8 @@
 // dependency on it.
 #include "aos/ipc_lib/shared_mem.h"
 
-#include "aos/logging/logging.h"
 #include "aos/mutex/mutex.h"
+#include "glog/logging.h"
 
 #else  // __linux__
 
@@ -45,10 +45,9 @@
   do {
     returnval = clock_nanosleep(CLOCK_MONOTONIC, TIMER_ABSTIME,
                                 &end_time_timespec, nullptr);
-    if (returnval != EINTR && returnval != 0) {
-      PLOG(FATAL, "clock_nanosleep(%jd, TIMER_ABSTIME, %p, nullptr) failed",
-           static_cast<uintmax_t>(CLOCK_MONOTONIC), &end_time_timespec);
-    }
+    PCHECK(returnval == 0 || returnval == EINTR)
+        << ": clock_nanosleep(" << static_cast<uintmax_t>(CLOCK_MONOTONIC)
+        << ", TIMER_ABSTIME, " << &end_time_timespec << ", nullptr) failed";
   } while (returnval != 0);
 }
 
@@ -93,9 +92,8 @@
 
 void SetMockTime(monotonic_clock::time_point now) {
   MutexLocker time_mutex_locker(&time_mutex);
-  if (__builtin_expect(!mock_time_enabled, 0)) {
-    LOG(FATAL, "Tried to set mock time and mock time is not enabled\n");
-  }
+  CHECK(mock_time_enabled)
+      << ": Tried to set mock time and mock time is not enabled";
   current_mock_time = now;
 }
 
@@ -148,10 +146,10 @@
   }
 
   struct timespec current_time;
-  if (clock_gettime(CLOCK_MONOTONIC, &current_time) != 0) {
-    PLOG(FATAL, "clock_gettime(%jd, %p) failed",
-         static_cast<uintmax_t>(CLOCK_MONOTONIC), &current_time);
-  }
+  PCHECK(clock_gettime(CLOCK_MONOTONIC, &current_time) == 0)
+      << ": clock_gettime(" << static_cast<uintmax_t>(CLOCK_MONOTONIC) << ", "
+      << &current_time << ") failed";
+
   const chrono::nanoseconds offset =
       (&global_core == nullptr || global_core == nullptr ||
        global_core->mem_struct == nullptr)
@@ -191,10 +189,9 @@
 #ifdef __linux__
 realtime_clock::time_point realtime_clock::now() noexcept {
   struct timespec current_time;
-  if (clock_gettime(CLOCK_REALTIME, &current_time) != 0) {
-    PLOG(FATAL, "clock_gettime(%jd, %p) failed",
-         static_cast<uintmax_t>(CLOCK_REALTIME), &current_time);
-  }
+  PCHECK(clock_gettime(CLOCK_REALTIME, &current_time) == 0)
+      << "clock_gettime(" << static_cast<uintmax_t>(CLOCK_REALTIME) << ", "
+      << &current_time << ") failed";
 
   return time_point(::std::chrono::seconds(current_time.tv_sec) +
                     ::std::chrono::nanoseconds(current_time.tv_nsec));
diff --git a/aos/transaction/transaction.h b/aos/transaction/transaction.h
index f1c5c02..e0266f9 100644
--- a/aos/transaction/transaction.h
+++ b/aos/transaction/transaction.h
@@ -55,7 +55,7 @@
   template <class... A>
   void AddWork(A &&... a) {
     if (stack_index_ >= number_works) {
-      LOG(FATAL, "too many works\n");
+      AOS_LOG(FATAL, "too many works\n");
     }
     stack_.at(stack_index_).Create(::std::forward<A>(a)...);
     aos_compiler_memory_barrier();
diff --git a/aos/util/BUILD b/aos/util/BUILD
index be6055d..f18fd82 100644
--- a/aos/util/BUILD
+++ b/aos/util/BUILD
@@ -113,6 +113,7 @@
     deps = [
         "//aos/logging",
         "//aos/time",
+        "@com_github_google_glog//:glog",
     ],
 )
 
diff --git a/aos/util/file.cc b/aos/util/file.cc
index 9c81b3e..5418aab 100644
--- a/aos/util/file.cc
+++ b/aos/util/file.cc
@@ -14,15 +14,15 @@
   ::std::string r;
   ScopedFD fd(open(::std::string(filename).c_str(), O_RDONLY));
   if (fd.get() == -1) {
-    PLOG(FATAL, "opening %*s", static_cast<int>(filename.size()),
-         filename.data());
+    AOS_PLOG(FATAL, "opening %*s", static_cast<int>(filename.size()),
+             filename.data());
   }
   while (true) {
     char buffer[1024];
     const ssize_t result = read(fd.get(), buffer, sizeof(buffer));
     if (result < 0) {
-      PLOG(FATAL, "reading from %*s", static_cast<int>(filename.size()),
-           filename.data());
+      AOS_PLOG(FATAL, "reading from %*s", static_cast<int>(filename.size()),
+               filename.data());
     } else if (result == 0) {
       break;
     }
diff --git a/aos/util/linked_list.h b/aos/util/linked_list.h
index 5a5824e..14f1788 100644
--- a/aos/util/linked_list.h
+++ b/aos/util/linked_list.h
@@ -64,7 +64,7 @@
       }
       pointer = &(*pointer)->next;
     }
-    LOG(FATAL, "%p is not in the list\n", t);
+    AOS_LOG(FATAL, "%p is not in the list\n", t);
   }
 
   // Calls function for each element of the list.
diff --git a/aos/util/log_interval.h b/aos/util/log_interval.h
index acd32e8..54ebd6d 100644
--- a/aos/util/log_interval.h
+++ b/aos/util/log_interval.h
@@ -66,7 +66,7 @@
                     const ::std::string &message)
       : interval_(interval), level_(level), message_(message) {}
 
-#define LOG_INTERVAL(simple_log) \
+#define AOS_LOG_INTERVAL(simple_log) \
   simple_log.WantToLog(LOG_SOURCENAME ": " STRINGIFY(__LINE__))
   void WantToLog(const char *context) {
     context_ = context;
@@ -75,7 +75,7 @@
 
   void Print() {
     if (interval_.ShouldLog()) {
-      CHECK_NOTNULL(context_);
+      AOS_CHECK_NOTNULL(context_);
       log_do(level_, "%s: %.*s %d times over %f sec\n", context_,
              static_cast<int>(message_.size()), message_.data(),
              interval_.Count(),
diff --git a/aos/util/phased_loop.cc b/aos/util/phased_loop.cc
index a349718..7369a93 100644
--- a/aos/util/phased_loop.cc
+++ b/aos/util/phased_loop.cc
@@ -1,8 +1,41 @@
 #include "aos/util/phased_loop.h"
 
+#include "glog/logging.h"
+
 namespace aos {
 namespace time {
 
+PhasedLoop::PhasedLoop(const monotonic_clock::duration interval,
+                       const monotonic_clock::time_point monotonic_now,
+                       const monotonic_clock::duration offset)
+    : interval_(interval), offset_(offset), last_time_(offset) {
+  CHECK(offset >= monotonic_clock::duration(0));
+  CHECK(interval > monotonic_clock::duration(0));
+  CHECK(offset < interval);
+  Reset(monotonic_now);
+}
+
+void PhasedLoop::set_interval_and_offset(
+    const monotonic_clock::duration interval,
+    const monotonic_clock::duration offset) {
+  interval_ = interval;
+  offset_ = offset;
+  CHECK(offset_ >= monotonic_clock::duration(0));
+  CHECK(interval_ > monotonic_clock::duration(0));
+  CHECK(offset_ < interval_);
+}
+
+monotonic_clock::duration PhasedLoop::OffsetFromIntervalAndTime(
+    const monotonic_clock::duration interval,
+    const monotonic_clock::time_point monotonic_trigger) {
+  CHECK(interval > monotonic_clock::duration(0));
+  return monotonic_trigger.time_since_epoch() -
+         (monotonic_trigger.time_since_epoch() / interval) * interval +
+         ((monotonic_trigger.time_since_epoch() >= monotonic_clock::zero())
+              ? monotonic_clock::zero()
+              : interval);
+}
+
 int PhasedLoop::Iterate(const monotonic_clock::time_point now) {
   const monotonic_clock::time_point next_time =
       monotonic_clock::time_point(
@@ -17,8 +50,8 @@
   const int result = difference / interval_;
   CHECK_EQ(
       0, (next_time - offset_).time_since_epoch().count() % interval_.count());
-  CHECK_GE(next_time, now);
-  CHECK_LE(next_time - now, interval_);
+  CHECK(next_time >= now);
+  CHECK(next_time - now <= interval_);
   last_time_ = next_time;
   return result;
 }
diff --git a/aos/util/phased_loop.h b/aos/util/phased_loop.h
index 7aa51d2..3e1752b 100644
--- a/aos/util/phased_loop.h
+++ b/aos/util/phased_loop.h
@@ -3,8 +3,6 @@
 
 #include "aos/time/time.h"
 
-#include "aos/logging/logging.h"
-
 namespace aos {
 namespace time {
 
@@ -20,35 +18,16 @@
   PhasedLoop(
       const monotonic_clock::duration interval,
       const monotonic_clock::time_point monotonic_now,
-      const monotonic_clock::duration offset = monotonic_clock::duration(0))
-      : interval_(interval), offset_(offset), last_time_(offset) {
-    CHECK_GE(offset, monotonic_clock::duration(0));
-    CHECK_GT(interval, monotonic_clock::duration(0));
-    CHECK_LT(offset, interval);
-    Reset(monotonic_now);
-  }
+      const monotonic_clock::duration offset = monotonic_clock::duration(0));
 
   // Updates the offset and interval.
   void set_interval_and_offset(const monotonic_clock::duration interval,
-                               const monotonic_clock::duration offset) {
-    interval_ = interval;
-    offset_ = offset;
-    CHECK_GE(offset_, monotonic_clock::duration(0));
-    CHECK_GT(interval_, monotonic_clock::duration(0));
-    CHECK_LT(offset_, interval_);
-  }
+                               const monotonic_clock::duration offset);
 
   // Computes the offset given an interval and a time that we should trigger.
   static monotonic_clock::duration OffsetFromIntervalAndTime(
       const monotonic_clock::duration interval,
-      const monotonic_clock::time_point monotonic_trigger) {
-    CHECK_GT(interval, monotonic_clock::duration(0));
-    return monotonic_trigger.time_since_epoch() -
-           (monotonic_trigger.time_since_epoch() / interval) * interval +
-           ((monotonic_trigger.time_since_epoch() >= monotonic_clock::zero())
-                ? monotonic_clock::zero()
-                : interval);
-  }
+      const monotonic_clock::time_point monotonic_trigger);
 
   // Resets the count of skipped iterations.
   // Iterate(monotonic_now) will return 1 and set sleep_time() to something
diff --git a/aos/util/phased_loop_test.cc b/aos/util/phased_loop_test.cc
index 4f07bcc..0a0d5db 100644
--- a/aos/util/phased_loop_test.cc
+++ b/aos/util/phased_loop_test.cc
@@ -183,16 +183,16 @@
 TEST_F(PhasedLoopDeathTest, InvalidValues) {
   EXPECT_DEATH(
       PhasedLoop(milliseconds(1), monotonic_clock::epoch(), milliseconds(2)),
-      ".*offset<interval.*");
+      ".*offset < interval.*");
   EXPECT_DEATH(
       PhasedLoop(milliseconds(1), monotonic_clock::epoch(), milliseconds(1)),
-      ".*offset<interval.*");
+      ".*offset < interval.*");
   EXPECT_DEATH(
       PhasedLoop(milliseconds(1), monotonic_clock::epoch(), milliseconds(-1)),
-      ".*offset>=monotonic_clock::duration\\(0\\).*");
+      ".*offset >= monotonic_clock::duration\\(0\\).*");
   EXPECT_DEATH(
       PhasedLoop(milliseconds(0), monotonic_clock::epoch(), milliseconds(0)),
-      ".*interval>monotonic_clock::duration\\(0\\).*");
+      ".*interval > monotonic_clock::duration\\(0\\).*");
 }
 
 }  // namespace testing
diff --git a/aos/util/run_command.cc b/aos/util/run_command.cc
index 2b08cb2..40782da 100644
--- a/aos/util/run_command.cc
+++ b/aos/util/run_command.cc
@@ -21,14 +21,14 @@
     sigemptyset(&to_block);
     sigaddset(&to_block, SIGCHLD);
     if (sigprocmask(SIG_BLOCK, &to_block, &original_blocked_) == -1) {
-      PLOG(FATAL, "sigprocmask(SIG_BLOCK, %p, %p) failed",
-           &to_block, &original_blocked_);
+      AOS_PLOG(FATAL, "sigprocmask(SIG_BLOCK, %p, %p) failed", &to_block,
+               &original_blocked_);
     }
   }
   ~BlockSIGCHLD() {
     if (sigprocmask(SIG_SETMASK, &original_blocked_, nullptr) == -1) {
-      PLOG(FATAL, "sigprocmask(SIG_SETMASK, %p, nullptr) failed",
-           &original_blocked_);
+      AOS_PLOG(FATAL, "sigprocmask(SIG_SETMASK, %p, nullptr) failed",
+               &original_blocked_);
     }
   }
 
diff --git a/aos/util/thread.cc b/aos/util/thread.cc
index 6b3ef76..ae18fe9 100644
--- a/aos/util/thread.cc
+++ b/aos/util/thread.cc
@@ -11,24 +11,24 @@
 Thread::Thread() : started_(false), joined_(false), should_terminate_(false) {}
 
 Thread::~Thread() {
-  CHECK(!(started_ && !joined_));
+  AOS_CHECK(!(started_ && !joined_));
 }
 
 void Thread::Start() {
-  CHECK(!started_);
+  AOS_CHECK(!started_);
   started_ = true;
-  CHECK(pthread_create(&thread_, NULL, &Thread::StaticRun, this) == 0);
+  AOS_CHECK(pthread_create(&thread_, NULL, &Thread::StaticRun, this) == 0);
 }
 
 void Thread::Join() {
-  CHECK(!joined_ && started_);
+  AOS_CHECK(!joined_ && started_);
   joined_ = true;
   should_terminate_.store(true);
-  CHECK(pthread_join(thread_, NULL) == 0);
+  AOS_CHECK(pthread_join(thread_, NULL) == 0);
 }
 
 bool Thread::TryJoin() {
-  CHECK(!joined_ && started_);
+  AOS_CHECK(!joined_ && started_);
 #ifdef AOS_SANITIZER_thread
   // ThreadSanitizer misses the tryjoin and then complains about leaking the
   // thread. Instead, we'll just check if the thread is still around and then
@@ -39,7 +39,7 @@
   if (kill_ret == 0) return false;
   // If it died, we'll get ESRCH. Otherwise, something went wrong.
   if (kill_ret != ESRCH) {
-    PELOG(FATAL, kill_ret, "pthread_kill(thread_, 0) failed");
+    AOS_PELOG(FATAL, kill_ret, "pthread_kill(thread_, 0) failed");
   }
   Join();
   return true;
@@ -51,20 +51,20 @@
   } else if (ret == EBUSY) {
     return false;
   } else {
-    PELOG(FATAL, ret, "pthread_tryjoin_np(thread_, nullptr) failed");
+    AOS_PELOG(FATAL, ret, "pthread_tryjoin_np(thread_, nullptr) failed");
   }
 #endif
 }
 
 void Thread::RequestStop() {
-  CHECK(!joined_ && started_);
+  AOS_CHECK(!joined_ && started_);
   should_terminate_.store(true);
 }
 
 void Thread::WaitUntilDone() {
-  CHECK(!joined_ && started_);
+  AOS_CHECK(!joined_ && started_);
   joined_ = true;
-  CHECK(pthread_join(thread_, NULL) == 0);
+  AOS_CHECK(pthread_join(thread_, NULL) == 0);
 }
 
 void *Thread::StaticRun(void *self) {
diff --git a/aos/util/trapezoid_profile.cc b/aos/util/trapezoid_profile.cc
index a1e8abb..e74110f 100644
--- a/aos/util/trapezoid_profile.cc
+++ b/aos/util/trapezoid_profile.cc
@@ -108,7 +108,7 @@
     acceleration_time_ = (top_velocity - output_(1)) / acceleration_;
   }
 
-  CHECK_GT(top_velocity, -maximum_velocity_);
+  AOS_CHECK_GT(top_velocity, -maximum_velocity_);
 
   if (output_(1) > maximum_velocity_) {
     constant_time_ = 0;
diff --git a/aos/vision/blob/threshold.cc b/aos/vision/blob/threshold.cc
index 46221b5..047d8db 100644
--- a/aos/vision/blob/threshold.cc
+++ b/aos/vision/blob/threshold.cc
@@ -14,7 +14,7 @@
 // it operates in kChunkSize-pixel chunks.
 RangeImage FastYuyvYThreshold(ImageFormat fmt, const char *data,
                               uint8_t value) {
-  CHECK_EQ(0, fmt.w % kChunkSize);
+  AOS_CHECK_EQ(0, fmt.w % kChunkSize);
   std::vector<std::vector<ImageRange>> result;
   result.reserve(fmt.h);
 
@@ -107,7 +107,7 @@
     }
 
     ImageFormat shard_format = input_format_;
-    CHECK_EQ(shard_format.h % kThreads, 0);
+    AOS_CHECK_EQ(shard_format.h % kThreads, 0);
     shard_format.h /= kThreads;
 
     outputs_[i] = FastYuyvYThreshold(
diff --git a/aos/vision/events/epoll_events.cc b/aos/vision/events/epoll_events.cc
index f6cba76..651579a 100644
--- a/aos/vision/events/epoll_events.cc
+++ b/aos/vision/events/epoll_events.cc
@@ -14,29 +14,29 @@
 
 void EpollEvent::DirectEvent(uint32_t events) {
   if ((events & ~(EPOLLIN | EPOLLPRI | EPOLLERR)) != 0) {
-    LOG(FATAL, "unexpected epoll events set in %x on %d\n", events, fd());
+    AOS_LOG(FATAL, "unexpected epoll events set in %x on %d\n", events, fd());
   }
   ReadEvent();
 }
 
 void EpollEvent::SetEvents(uint32_t events) {
   events_ |= events;
-  CHECK(!loop_);
+  AOS_CHECK(!loop_);
 }
 
-EpollLoop::EpollLoop() : epoll_fd_(PCHECK(epoll_create1(0))) {}
+EpollLoop::EpollLoop() : epoll_fd_(AOS_PCHECK(epoll_create1(0))) {}
 
 void EpollLoop::Add(EpollEvent *event) {
   event->loop_ = this;
   struct epoll_event temp_event;
   temp_event.data.ptr = static_cast<void *>(event);
   temp_event.events = event->events();
-  PCHECK(epoll_ctl(epoll_fd(), EPOLL_CTL_ADD, event->fd(), &temp_event));
+  AOS_PCHECK(epoll_ctl(epoll_fd(), EPOLL_CTL_ADD, event->fd(), &temp_event));
 }
 
 void EpollLoop::Delete(EpollEvent *event) {
   event->loop_ = nullptr;
-  PCHECK(epoll_ctl(epoll_fd(), EPOLL_CTL_DEL, event->fd(), NULL));
+  AOS_PCHECK(epoll_ctl(epoll_fd(), EPOLL_CTL_DEL, event->fd(), NULL));
 }
 
 void EpollLoop::Run() {
@@ -45,7 +45,7 @@
     static constexpr size_t kNumberOfEvents = 64;
     epoll_event events[kNumberOfEvents];
     const int number_events =
-        PCHECK(epoll_wait(epoll_fd(), events, kNumberOfEvents, timeout));
+        AOS_PCHECK(epoll_wait(epoll_fd(), events, kNumberOfEvents, timeout));
 
     for (int i = 0; i < number_events; i++) {
       static_cast<EpollEvent *>(events[i].data.ptr)->DirectEvent(events[i].events);
diff --git a/aos/vision/events/gtk_event.cc b/aos/vision/events/gtk_event.cc
index 4ff9fde..d1f60a1 100644
--- a/aos/vision/events/gtk_event.cc
+++ b/aos/vision/events/gtk_event.cc
@@ -27,8 +27,8 @@
       for (int i = 0; i < number_events; i++) {
         EpollEvent *event = static_cast<EpollEvent *>(events[i].data.ptr);
         if ((events[i].events & ~(EPOLLIN | EPOLLPRI)) != 0) {
-          LOG(FATAL, "unexpected epoll events set in %x on %d\n",
-              events[i].events, event->fd());
+          AOS_LOG(FATAL, "unexpected epoll events set in %x on %d\n",
+                  events[i].events, event->fd());
         }
         event->ReadEvent();
       }
diff --git a/aos/vision/events/tcp_client.cc b/aos/vision/events/tcp_client.cc
index 8e197ec..94fa3d2 100644
--- a/aos/vision/events/tcp_client.cc
+++ b/aos/vision/events/tcp_client.cc
@@ -22,10 +22,10 @@
 int MakeSocketNonBlocking(int sfd) {
   int flags;
 
-  PCHECK(flags = fcntl(sfd, F_GETFL, 0));
+  AOS_PCHECK(flags = fcntl(sfd, F_GETFL, 0));
 
   flags |= O_NONBLOCK;
-  PCHECK(fcntl(sfd, F_SETFL, flags));
+  AOS_PCHECK(fcntl(sfd, F_SETFL, flags));
 
   return 0;
 }
@@ -35,7 +35,7 @@
   struct sockaddr_in serveraddr;
   struct hostent *server;
   /* socket: create the socket */
-  PCHECK(sockfd = socket(AF_INET, SOCK_STREAM, 0));
+  AOS_PCHECK(sockfd = socket(AF_INET, SOCK_STREAM, 0));
 
   /* gethostbyname: get the server's DNS entry */
   server = gethostbyname(hostname.c_str());
@@ -52,9 +52,9 @@
   serveraddr.sin_port = htons(portno);
 
   /* connect: create a connection with the server */
-  PCHECK(connect(sockfd, (const struct sockaddr *)&serveraddr,
-                 sizeof(serveraddr)));
-  PCHECK(MakeSocketNonBlocking(sockfd));
+  AOS_PCHECK(connect(sockfd, (const struct sockaddr *)&serveraddr,
+                     sizeof(serveraddr)));
+  AOS_PCHECK(MakeSocketNonBlocking(sockfd));
 
   return sockfd;
 }
diff --git a/aos/vision/events/tcp_server.cc b/aos/vision/events/tcp_server.cc
index 0fd7225..535c6b4 100644
--- a/aos/vision/events/tcp_server.cc
+++ b/aos/vision/events/tcp_server.cc
@@ -23,10 +23,10 @@
 int MakeSocketNonBlocking(int sfd) {
   int flags;
 
-  PCHECK(flags = fcntl(sfd, F_GETFL, 0));
+  AOS_PCHECK(flags = fcntl(sfd, F_GETFL, 0));
 
   flags |= O_NONBLOCK;
-  PCHECK(fcntl(sfd, F_SETFL, flags));
+  AOS_PCHECK(fcntl(sfd, F_SETFL, flags));
 
   return 0;
 }
@@ -41,7 +41,7 @@
   /*
    * socket: create the parent socket
    */
-  PCHECK(parentfd = socket(AF_INET, SOCK_STREAM, 0));
+  AOS_PCHECK(parentfd = socket(AF_INET, SOCK_STREAM, 0));
 
   /* setsockopt: Handy debugging trick that lets
    * us rerun the server immediately after we kill it;
@@ -49,8 +49,8 @@
    * Eliminates "ERROR on binding: Address already in use" error.
    */
   optval = 1;
-  PCHECK(setsockopt(parentfd, SOL_SOCKET, SO_REUSEADDR, (const void *)&optval,
-                    sizeof(int)));
+  AOS_PCHECK(setsockopt(parentfd, SOL_SOCKET, SO_REUSEADDR,
+                        (const void *)&optval, sizeof(int)));
 
   /*
    * build the server's Internet address
@@ -69,11 +69,12 @@
   /*
    * bind: associate the parent socket with a port
    */
-  PCHECK(bind(parentfd, (struct sockaddr *)&serveraddr, sizeof(serveraddr)));
+  AOS_PCHECK(
+      bind(parentfd, (struct sockaddr *)&serveraddr, sizeof(serveraddr)));
 
-  PCHECK(listen(parentfd, SOMAXCONN));
+  AOS_PCHECK(listen(parentfd, SOMAXCONN));
 
-  LOG(INFO, "connected to port: %d on fd: %d\n", portno, parentfd);
+  AOS_LOG(INFO, "connected to port: %d on fd: %d\n", portno, parentfd);
   return parentfd;
 }
 
@@ -94,14 +95,14 @@
          connections. */
       return;
     } else {
-      PLOG(WARNING, "accept");
+      AOS_PLOG(WARNING, "accept");
       return;
     }
   }
 
   /* Make the incoming socket non-blocking and add it to the
      list of fds to monitor. */
-  PCHECK(MakeSocketNonBlocking(infd));
+  AOS_PCHECK(MakeSocketNonBlocking(infd));
 
   loop()->Add(Construct(infd));
 }
diff --git a/aos/vision/events/udp.cc b/aos/vision/events/udp.cc
index ed39db9..8734443 100644
--- a/aos/vision/events/udp.cc
+++ b/aos/vision/events/udp.cc
@@ -8,17 +8,17 @@
 namespace events {
 
 TXUdpSocket::TXUdpSocket(const std::string &ip_addr, int port)
-    : fd_(PCHECK(socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP))) {
+    : fd_(AOS_PCHECK(socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP))) {
   sockaddr_in destination_in;
   memset(&destination_in, 0, sizeof(destination_in));
   destination_in.sin_family = AF_INET;
   destination_in.sin_port = htons(port);
   if (inet_aton(ip_addr.c_str(), &destination_in.sin_addr) == 0) {
-    LOG(FATAL, "invalid IP address %s\n", ip_addr.c_str());
+    AOS_LOG(FATAL, "invalid IP address %s\n", ip_addr.c_str());
   }
 
-  PCHECK(connect(fd_.get(), reinterpret_cast<sockaddr *>(&destination_in),
-                 sizeof(destination_in)));
+  AOS_PCHECK(connect(fd_.get(), reinterpret_cast<sockaddr *>(&destination_in),
+                     sizeof(destination_in)));
 }
 
 int TXUdpSocket::Send(const char *data, int size) {
@@ -27,7 +27,7 @@
 }
 
 int RXUdpSocket::SocketBindListenOnPort(int port) {
-  int fd = PCHECK(socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP));
+  int fd = AOS_PCHECK(socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP));
   sockaddr_in bind_address;
   memset(&bind_address, 0, sizeof(bind_address));
 
@@ -35,15 +35,15 @@
   bind_address.sin_port = htons(port);
   bind_address.sin_addr.s_addr = htonl(INADDR_ANY);
 
-  PCHECK(bind(fd, reinterpret_cast<sockaddr *>(&bind_address),
-              sizeof(bind_address)));
+  AOS_PCHECK(bind(fd, reinterpret_cast<sockaddr *>(&bind_address),
+                  sizeof(bind_address)));
   return fd;
 }
 
 RXUdpSocket::RXUdpSocket(int port) : fd_(SocketBindListenOnPort(port)) {}
 
 int RXUdpSocket::Recv(void *data, int size) {
-  return PCHECK(recv(fd_.get(), static_cast<char *>(data), size, 0));
+  return AOS_PCHECK(recv(fd_.get(), static_cast<char *>(data), size, 0));
 }
 
 }  // namespace events
diff --git a/aos/vision/image/image_stream.cc b/aos/vision/image/image_stream.cc
index 1dba674..62f5e81 100644
--- a/aos/vision/image/image_stream.cc
+++ b/aos/vision/image/image_stream.cc
@@ -8,7 +8,7 @@
 void ImageStreamEvent::ProcessHelper(
     DataRef data, aos::monotonic_clock::time_point timestamp) {
   if (data.size() < 300) {
-    LOG(INFO, "got bad img of size(%d)\n", static_cast<int>(data.size()));
+    AOS_LOG(INFO, "got bad img of size(%d)\n", static_cast<int>(data.size()));
     return;
   }
   ProcessImage(data, timestamp);
diff --git a/aos/vision/image/jpeg_routines.cc b/aos/vision/image/jpeg_routines.cc
index 237daff..507fb3b 100644
--- a/aos/vision/image/jpeg_routines.cc
+++ b/aos/vision/image/jpeg_routines.cc
@@ -66,7 +66,7 @@
   int nsymbols = 0;
   for (int len = 1; len <= 16; len++) nsymbols += bits[len];
   if (nsymbols < 1 || nsymbols > 256) {
-    LOG(FATAL, "%s:%d: Error, bad huffman table", __FILE__, __LINE__);
+    AOS_LOG(FATAL, "%s:%d: Error, bad huffman table", __FILE__, __LINE__);
   }
 
   memcpy((*htblptr)->huffval, val, nsymbols * sizeof(uint8_t));
diff --git a/aos/vision/image/reader.cc b/aos/vision/image/reader.cc
index 991339b..7584369 100644
--- a/aos/vision/image/reader.cc
+++ b/aos/vision/image/reader.cc
@@ -42,15 +42,15 @@
     : dev_name_(dev_name), process_(std::move(process)), params_(params) {
   struct stat st;
   if (stat(dev_name.c_str(), &st) == -1) {
-    PLOG(FATAL, "Cannot identify '%s'", dev_name.c_str());
+    AOS_PLOG(FATAL, "Cannot identify '%s'", dev_name.c_str());
   }
   if (!S_ISCHR(st.st_mode)) {
-    PLOG(FATAL, "%s is no device\n", dev_name.c_str());
+    AOS_PLOG(FATAL, "%s is no device\n", dev_name.c_str());
   }
 
   fd_ = open(dev_name.c_str(), O_RDWR /* required */ | O_NONBLOCK, 0);
   if (fd_ == -1) {
-    PLOG(FATAL, "Cannot open '%s'", dev_name.c_str());
+    AOS_PLOG(FATAL, "Cannot open '%s'", dev_name.c_str());
   }
 
   Init();
@@ -58,17 +58,18 @@
   InitMMap();
 
   SetExposure(params.exposure());
-  LOG(INFO, "Bat Vision Successfully Initialized.\n");
+  AOS_LOG(INFO, "Bat Vision Successfully Initialized.\n");
 }
 
 void Reader::QueueBuffer(v4l2_buffer *buf) {
   if (xioctl(fd_, VIDIOC_QBUF, buf) == -1) {
-    PLOG(WARNING,
-         "ioctl VIDIOC_QBUF(%d, %p)."
-         " losing buf #%" PRIu32 "\n",
-         fd_, &buf, buf->index);
+    AOS_PLOG(WARNING,
+             "ioctl VIDIOC_QBUF(%d, %p)."
+             " losing buf #%" PRIu32 "\n",
+             fd_, &buf, buf->index);
   } else {
-    //    LOG(DEBUG, "put buf #%" PRIu32 " into driver's queue\n", buf->index);
+    //    AOS_LOG(DEBUG, "put buf #%" PRIu32 " into driver's queue\n",
+    //    buf->index);
     ++queued_;
   }
 }
@@ -81,7 +82,7 @@
 
   if (xioctl(fd_, VIDIOC_DQBUF, &buf) == -1) {
     if (errno != EAGAIN) {
-      PLOG(ERROR, "ioctl VIDIOC_DQBUF(%d, %p)", fd_, &buf);
+      AOS_PLOG(ERROR, "ioctl VIDIOC_DQBUF(%d, %p)", fd_, &buf);
     }
     return;
   }
@@ -110,15 +111,15 @@
     buf.memory = V4L2_MEMORY_MMAP;
     buf.index = n;
     if (xioctl(fd_, VIDIOC_QUERYBUF, &buf) == -1) {
-      PLOG(FATAL, "ioctl VIDIOC_QUERYBUF(%d, %p)", fd_, &buf);
+      AOS_PLOG(FATAL, "ioctl VIDIOC_QUERYBUF(%d, %p)", fd_, &buf);
     }
     buffers_[n].length = buf.length;
     buffers_[n].start = mmap(NULL, buf.length, PROT_READ | PROT_WRITE,
                              MAP_SHARED, fd_, buf.m.offset);
     if (buffers_[n].start == MAP_FAILED) {
-      PLOG(FATAL,
-           "mmap(NULL, %zd, PROT_READ | PROT_WRITE, MAP_SHARED, %d, %jd)",
-           (size_t)buf.length, fd_, static_cast<intmax_t>(buf.m.offset));
+      AOS_PLOG(FATAL,
+               "mmap(NULL, %zd, PROT_READ | PROT_WRITE, MAP_SHARED, %d, %jd)",
+               (size_t)buf.length, fd_, static_cast<intmax_t>(buf.m.offset));
     }
   }
 }
@@ -131,14 +132,14 @@
   req.memory = V4L2_MEMORY_MMAP;
   if (xioctl(fd_, VIDIOC_REQBUFS, &req) == -1) {
     if (EINVAL == errno) {
-      LOG(FATAL, "%s does not support memory mapping\n", dev_name_.c_str());
+      AOS_LOG(FATAL, "%s does not support memory mapping\n", dev_name_.c_str());
     } else {
-      PLOG(FATAL, "ioctl VIDIOC_REQBUFS(%d, %p)\n", fd_, &req);
+      AOS_PLOG(FATAL, "ioctl VIDIOC_REQBUFS(%d, %p)\n", fd_, &req);
     }
   }
   queued_ = kNumBuffers;
   if (req.count != kNumBuffers) {
-    LOG(FATAL, "Insufficient buffer memory on %s\n", dev_name_.c_str());
+    AOS_LOG(FATAL, "Insufficient buffer memory on %s\n", dev_name_.c_str());
   }
 }
 
@@ -150,11 +151,11 @@
   int r = xioctl(fd_, VIDIOC_G_CTRL, &getArg);
   if (r == 0) {
     if (getArg.value == value) {
-      LOG(DEBUG, "Camera control %s was already %d\n", name, getArg.value);
+      AOS_LOG(DEBUG, "Camera control %s was already %d\n", name, getArg.value);
       return true;
     }
   } else if (errno == EINVAL) {
-    LOG(DEBUG, "Camera control %s is invalid\n", name);
+    AOS_LOG(DEBUG, "Camera control %s is invalid\n", name);
     errno = 0;
     return false;
   }
@@ -165,7 +166,7 @@
     return true;
   }
 
-  LOG(DEBUG, "Couldn't set camera control %s to %d", name, value);
+  AOS_LOG(DEBUG, "Couldn't set camera control %s to %d", name, value);
   errno = 0;
   return false;
 }
@@ -179,16 +180,16 @@
   v4l2_capability cap;
   if (xioctl(fd_, VIDIOC_QUERYCAP, &cap) == -1) {
     if (EINVAL == errno) {
-      LOG(FATAL, "%s is no V4L2 device\n", dev_name_.c_str());
+      AOS_LOG(FATAL, "%s is no V4L2 device\n", dev_name_.c_str());
     } else {
-      PLOG(FATAL, "ioctl VIDIOC_QUERYCAP(%d, %p)", fd_, &cap);
+      AOS_PLOG(FATAL, "ioctl VIDIOC_QUERYCAP(%d, %p)", fd_, &cap);
     }
   }
   if (!(cap.capabilities & V4L2_CAP_VIDEO_CAPTURE)) {
-    LOG(FATAL, "%s is no video capture device\n", dev_name_.c_str());
+    AOS_LOG(FATAL, "%s is no video capture device\n", dev_name_.c_str());
   }
   if (!(cap.capabilities & V4L2_CAP_STREAMING)) {
-    LOG(FATAL, "%s does not support streaming i/o\n", dev_name_.c_str());
+    AOS_LOG(FATAL, "%s does not support streaming i/o\n", dev_name_.c_str());
   }
 
   /* Select video input, video standard and tune here. */
@@ -208,12 +209,12 @@
           break;
         default:
           /* Errors ignored. */
-          PLOG(WARNING, "xioctl VIDIOC_S_CROP");
+          AOS_PLOG(WARNING, "xioctl VIDIOC_S_CROP");
           break;
       }
     }
   } else {
-    PLOG(WARNING, "xioctl VIDIOC_CROPCAP");
+    AOS_PLOG(WARNING, "xioctl VIDIOC_CROPCAP");
   }
 
   v4l2_format fmt;
@@ -226,8 +227,8 @@
   // fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_YUYV;
   // fmt.fmt.pix.field = V4L2_FIELD_INTERLACED;
   if (xioctl(fd_, VIDIOC_S_FMT, &fmt) == -1) {
-    LOG(FATAL, "ioctl VIDIC_S_FMT(%d, %p) failed with %d: %s\n", fd_, &fmt,
-        errno, strerror(errno));
+    AOS_LOG(FATAL, "ioctl VIDIC_S_FMT(%d, %p) failed with %d: %s\n", fd_, &fmt,
+            errno, strerror(errno));
   }
   /* Note VIDIOC_S_FMT may change width and height. */
 
@@ -239,21 +240,21 @@
 
   if (!SetCameraControl(V4L2_CID_EXPOSURE_AUTO, "V4L2_CID_EXPOSURE_AUTO",
                         V4L2_EXPOSURE_MANUAL)) {
-    LOG(FATAL, "Failed to set exposure\n");
+    AOS_LOG(FATAL, "Failed to set exposure\n");
   }
 
   if (!SetCameraControl(V4L2_CID_EXPOSURE_ABSOLUTE,
                         "V4L2_CID_EXPOSURE_ABSOLUTE", params_.exposure())) {
-    LOG(FATAL, "Failed to set exposure\n");
+    AOS_LOG(FATAL, "Failed to set exposure\n");
   }
 
   if (!SetCameraControl(V4L2_CID_BRIGHTNESS, "V4L2_CID_BRIGHTNESS",
                         params_.brightness())) {
-    LOG(FATAL, "Failed to set up camera\n");
+    AOS_LOG(FATAL, "Failed to set up camera\n");
   }
 
   if (!SetCameraControl(V4L2_CID_GAIN, "V4L2_CID_GAIN", params_.gain())) {
-    LOG(FATAL, "Failed to set up camera\n");
+    AOS_LOG(FATAL, "Failed to set up camera\n");
   }
 
   // set framerate
@@ -264,18 +265,18 @@
   setfps->parm.capture.timeperframe.numerator = 1;
   setfps->parm.capture.timeperframe.denominator = params_.fps();
   if (xioctl(fd_, VIDIOC_S_PARM, setfps) == -1) {
-    PLOG(FATAL, "ioctl VIDIOC_S_PARM(%d, %p)\n", fd_, setfps);
+    AOS_PLOG(FATAL, "ioctl VIDIOC_S_PARM(%d, %p)\n", fd_, setfps);
   }
-  LOG(INFO, "framerate ended up at %d/%d\n",
-      setfps->parm.capture.timeperframe.numerator,
-      setfps->parm.capture.timeperframe.denominator);
+  AOS_LOG(INFO, "framerate ended up at %d/%d\n",
+          setfps->parm.capture.timeperframe.numerator,
+          setfps->parm.capture.timeperframe.denominator);
 }
 
 aos::vision::ImageFormat Reader::get_format() {
   struct v4l2_format fmt;
   fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
   if (xioctl(fd_, VIDIOC_G_FMT, &fmt) == -1) {
-    PLOG(FATAL, "ioctl VIDIC_G_FMT(%d, %p)\n", fd_, &fmt);
+    AOS_PLOG(FATAL, "ioctl VIDIC_G_FMT(%d, %p)\n", fd_, &fmt);
   }
 
   return aos::vision::ImageFormat{(int)fmt.fmt.pix.width,
@@ -283,7 +284,7 @@
 }
 
 void Reader::Start() {
-  LOG(DEBUG, "queueing buffers for the first time\n");
+  AOS_LOG(DEBUG, "queueing buffers for the first time\n");
   v4l2_buffer buf;
   for (unsigned int i = 0; i < kNumBuffers; ++i) {
     CLEAR(buf);
@@ -292,11 +293,11 @@
     buf.index = i;
     QueueBuffer(&buf);
   }
-  LOG(DEBUG, "done with first queue\n");
+  AOS_LOG(DEBUG, "done with first queue\n");
 
   v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
   if (xioctl(fd_, VIDIOC_STREAMON, &type) == -1) {
-    PLOG(FATAL, "ioctl VIDIOC_STREAMON(%d, %p)\n", fd_, &type);
+    AOS_PLOG(FATAL, "ioctl VIDIOC_STREAMON(%d, %p)\n", fd_, &type);
   }
 }
 
diff --git a/frc971/autonomous/base_autonomous_actor.cc b/frc971/autonomous/base_autonomous_actor.cc
index c78a90d..367e849 100644
--- a/frc971/autonomous/base_autonomous_actor.cc
+++ b/frc971/autonomous/base_autonomous_actor.cc
@@ -44,7 +44,7 @@
                   ".frc971.control_loops.drivetrain_queue.goal")) {}
 
 void BaseAutonomousActor::ResetDrivetrain() {
-  LOG(INFO, "resetting the drivetrain\n");
+  AOS_LOG(INFO, "resetting the drivetrain\n");
   max_drivetrain_voltage_ = 12.0;
   goal_spline_handle_ = 0;
 
@@ -72,7 +72,7 @@
 void BaseAutonomousActor::StartDrive(double distance, double angle,
                                      ProfileParameters linear,
                                      ProfileParameters angular) {
-  LOG(INFO, "Driving distance %f, angle %f\n", distance, angle);
+  AOS_LOG(INFO, "Driving distance %f, angle %f\n", distance, angle);
   {
     const double dangle = angle * dt_config_.robot_radius;
     initial_drivetrain_.left += distance - dangle;
@@ -90,7 +90,7 @@
   drivetrain_message->linear = linear;
   drivetrain_message->angular = angular;
 
-  LOG_STRUCT(DEBUG, "dtg", *drivetrain_message);
+  AOS_LOG_STRUCT(DEBUG, "dtg", *drivetrain_message);
 
   drivetrain_message.Send();
 }
@@ -98,7 +98,7 @@
 void BaseAutonomousActor::WaitUntilDoneOrCanceled(
     ::std::unique_ptr<aos::common::actions::Action> action) {
   if (!action) {
-    LOG(ERROR, "No action, not waiting\n");
+    AOS_LOG(ERROR, "No action, not waiting\n");
     return;
   }
 
@@ -149,7 +149,7 @@
             kVelocityTolerance &&
         ::std::abs(drivetrain_status_fetcher_->estimated_right_velocity) <
             kVelocityTolerance) {
-      LOG(INFO, "Finished drive\n");
+      AOS_LOG(INFO, "Finished drive\n");
       return true;
     }
   }
@@ -275,17 +275,17 @@
       drive_has_been_close |= drive_close;
       turn_has_been_close |= turn_close;
       if (drive_has_been_close && !turn_has_been_close && !printed_first) {
-        LOG(INFO, "Drive finished first\n");
+        AOS_LOG(INFO, "Drive finished first\n");
         printed_first = true;
       } else if (!drive_has_been_close && turn_has_been_close &&
                  !printed_first) {
-        LOG(INFO, "Turn finished first\n");
+        AOS_LOG(INFO, "Turn finished first\n");
         printed_first = true;
       }
 
       if (drive_close && turn_close) {
-        LOG(INFO, "Closer than %f < %f distance, %f < %f angle\n",
-            distance_to_go, distance, angle_to_go, angle);
+        AOS_LOG(INFO, "Closer than %f < %f distance, %f < %f angle\n",
+                distance_to_go, distance, angle_to_go, angle);
         return true;
       }
     }
@@ -316,7 +316,7 @@
 
     if (drivetrain_status_fetcher_.get()) {
       if (::std::abs(linear_error(0)) < tolerance) {
-        LOG(INFO, "Finished drive\n");
+        AOS_LOG(INFO, "Finished drive\n");
         return true;
       }
     }
@@ -352,7 +352,7 @@
 
     if (drivetrain_status_fetcher_.get()) {
       if (::std::abs(angular_error(0)) < tolerance) {
-        LOG(INFO, "Finished turn\n");
+        AOS_LOG(INFO, "Finished turn\n");
         return true;
       }
     }
@@ -423,7 +423,7 @@
 
 BaseAutonomousActor::SplineHandle BaseAutonomousActor::PlanSpline(
     const ::frc971::MultiSpline &spline, SplineDirection direction) {
-  LOG(INFO, "Planning spline\n");
+  AOS_LOG(INFO, "Planning spline\n");
 
   int32_t spline_handle = (++spline_handle_) | ((getpid() & 0xFFFF) << 15);
 
@@ -445,7 +445,7 @@
   drivetrain_message->spline.drive_spline_backwards =
       direction == SplineDirection::kBackward;
 
-  LOG_STRUCT(DEBUG, "dtg", *drivetrain_message);
+  AOS_LOG_STRUCT(DEBUG, "dtg", *drivetrain_message);
 
   drivetrain_message.Send();
 
@@ -454,8 +454,8 @@
 
 bool BaseAutonomousActor::SplineHandle::IsPlanned() {
   base_autonomous_actor_->drivetrain_status_fetcher_.Fetch();
-  LOG_STRUCT(DEBUG, "dts",
-             *(base_autonomous_actor_->drivetrain_status_fetcher_.get()));
+  AOS_LOG_STRUCT(DEBUG, "dts",
+                 *(base_autonomous_actor_->drivetrain_status_fetcher_.get()));
   if (base_autonomous_actor_->drivetrain_status_fetcher_.get() &&
       ((base_autonomous_actor_->drivetrain_status_fetcher_->trajectory_logging
                 .planning_spline_idx == spline_handle_ &&
@@ -489,20 +489,20 @@
       base_autonomous_actor_->drivetrain_goal_sender_.MakeMessage();
   drivetrain_message->controller_type = 2;
 
-  LOG(INFO, "Starting spline\n");
+  AOS_LOG(INFO, "Starting spline\n");
 
   drivetrain_message->spline_handle = spline_handle_;
   base_autonomous_actor_->goal_spline_handle_ = spline_handle_;
 
-  LOG_STRUCT(DEBUG, "dtg", *drivetrain_message);
+  AOS_LOG_STRUCT(DEBUG, "dtg", *drivetrain_message);
 
   drivetrain_message.Send();
 }
 
 bool BaseAutonomousActor::SplineHandle::IsDone() {
   base_autonomous_actor_->drivetrain_status_fetcher_.Fetch();
-  LOG_STRUCT(INFO, "dts",
-             *(base_autonomous_actor_->drivetrain_status_fetcher_.get()));
+  AOS_LOG_STRUCT(INFO, "dts",
+                 *(base_autonomous_actor_->drivetrain_status_fetcher_.get()));
 
   // We check that the spline we are waiting on is neither currently planning
   // nor executing (we check is_executed because it is possible to receive
diff --git a/frc971/control_loops/coerce_goal.h b/frc971/control_loops/coerce_goal.h
index 801135a..6c1f504 100644
--- a/frc971/control_loops/coerce_goal.h
+++ b/frc971/control_loops/coerce_goal.h
@@ -76,7 +76,7 @@
   } else {
     Eigen::Matrix<Scalar, 2, 4> region_vertices = region.StaticVertices();
 #ifdef __linux__
-    CHECK_GT(region_vertices.outerSize(), 0);
+    AOS_CHECK_GT(region_vertices.outerSize(), 0);
 #else
     assert(region_vertices.outerSize() > 0);
 #endif
diff --git a/frc971/control_loops/drivetrain/distance_spline.cc b/frc971/control_loops/drivetrain/distance_spline.cc
index 1572526..cdb7fb9 100644
--- a/frc971/control_loops/drivetrain/distance_spline.cc
+++ b/frc971/control_loops/drivetrain/distance_spline.cc
@@ -23,16 +23,18 @@
       const ::Eigen::Matrix<double, 2, 1> start1 = spline1.Point(0.0);
 
       if (!end0.isApprox(start1, 1e-6)) {
-        LOG(ERROR, "Splines %d and %d don't line up.  [%f, %f] != [%f, %f]\n",
-            static_cast<int>(i - 1), static_cast<int>(i), end0(0, 0),
-            end0(1, 0), start1(0, 0), start1(1, 0));
+        AOS_LOG(ERROR,
+                "Splines %d and %d don't line up.  [%f, %f] != [%f, %f]\n",
+                static_cast<int>(i - 1), static_cast<int>(i), end0(0, 0),
+                end0(1, 0), start1(0, 0), start1(1, 0));
       }
 
       const ::Eigen::Matrix<double, 2, 1> dend0 = spline0.DPoint(1.0);
       const ::Eigen::Matrix<double, 2, 1> dstart1 = spline1.DPoint(0.0);
 
       if (!dend0.isApprox(dstart1, 1e-6)) {
-        LOG(ERROR,
+        AOS_LOG(
+            ERROR,
             "Splines %d and %d don't line up in the first derivitive.  [%f, "
             "%f] != [%f, %f]\n",
             static_cast<int>(i - 1), static_cast<int>(i), dend0(0, 0),
@@ -43,7 +45,8 @@
       const ::Eigen::Matrix<double, 2, 1> ddstart1 = spline1.DDPoint(0.0);
 
       if (!ddend0.isApprox(ddstart1, 1e-6)) {
-        LOG(ERROR,
+        AOS_LOG(
+            ERROR,
             "Splines %d and %d don't line up in the second derivitive.  [%f, "
             "%f] != [%f, %f]\n",
             static_cast<int>(i - 1), static_cast<int>(i), ddend0(0, 0),
diff --git a/frc971/control_loops/drivetrain/drivetrain.cc b/frc971/control_loops/drivetrain/drivetrain.cc
index b9d2bc4..4685ed6 100644
--- a/frc971/control_loops/drivetrain/drivetrain.cc
+++ b/frc971/control_loops/drivetrain/drivetrain.cc
@@ -162,7 +162,7 @@
     }
 
     if (accel_squared > 1.03 || accel_squared < 0.97) {
-      LOG(DEBUG, "New IMU value, rejecting reading\n");
+      AOS_LOG(DEBUG, "New IMU value, rejecting reading\n");
     } else {
       // -y is our gyro.
       // z accel is down
@@ -172,10 +172,10 @@
       down_estimator_.Correct(Y);
     }
 
-    LOG(DEBUG,
-        "New IMU value, rate is %f, angle %f, fused %f, bias "
-        "%f\n",
-        rate, angle, down_estimator_.X_hat(0), down_estimator_.X_hat(1));
+    AOS_LOG(DEBUG,
+            "New IMU value, rate is %f, angle %f, fused %f, bias "
+            "%f\n",
+            rate, angle, down_estimator_.X_hat(0), down_estimator_.X_hat(1));
     down_U_(0, 0) = rate;
   }
   down_estimator_.UpdateObserver(down_U_, ::aos::controls::kLoopFrequency);
@@ -185,48 +185,48 @@
   switch (dt_config_.gyro_type) {
     case GyroType::IMU_X_GYRO:
       if (is_latest_imu_values) {
-        LOG_STRUCT(DEBUG, "using", *imu_values_fetcher_.get());
+        AOS_LOG_STRUCT(DEBUG, "using", *imu_values_fetcher_.get());
         last_gyro_rate_ = imu_values_fetcher_->gyro_x;
         last_gyro_time_ = monotonic_now;
       }
       break;
     case GyroType::IMU_Y_GYRO:
       if (is_latest_imu_values) {
-        LOG_STRUCT(DEBUG, "using", *imu_values_fetcher_.get());
+        AOS_LOG_STRUCT(DEBUG, "using", *imu_values_fetcher_.get());
         last_gyro_rate_ = imu_values_fetcher_->gyro_y;
         last_gyro_time_ = monotonic_now;
       }
       break;
     case GyroType::IMU_Z_GYRO:
       if (is_latest_imu_values) {
-        LOG_STRUCT(DEBUG, "using", *imu_values_fetcher_.get());
+        AOS_LOG_STRUCT(DEBUG, "using", *imu_values_fetcher_.get());
         last_gyro_rate_ = imu_values_fetcher_->gyro_z;
         last_gyro_time_ = monotonic_now;
       }
       break;
     case GyroType::FLIPPED_IMU_Z_GYRO:
       if (is_latest_imu_values) {
-        LOG_STRUCT(DEBUG, "using", *imu_values_fetcher_.get());
+        AOS_LOG_STRUCT(DEBUG, "using", *imu_values_fetcher_.get());
         last_gyro_rate_ = -imu_values_fetcher_->gyro_z;
         last_gyro_time_ = monotonic_now;
       }
       break;
     case GyroType::SPARTAN_GYRO:
       if (gyro_reading_fetcher_.Fetch()) {
-        LOG_STRUCT(DEBUG, "using", *gyro_reading_fetcher_.get());
+        AOS_LOG_STRUCT(DEBUG, "using", *gyro_reading_fetcher_.get());
         last_gyro_rate_ = gyro_reading_fetcher_->velocity;
         last_gyro_time_ = monotonic_now;
       }
       break;
     case GyroType::FLIPPED_SPARTAN_GYRO:
       if (gyro_reading_fetcher_.Fetch()) {
-        LOG_STRUCT(DEBUG, "using", *gyro_reading_fetcher_.get());
+        AOS_LOG_STRUCT(DEBUG, "using", *gyro_reading_fetcher_.get());
         last_gyro_rate_ = -gyro_reading_fetcher_->velocity;
         last_gyro_time_ = monotonic_now;
       }
       break;
     default:
-      LOG(FATAL, "invalid gyro configured");
+      AOS_LOG(FATAL, "invalid gyro configured");
       break;
   }
 
@@ -244,7 +244,7 @@
     // TODO(james): Use a watcher (instead of a fetcher) once we support it in
     // simulation.
     if (localizer_control_fetcher_.Fetch()) {
-      LOG_STRUCT(DEBUG, "localizer_control", *localizer_control_fetcher_);
+      AOS_LOG_STRUCT(DEBUG, "localizer_control", *localizer_control_fetcher_);
       localizer_->ResetPosition(
           monotonic_now, localizer_control_fetcher_->x,
           localizer_control_fetcher_->y, localizer_control_fetcher_->theta,
diff --git a/frc971/control_loops/drivetrain/hybrid_ekf.h b/frc971/control_loops/drivetrain/hybrid_ekf.h
index 16b0b61..3f3a7f7 100644
--- a/frc971/control_loops/drivetrain/hybrid_ekf.h
+++ b/frc971/control_loops/drivetrain/hybrid_ekf.h
@@ -157,7 +157,7 @@
     // Because the check below for have_zeroed_encoders_ will add an
     // Observation, do a check here to ensure that initialization has been
     // performed and so there is at least one observation.
-    CHECK(!observations_.empty());
+    AOS_CHECK(!observations_.empty());
     if (!have_zeroed_encoders_) {
       // This logic handles ensuring that on the first encoder reading, we
       // update the internal state for the encoders to match the reading.
@@ -310,7 +310,7 @@
       PredictImpl(obs->U, dt, state, P);
     }
     if (!(obs->h && obs->dhdx)) {
-      CHECK(obs->make_h);
+      AOS_CHECK(obs->make_h);
       obs->make_h(*state, *P, &obs->h, &obs->dhdx);
     }
     CorrectImpl(obs->R, obs->z, obs->h(*state, obs->U), obs->dhdx(*state),
@@ -351,18 +351,19 @@
         dhdx,
     const Eigen::Matrix<Scalar, kNOutputs, kNOutputs> &R,
     aos::monotonic_clock::time_point t) {
-  CHECK(!observations_.empty());
+  AOS_CHECK(!observations_.empty());
   if (!observations_.full() && t < observations_.begin()->t) {
-    LOG(ERROR,
-        "Dropped an observation that was received before we "
-        "initialized.\n");
+    AOS_LOG(ERROR,
+            "Dropped an observation that was received before we "
+            "initialized.\n");
     return;
   }
   auto cur_it =
       observations_.PushFromBottom({t, t, State::Zero(), StateSquare::Zero(),
                                     Input::Zero(), z, make_h, h, dhdx, R});
   if (cur_it == observations_.end()) {
-    LOG(DEBUG,
+    AOS_LOG(
+        DEBUG,
         "Camera dropped off of end with time of %fs; earliest observation in "
         "queue has time of %fs.\n",
         ::aos::time::DurationInSeconds(t.time_since_epoch()),
@@ -395,7 +396,7 @@
     --prev_it;
     cur_it->prev_t = prev_it->t;
     // TODO(james): Figure out a saner way of handling this.
-    CHECK(U != nullptr);
+    AOS_CHECK(U != nullptr);
     cur_it->U = *U;
   } else {
     cur_it->X_hat = next_it->X_hat;
@@ -411,7 +412,7 @@
     // We use X_hat_ and P_ to store the intermediate states, and then
     // once we reach the end they will all be up-to-date.
     ProcessObservation(&*cur_it, cur_it->t - cur_it->prev_t, &X_hat_, &P_);
-    CHECK(X_hat_.allFinite());
+    AOS_CHECK(X_hat_.allFinite());
     if (next_it != observations_.end()) {
       next_it->X_hat = X_hat_;
       next_it->P = P_;
diff --git a/frc971/control_loops/drivetrain/line_follow_drivetrain.cc b/frc971/control_loops/drivetrain/line_follow_drivetrain.cc
index 4c51569..8234b1c 100644
--- a/frc971/control_loops/drivetrain/line_follow_drivetrain.cc
+++ b/frc971/control_loops/drivetrain/line_follow_drivetrain.cc
@@ -75,8 +75,8 @@
   if (info != 0) {
     // We allow a FATAL error here since this should only be called during
     // initialization.
-    LOG(FATAL, "Failed to solve %d, controllability: %d\n", info,
-        controls::Controllability(A, B));
+    AOS_LOG(FATAL, "Failed to solve %d, controllability: %d\n", info,
+            controls::Controllability(A, B));
   }
   return K;
 }
diff --git a/frc971/control_loops/drivetrain/splinedrivetrain.cc b/frc971/control_loops/drivetrain/splinedrivetrain.cc
index 1f7e2b0..de59355 100644
--- a/frc971/control_loops/drivetrain/splinedrivetrain.cc
+++ b/frc971/control_loops/drivetrain/splinedrivetrain.cc
@@ -31,7 +31,7 @@
   ::aos::MutexLocker locker(&mutex_);
   while (run_) {
     while (goal_.spline.spline_idx == future_spline_idx_) {
-      CHECK(!new_goal_.Wait());
+      AOS_CHECK(!new_goal_.Wait());
       if (!run_) {
         return;
       }
diff --git a/frc971/control_loops/drivetrain/ssdrivetrain.cc b/frc971/control_loops/drivetrain/ssdrivetrain.cc
index 5330414..5924eb1 100644
--- a/frc971/control_loops/drivetrain/ssdrivetrain.cc
+++ b/frc971/control_loops/drivetrain/ssdrivetrain.cc
@@ -60,7 +60,7 @@
 
   const Eigen::Matrix<double, 7, 1> error = kf_->R() - kf_->X_hat();
 
-  LOG_MATRIX(DEBUG, "U_uncapped", *U);
+  AOS_LOG_MATRIX(DEBUG, "U_uncapped", *U);
 
   Eigen::Matrix<double, 2, 2> position_K;
   position_K << kf_->controller().K(0, 0), kf_->controller().K(0, 2),
@@ -75,8 +75,7 @@
   const auto drive_error = T_inverse_ * position_error;
   Eigen::Matrix<double, 2, 1> velocity_error;
   velocity_error << error(1, 0), error(3, 0);
-  LOG_MATRIX(DEBUG, "error", error);
-
+  AOS_LOG_MATRIX(DEBUG, "error", error);
 
   Eigen::Matrix<double, 2, 1> U_integral;
   U_integral << kf_->X_hat(4, 0), kf_->X_hat(5, 0);
@@ -139,7 +138,7 @@
 
   if (!output_was_capped_) {
     if ((*U - kf_->U_uncapped()).norm() > 0.0001) {
-      LOG(FATAL, "U unnecessarily capped\n");
+      AOS_LOG(FATAL, "U unnecessarily capped\n");
     }
   }
 }
@@ -228,7 +227,7 @@
       // coordinates.  Convert back...
       linear_profile_.MoveCurrentState(dt_config_.LeftRightToLinear(kf_->R()));
 
-      LOG(DEBUG, "Saturated while moving\n");
+      AOS_LOG(DEBUG, "Saturated while moving\n");
 
       Eigen::Matrix<double, 2, 1> absolute_angular =
           dt_config_.LeftRightToAngular(kf_->R());
diff --git a/frc971/control_loops/drivetrain/trajectory.cc b/frc971/control_loops/drivetrain/trajectory.cc
index ae51cb1..9d35a5e 100644
--- a/frc971/control_loops/drivetrain/trajectory.cc
+++ b/frc971/control_loops/drivetrain/trajectory.cc
@@ -86,8 +86,8 @@
   // If we would end up with an imaginary number, cap us at 0 acceleration.
   // TODO(austin): Investigate when this happens, why, and fix it.
   if (squared < 0.0) {
-    LOG(ERROR, "Imaginary %f, maxa: %f, fa(%f, %f) -> 0.0\n", squared, maxa, x,
-        v);
+    AOS_LOG(ERROR, "Imaginary %f, maxa: %f, fa(%f, %f) -> 0.0\n", squared, maxa,
+            x, v);
     return 0.0;
   }
   const double longitudal_acceleration =
@@ -148,8 +148,8 @@
   // If we would end up with an imaginary number, cap us at 0 acceleration.
   // TODO(austin): Investigate when this happens, why, and fix it.
   if (squared < 0.0) {
-    LOG(ERROR, "Imaginary %f, mina: %f, fa(%f, %f) -> 0.0\n", squared, mina, x,
-        v);
+    AOS_LOG(ERROR, "Imaginary %f, mina: %f, fa(%f, %f) -> 0.0\n", squared, mina,
+            x, v);
     return 0.0;
   }
   const double longitudal_acceleration =
@@ -221,7 +221,8 @@
       acceleration = BackwardAcceleration(distance, velocity);
       break;
     default:
-      LOG(FATAL, "Unknown segment type %d\n",
+      AOS_LOG(
+          FATAL, "Unknown segment type %d\n",
           static_cast<int>(plan_segment_type_[DistanceToSegment(distance)]));
       break;
   }
@@ -229,7 +230,7 @@
   if (vcurvature < velocity) {
     velocity = vcurvature;
     acceleration = 0.0;
-    LOG(ERROR, "Curvature won\n");
+    AOS_LOG(ERROR, "Curvature won\n");
   }
   return (::Eigen::Matrix<double, 3, 1>() << distance, velocity, acceleration)
       .finished();
@@ -327,23 +328,23 @@
 
   int info = ::frc971::controls::dlqr<5, 2>(A, B, Q, R, &K, &S);
   if (info == 0) {
-    LOG_MATRIX(INFO, "K", K);
+    AOS_LOG_MATRIX(INFO, "K", K);
   } else {
-    LOG(ERROR, "Failed to solve %d, controllability: %d\n", info,
-        controls::Controllability(A, B));
+    AOS_LOG(ERROR, "Failed to solve %d, controllability: %d\n", info,
+            controls::Controllability(A, B));
     // TODO(austin): Can we be more clever here?  Use the last one?  We should
     // collect more info about when this breaks down from logs.
     K = ::Eigen::Matrix<double, 2, 5>::Zero();
   }
   ::Eigen::EigenSolver<::Eigen::Matrix<double, 5, 5>> eigensolver(A - B * K);
   const auto eigenvalues = eigensolver.eigenvalues();
-  LOG(DEBUG,
-      "Eigenvalues: (%f + %fj), (%f + %fj), (%f + %fj), (%f + %fj), (%f + "
-      "%fj)\n",
-      eigenvalues(0).real(), eigenvalues(0).imag(), eigenvalues(1).real(),
-      eigenvalues(1).imag(), eigenvalues(2).real(), eigenvalues(2).imag(),
-      eigenvalues(3).real(), eigenvalues(3).imag(), eigenvalues(4).real(),
-      eigenvalues(4).imag());
+  AOS_LOG(DEBUG,
+          "Eigenvalues: (%f + %fj), (%f + %fj), (%f + %fj), (%f + %fj), (%f + "
+          "%fj)\n",
+          eigenvalues(0).real(), eigenvalues(0).imag(), eigenvalues(1).real(),
+          eigenvalues(1).imag(), eigenvalues(2).real(), eigenvalues(2).imag(),
+          eigenvalues(3).real(), eigenvalues(3).imag(), eigenvalues(4).real(),
+          eigenvalues(4).imag());
   return K;
 }
 
@@ -397,8 +398,8 @@
 
   const double min_length = length() / static_cast<double>(plan_.size() - 1);
   if (starting_distance > ending_distance) {
-    LOG(FATAL, "End before start: %f > %f\n", starting_distance,
-        ending_distance);
+    AOS_LOG(FATAL, "End before start: %f > %f\n", starting_distance,
+            ending_distance);
   }
   starting_distance = ::std::min(length(), ::std::max(0.0, starting_distance));
   ending_distance = ::std::min(length(), ::std::max(0.0, ending_distance));
diff --git a/frc971/control_loops/drivetrain/trajectory_plot.cc b/frc971/control_loops/drivetrain/trajectory_plot.cc
index d2dd2c8..0b35ee8 100644
--- a/frc971/control_loops/drivetrain/trajectory_plot.cc
+++ b/frc971/control_loops/drivetrain/trajectory_plot.cc
@@ -97,10 +97,10 @@
 
   ::std::vector<double> backward_plan = trajectory.plan();
 
-  LOG(INFO, "Took %fms to plan\n",
-      chrono::duration_cast<chrono::duration<double, ::std::milli>>(end_time -
-                                                                    start_time)
-          .count());
+  AOS_LOG(INFO, "Took %fms to plan\n",
+          chrono::duration_cast<chrono::duration<double, ::std::milli>>(
+              end_time - start_time)
+              .count());
 
   // Now, compute the xva as a function of time.
   ::std::vector<double> length_plan_t;
diff --git a/frc971/control_loops/hybrid_state_feedback_loop.h b/frc971/control_loops/hybrid_state_feedback_loop.h
index d69f7db..a6160e7 100644
--- a/frc971/control_loops/hybrid_state_feedback_loop.h
+++ b/frc971/control_loops/hybrid_state_feedback_loop.h
@@ -147,7 +147,7 @@
     for (int i = 0; i < kNumInputs; ++i) {
       if (U(i, 0) > U_max(i, 0) + static_cast<Scalar>(0.00001) ||
           U(i, 0) < U_min(i, 0) - static_cast<Scalar>(0.00001)) {
-        LOG(FATAL, "U out of range\n");
+        AOS_LOG(FATAL, "U out of range\n");
       }
     }
   }
diff --git a/frc971/control_loops/profiled_subsystem.h b/frc971/control_loops/profiled_subsystem.h
index 53c729d..58058c7 100644
--- a/frc971/control_loops/profiled_subsystem.h
+++ b/frc971/control_loops/profiled_subsystem.h
@@ -234,7 +234,7 @@
 template <class ZeroingEstimator>
 void SingleDOFProfiledSubsystem<ZeroingEstimator>::UpdateOffset(double offset) {
   const double doffset = offset - offset_(0, 0);
-  LOG(INFO, "Adjusting offset from %f to %f\n", offset_(0, 0), offset);
+  AOS_LOG(INFO, "Adjusting offset from %f to %f\n", offset_(0, 0), offset);
 
   this->loop_->mutable_X_hat()(0, 0) += doffset;
   this->Y_(0, 0) += doffset;
@@ -282,7 +282,7 @@
   this->estimators_[0].UpdateEstimate(new_position);
 
   if (this->estimators_[0].error()) {
-    LOG(ERROR, "zeroing error\n");
+    AOS_LOG(ERROR, "zeroing error\n");
     return;
   }
 
@@ -309,12 +309,12 @@
     const char *name, Eigen::Matrix<double, 3, 1> *goal) {
   // Limit the goal to min/max allowable positions.
   if ((*goal)(0, 0) > range_.upper) {
-    LOG(WARNING, "Goal %s above limit, %f > %f\n", name, (*goal)(0, 0),
-        range_.upper);
+    AOS_LOG(WARNING, "Goal %s above limit, %f > %f\n", name, (*goal)(0, 0),
+            range_.upper);
     (*goal)(0, 0) = range_.upper;
   }
   if ((*goal)(0, 0) < range_.lower) {
-    LOG(WARNING, "Goal %s below limit, %f < %f\n", name, (*goal)(0, 0),
+    AOS_LOG(WARNING, "Goal %s below limit, %f < %f\n", name, (*goal)(0, 0),
         range_.lower);
     (*goal)(0, 0) = range_.lower;
   }
@@ -373,7 +373,8 @@
   // Returns whether hard limits have been exceeded.
 
   if (position() > range_.upper_hard || position() < range_.lower_hard) {
-    LOG(ERROR,
+    AOS_LOG(
+        ERROR,
         "SingleDOFProfiledSubsystem at %f out of bounds [%f, %f], ESTOPing\n",
         position(), range_.lower_hard, range_.upper_hard);
     return true;
diff --git a/frc971/control_loops/state_feedback_loop.h b/frc971/control_loops/state_feedback_loop.h
index d5861b7..81783cc 100644
--- a/frc971/control_loops/state_feedback_loop.h
+++ b/frc971/control_loops/state_feedback_loop.h
@@ -147,7 +147,7 @@
       if (U(i, 0) > U_max(i, 0) + static_cast<Scalar>(0.00001) ||
           U(i, 0) < U_min(i, 0) - static_cast<Scalar>(0.00001)) {
 #if defined(__linux__)
-        LOG(FATAL, "U out of range\n");
+        AOS_LOG(FATAL, "U out of range\n");
 #else
         abort();
 #endif
diff --git a/frc971/control_loops/static_zeroing_single_dof_profiled_subsystem.h b/frc971/control_loops/static_zeroing_single_dof_profiled_subsystem.h
index 7e8f4a7..748086f 100644
--- a/frc971/control_loops/static_zeroing_single_dof_profiled_subsystem.h
+++ b/frc971/control_loops/static_zeroing_single_dof_profiled_subsystem.h
@@ -185,11 +185,11 @@
 
         double safe_goal = goal->unsafe_goal;
         if (safe_goal < min_position_) {
-          LOG(DEBUG, "Limiting to %f from %f\n", min_position_, safe_goal);
+          AOS_LOG(DEBUG, "Limiting to %f from %f\n", min_position_, safe_goal);
           safe_goal = min_position_;
         }
         if (safe_goal > max_position_) {
-          LOG(DEBUG, "Limiting to %f from %f\n", max_position_, safe_goal);
+          AOS_LOG(DEBUG, "Limiting to %f from %f\n", max_position_, safe_goal);
           safe_goal = max_position_;
         }
         profiled_subsystem_.set_unprofiled_goal(safe_goal);
@@ -197,7 +197,7 @@
     } break;
 
     case State::ESTOP:
-      LOG(ERROR, "Estop\n");
+      AOS_LOG(ERROR, "Estop\n");
       disabled = true;
       break;
   }
diff --git a/frc971/control_loops/static_zeroing_single_dof_profiled_subsystem_test.cc b/frc971/control_loops/static_zeroing_single_dof_profiled_subsystem_test.cc
index 58096f3..96cb782 100644
--- a/frc971/control_loops/static_zeroing_single_dof_profiled_subsystem_test.cc
+++ b/frc971/control_loops/static_zeroing_single_dof_profiled_subsystem_test.cc
@@ -263,7 +263,7 @@
   void RunIteration(const GoalType *unsafe_goal, const PositionType *position,
                     OutputType *output, StatusType *status) {
     if (this->WasReset()) {
-      LOG(ERROR, "WPILib reset, restarting\n");
+      AOS_LOG(ERROR, "WPILib reset, restarting\n");
       subsystem_.Reset();
     }
 
diff --git a/frc971/wpilib/ADIS16448.cc b/frc971/wpilib/ADIS16448.cc
index 38d194d..4fc2c7b 100644
--- a/frc971/wpilib/ADIS16448.cc
+++ b/frc971/wpilib/ADIS16448.cc
@@ -25,7 +25,7 @@
   rx_clearer_.ClearRxFifo();
   switch (spi_->Transaction(to_send, to_receive, size)) {
     case -1:
-      LOG(INFO, "SPI::Transaction of %zd bytes failed\n", size);
+      AOS_LOG(INFO, "SPI::Transaction of %zd bytes failed\n", size);
       return false;
     case size:
       if (dummy_spi_) {
@@ -34,7 +34,7 @@
       }
       return true;
     default:
-      LOG(FATAL, "SPI::Transaction returned something weird\n");
+      AOS_LOG(FATAL, "SPI::Transaction returned something weird\n");
   }
 }
 
@@ -142,7 +142,7 @@
 
   // NI's SPI driver defaults to SCHED_OTHER.  Find it's PID with ps, and change
   // it to a RT priority of 33.
-  PCHECK(
+  AOS_PCHECK(
       system("ps -ef | grep '\\[spi0\\]' | awk '{print $1}' | xargs chrt -f -p "
              "33") == 0);
 
@@ -180,7 +180,7 @@
       ::std::this_thread::sleep_for(::std::chrono::milliseconds(50));
     }
   }
-  LOG(INFO, "IMU initialized successfully\n");
+  AOS_LOG(INFO, "IMU initialized successfully\n");
 }
 
 void ADIS16448::DoRun() {
@@ -201,7 +201,7 @@
       const frc::InterruptableSensorBase::WaitResult result =
           dio1_->WaitForInterrupt(0.1, !got_an_interrupt);
       if (result == frc::InterruptableSensorBase::kTimeout) {
-        LOG(WARNING, "IMU read timed out\n");
+        AOS_LOG(WARNING, "IMU read timed out\n");
         InitializeUntilSuccessful();
         continue;
       }
@@ -221,7 +221,7 @@
     // scenario.
     if (!dio1_->Get() || dio1_->WaitForInterrupt(0, false) !=
                              frc::InterruptableSensorBase::kTimeout) {
-      LOG(ERROR, "IMU read took too long\n");
+      AOS_LOG(ERROR, "IMU read took too long\n");
       continue;
     }
 
@@ -230,8 +230,9 @@
       uint16_t received_crc =
           to_receive[13 * 2 + 1] | (to_receive[13 * 2] << 8);
       if (received_crc != calculated_crc) {
-        LOG(WARNING, "received CRC %" PRIx16 " but calculated %" PRIx16 "\n",
-            received_crc, calculated_crc);
+        AOS_LOG(WARNING,
+                "received CRC %" PRIx16 " but calculated %" PRIx16 "\n",
+                received_crc, calculated_crc);
         InitializeUntilSuccessful();
         continue;
       }
@@ -274,9 +275,9 @@
           gyro_x_zeroed_offset_ = -average_gyro_x.GetAverage();
           gyro_y_zeroed_offset_ = -average_gyro_y.GetAverage();
           gyro_z_zeroed_offset_ = -average_gyro_z.GetAverage();
-          LOG(INFO, "total gyro zero offset X:%f, Y:%f, Z:%f\n",
-              gyro_x_zeroed_offset_, gyro_y_zeroed_offset_,
-              gyro_z_zeroed_offset_);
+          AOS_LOG(INFO, "total gyro zero offset X:%f, Y:%f, Z:%f\n",
+                  gyro_x_zeroed_offset_, gyro_y_zeroed_offset_,
+                  gyro_z_zeroed_offset_);
           gyros_are_zeroed_ = true;
         }
       }
@@ -306,9 +307,9 @@
     message->temperature =
         ConvertValue(&to_receive[24], kTemperatureLsbDegree) + kTemperatureZero;
 
-    LOG_STRUCT(DEBUG, "sending", *message);
+    AOS_LOG_STRUCT(DEBUG, "sending", *message);
     if (!message.Send()) {
-      LOG(WARNING, "sending queue message failed\n");
+      AOS_LOG(WARNING, "sending queue message failed\n");
     }
 
     spi_idle_callback_();
@@ -355,51 +356,51 @@
 bool ADIS16448::CheckDiagStatValue(uint16_t value) const {
   bool r = true;
   if (value & (1 << 2)) {
-    LOG(WARNING, "IMU gave flash update failure\n");
+    AOS_LOG(WARNING, "IMU gave flash update failure\n");
   }
   if (value & (1 << 3)) {
-    LOG(WARNING, "IMU gave SPI communication failure\n");
+    AOS_LOG(WARNING, "IMU gave SPI communication failure\n");
   }
   if (value & (1 << 4)) {
-    LOG(WARNING, "IMU gave sensor overrange\n");
+    AOS_LOG(WARNING, "IMU gave sensor overrange\n");
   }
   if (value & (1 << 5)) {
-    LOG(WARNING, "IMU gave self-test failure\n");
+    AOS_LOG(WARNING, "IMU gave self-test failure\n");
     r = false;
     if (value & (1 << 10)) {
-      LOG(WARNING, "IMU gave X-axis gyro self-test failure\n");
+      AOS_LOG(WARNING, "IMU gave X-axis gyro self-test failure\n");
     }
     if (value & (1 << 11)) {
-      LOG(WARNING, "IMU gave Y-axis gyro self-test failure\n");
+      AOS_LOG(WARNING, "IMU gave Y-axis gyro self-test failure\n");
     }
     if (value & (1 << 12)) {
-      LOG(WARNING, "IMU gave Z-axis gyro self-test failure\n");
+      AOS_LOG(WARNING, "IMU gave Z-axis gyro self-test failure\n");
     }
     if (value & (1 << 13)) {
-      LOG(WARNING, "IMU gave X-axis accelerometer self-test failure\n");
+      AOS_LOG(WARNING, "IMU gave X-axis accelerometer self-test failure\n");
     }
     if (value & (1 << 14)) {
-      LOG(WARNING, "IMU gave Y-axis accelerometer self-test failure\n");
+      AOS_LOG(WARNING, "IMU gave Y-axis accelerometer self-test failure\n");
     }
     if (value & (1 << 15)) {
-      LOG(WARNING, "IMU gave Z-axis accelerometer self-test failure, %x\n",
-          value);
+      AOS_LOG(WARNING, "IMU gave Z-axis accelerometer self-test failure, %x\n",
+              value);
     }
     if (value & (1 << 0)) {
-      LOG(WARNING, "IMU gave magnetometer functional test failure\n");
+      AOS_LOG(WARNING, "IMU gave magnetometer functional test failure\n");
     }
     if (value & (1 << 1)) {
-      LOG(WARNING, "IMU gave barometer functional test failure\n");
+      AOS_LOG(WARNING, "IMU gave barometer functional test failure\n");
     }
   }
   if (value & (1 << 6)) {
-    LOG(WARNING, "IMU gave flash test checksum failure\n");
+    AOS_LOG(WARNING, "IMU gave flash test checksum failure\n");
   }
   if (value & (1 << 8)) {
-    LOG(WARNING, "IMU says alarm 1 is active\n");
+    AOS_LOG(WARNING, "IMU says alarm 1 is active\n");
   }
   if (value & (1 << 9)) {
-    LOG(WARNING, "IMU says alarm 2 is active\n");
+    AOS_LOG(WARNING, "IMU says alarm 2 is active\n");
   }
   return r;
 }
@@ -409,7 +410,7 @@
   uint16_t product_id;
   if (!ReadRegister(kLotId1Address, &product_id)) return false;
   if (product_id != 0x4040) {
-    LOG(ERROR, "product ID is %" PRIx16 " instead of 0x4040\n", product_id);
+    AOS_LOG(ERROR, "product ID is %" PRIx16 " instead of 0x4040\n", product_id);
     return false;
   }
 
@@ -417,8 +418,8 @@
   if (!ReadRegister(kLotId2Address, &lot_id1)) return false;
   if (!ReadRegister(kSerialNumberAddress, &lot_id2)) return false;
   if (!ReadRegister(0, &serial_number)) return false;
-  LOG(INFO, "have IMU %" PRIx16 "%" PRIx16 ": %" PRIx16 "\n", lot_id1, lot_id2,
-      serial_number);
+  AOS_LOG(INFO, "have IMU %" PRIx16 "%" PRIx16 ": %" PRIx16 "\n", lot_id1,
+          lot_id2, serial_number);
 
   // Divide the sampling by 2^2 = 4 to get 819.2 / 4 = 204.8 Hz.
   if (!WriteRegister(kSmplPrdAddress, (2 << 8) | 1)) return false;
diff --git a/frc971/wpilib/buffered_pcm.cc b/frc971/wpilib/buffered_pcm.cc
index de8c547..3123add 100644
--- a/frc971/wpilib/buffered_pcm.cc
+++ b/frc971/wpilib/buffered_pcm.cc
@@ -16,7 +16,7 @@
     solenoid_handles_[i] =
         HAL_InitializeSolenoidPort(HAL_GetPortWithModule(module_, i), &status);
     if (status != 0) {
-      LOG(FATAL, "Status was %d\n", status);
+      AOS_LOG(FATAL, "Status was %d\n", status);
     }
   }
 }
@@ -38,18 +38,18 @@
   int32_t status = 0;
   int32_t result = HAL_GetAllSolenoids(module_, &status);
   if (status != 0) {
-    LOG(ERROR, "Failed to flush, %d\n", status);
+    AOS_LOG(ERROR, "Failed to flush, %d\n", status);
     return 0;
   }
   return result;
 }
 
 void BufferedPcm::Flush() {
-  LOG(DEBUG, "sending solenoids 0x%" PRIx8 "\n", values_);
+  AOS_LOG(DEBUG, "sending solenoids 0x%" PRIx8 "\n", values_);
   int32_t status = 0;
   HAL_SetAllSolenoids(module_, static_cast<int>(values_), &status);
   if (status != 0) {
-    LOG(ERROR, "Failed to flush, %d\n", status);
+    AOS_LOG(ERROR, "Failed to flush, %d\n", status);
   }
 }
 
diff --git a/frc971/wpilib/dma_edge_counting.cc b/frc971/wpilib/dma_edge_counting.cc
index 9fffebe..1b7bee9 100644
--- a/frc971/wpilib/dma_edge_counting.cc
+++ b/frc971/wpilib/dma_edge_counting.cc
@@ -57,7 +57,7 @@
       case DMA::STATUS_TIMEOUT:
         return;
       case DMA::STATUS_ERROR:
-        LOG(WARNING, "DMA read failed\n");
+        AOS_LOG(WARNING, "DMA read failed\n");
         break;
     }
   }
diff --git a/frc971/wpilib/drivetrain_writer.cc b/frc971/wpilib/drivetrain_writer.cc
index fdbc028..5c6feb8 100644
--- a/frc971/wpilib/drivetrain_writer.cc
+++ b/frc971/wpilib/drivetrain_writer.cc
@@ -12,7 +12,7 @@
 
 void DrivetrainWriter::Write(
     const ::frc971::control_loops::DrivetrainQueue::Output &output) {
-  LOG_STRUCT(DEBUG, "will output", output);
+  AOS_LOG_STRUCT(DEBUG, "will output", output);
   left_controller0_->SetSpeed(SafeSpeed(reversed_left0_, output.left_voltage));
   right_controller0_->SetSpeed(
       SafeSpeed(reversed_right0_, output.right_voltage));
@@ -28,7 +28,7 @@
 }
 
 void DrivetrainWriter::Stop() {
-  LOG(WARNING, "drivetrain output too old\n");
+  AOS_LOG(WARNING, "drivetrain output too old\n");
   left_controller0_->SetDisabled();
   right_controller0_->SetDisabled();
 
diff --git a/frc971/wpilib/encoder_and_potentiometer.cc b/frc971/wpilib/encoder_and_potentiometer.cc
index 8fe8c25..ac1a4a0 100644
--- a/frc971/wpilib/encoder_and_potentiometer.cc
+++ b/frc971/wpilib/encoder_and_potentiometer.cc
@@ -21,10 +21,10 @@
 }
 
 void InterruptEncoderAndPotentiometer::Start() {
-  CHECK_NE(nullptr, encoder_);
-  CHECK_NE(nullptr, index_);
-  CHECK_NE(nullptr, potentiometer_);
-  CHECK_NE(0, priority_);
+  AOS_CHECK_NE(nullptr, encoder_);
+  AOS_CHECK_NE(nullptr, index_);
+  AOS_CHECK_NE(nullptr, potentiometer_);
+  AOS_CHECK_NE(0, priority_);
   thread_ = ::std::thread(::std::ref(*this));
 }
 
diff --git a/frc971/wpilib/gyro_interface.cc b/frc971/wpilib/gyro_interface.cc
index da0c01b..eeacfce 100644
--- a/frc971/wpilib/gyro_interface.cc
+++ b/frc971/wpilib/gyro_interface.cc
@@ -26,45 +26,47 @@
 bool GyroInterface::InitializeGyro() {
   uint32_t result;
   if (!DoTransaction(0x20000003, &result)) {
-    LOG(WARNING, "failed to start a self-check\n");
+    AOS_LOG(WARNING, "failed to start a self-check\n");
     return false;
   }
   if (result != 1) {
     // We might have hit a parity error or something and are now retrying, so
     // this isn't a very big deal.
-    LOG(INFO, "gyro unexpected initial response 0x%" PRIx32 "\n", result);
+    AOS_LOG(INFO, "gyro unexpected initial response 0x%" PRIx32 "\n", result);
   }
 
   // Wait for it to assert the fault conditions before reading them.
   ::std::this_thread::sleep_for(::std::chrono::milliseconds(50));
 
   if (!DoTransaction(0x20000000, &result)) {
-    LOG(WARNING, "failed to clear latched non-fault data\n");
+    AOS_LOG(WARNING, "failed to clear latched non-fault data\n");
     return false;
   }
-  LOG(DEBUG, "gyro dummy response is 0x%" PRIx32 "\n", result);
+  AOS_LOG(DEBUG, "gyro dummy response is 0x%" PRIx32 "\n", result);
 
   if (!DoTransaction(0x20000000, &result)) {
-    LOG(WARNING, "failed to read self-test data\n");
+    AOS_LOG(WARNING, "failed to read self-test data\n");
     return false;
   }
   if (ExtractStatus(result) != 2) {
-    LOG(WARNING, "gyro first value 0x%" PRIx32 " not self-test data\n", result);
+    AOS_LOG(WARNING, "gyro first value 0x%" PRIx32 " not self-test data\n",
+            result);
     return false;
   }
   if (ExtractErrors(result) != 0x7F) {
-    LOG(WARNING, "gyro first value 0x%" PRIx32 " does not have all errors\n",
-        result);
+    AOS_LOG(WARNING,
+            "gyro first value 0x%" PRIx32 " does not have all errors\n",
+            result);
     return false;
   }
 
   if (!DoTransaction(0x20000000, &result)) {
-    LOG(WARNING, "failed to clear latched self-test data\n");
+    AOS_LOG(WARNING, "failed to clear latched self-test data\n");
     return false;
   }
   if (ExtractStatus(result) != 2) {
-    LOG(WARNING, "gyro second value 0x%" PRIx32 " not self-test data\n",
-        result);
+    AOS_LOG(WARNING, "gyro second value 0x%" PRIx32 " not self-test data\n",
+            result);
     return false;
   }
 
@@ -88,21 +90,21 @@
 
   switch (gyro_->Transaction(to_send, to_receive, kBytes)) {
     case -1:
-      LOG(INFO, "SPI::Transaction failed\n");
+      AOS_LOG(INFO, "SPI::Transaction failed\n");
       return false;
     case kBytes:
       break;
     default:
-      LOG(FATAL, "SPI::Transaction returned something weird\n");
+      AOS_LOG(FATAL, "SPI::Transaction returned something weird\n");
   }
 
   memcpy(result, to_receive, kBytes);
   if (__builtin_parity(*result & 0xFFFF) != 1) {
-    LOG(INFO, "high byte parity failure\n");
+    AOS_LOG(INFO, "high byte parity failure\n");
     return false;
   }
   if (__builtin_parity(*result) != 1) {
-    LOG(INFO, "whole value parity failure\n");
+    AOS_LOG(INFO, "whole value parity failure\n");
     return false;
   }
 
@@ -115,13 +117,14 @@
   uint32_t response;
   while (true) {
     if (!DoTransaction(command, &response)) {
-      LOG(WARNING, "reading 0x%" PRIx8 " failed\n", address);
+      AOS_LOG(WARNING, "reading 0x%" PRIx8 " failed\n", address);
       continue;
     }
     if ((response & 0xEFE00000) != 0x4E000000) {
-      LOG(WARNING, "gyro read from 0x%" PRIx8
-                   " gave unexpected response 0x%" PRIx32 "\n",
-          address, response);
+      AOS_LOG(WARNING,
+              "gyro read from 0x%" PRIx8 " gave unexpected response 0x%" PRIx32
+              "\n",
+              address, response);
       continue;
     }
     return (response >> 5) & 0xFFFF;
diff --git a/frc971/wpilib/gyro_sender.cc b/frc971/wpilib/gyro_sender.cc
index b1edbd2..3a9f220 100644
--- a/frc971/wpilib/gyro_sender.cc
+++ b/frc971/wpilib/gyro_sender.cc
@@ -32,7 +32,7 @@
       gyro_reading_sender_(
           event_loop_->MakeSender<::frc971::sensors::GyroReading>(
               ".frc971.sensors.gyro_reading")) {
-  PCHECK(
+  AOS_PCHECK(
       system("ps -ef | grep '\\[spi0\\]' | awk '{print $1}' | xargs chrt -f -p "
              "33") == 0);
   event_loop_->set_name("Gyro");
@@ -53,12 +53,12 @@
       if (last_initialize_time_ + chrono::milliseconds(50) < monotonic_now) {
         if (gyro_.InitializeGyro()) {
           state_ = State::RUNNING;
-          LOG(INFO, "gyro initialized successfully\n");
+          AOS_LOG(INFO, "gyro initialized successfully\n");
 
           {
             auto message = uid_sender_.MakeMessage();
             message->uid = gyro_.ReadPartID();
-            LOG_STRUCT(INFO, "gyro ID", *message);
+            AOS_LOG_STRUCT(INFO, "gyro ID", *message);
             message.Send();
           }
         }
@@ -68,42 +68,42 @@
     case State::RUNNING: {
       const uint32_t result = gyro_.GetReading();
       if (result == 0) {
-        LOG(WARNING, "normal gyro read failed\n");
+        AOS_LOG(WARNING, "normal gyro read failed\n");
         return;
       }
       switch (gyro_.ExtractStatus(result)) {
         case 0:
-          LOG(WARNING, "gyro says data is bad\n");
+          AOS_LOG(WARNING, "gyro says data is bad\n");
           return;
         case 1:
           break;
         default:
-          LOG(WARNING, "gyro gave weird status 0x%" PRIx8 "\n",
-              gyro_.ExtractStatus(result));
+          AOS_LOG(WARNING, "gyro gave weird status 0x%" PRIx8 "\n",
+                  gyro_.ExtractStatus(result));
           return;
       }
       if (gyro_.ExtractErrors(result) != 0) {
         const uint8_t errors = gyro_.ExtractErrors(result);
         if (errors & (1 << 6)) {
-          LOG(WARNING, "gyro gave PLL error\n");
+          AOS_LOG(WARNING, "gyro gave PLL error\n");
         }
         if (errors & (1 << 5)) {
-          LOG(WARNING, "gyro gave quadrature error\n");
+          AOS_LOG(WARNING, "gyro gave quadrature error\n");
         }
         if (errors & (1 << 4)) {
-          LOG(WARNING, "gyro gave non-volatile memory error\n");
+          AOS_LOG(WARNING, "gyro gave non-volatile memory error\n");
         }
         if (errors & (1 << 3)) {
-          LOG(WARNING, "gyro gave volatile memory error\n");
+          AOS_LOG(WARNING, "gyro gave volatile memory error\n");
         }
         if (errors & (1 << 2)) {
-          LOG(WARNING, "gyro gave power error\n");
+          AOS_LOG(WARNING, "gyro gave power error\n");
         }
         if (errors & (1 << 1)) {
-          LOG(WARNING, "gyro gave continuous self-test error\n");
+          AOS_LOG(WARNING, "gyro gave continuous self-test error\n");
         }
         if (errors & 1) {
-          LOG(WARNING, "gyro gave unexpected self-test mode\n");
+          AOS_LOG(WARNING, "gyro gave unexpected self-test mode\n");
         }
         return;
       }
@@ -120,7 +120,7 @@
         angle_ += (new_angle + zero_offset_) * iterations;
         message->angle = angle_;
         message->velocity = angle_rate + zero_offset_ * kReadingRate;
-        LOG_STRUCT(DEBUG, "sending", *message);
+        AOS_LOG_STRUCT(DEBUG, "sending", *message);
         message.Send();
       } else {
         // TODO(brian): Don't break without 6 seconds of standing still before
@@ -130,7 +130,7 @@
         {
           message->angle = new_angle;
           message->velocity = angle_rate;
-          LOG_STRUCT(DEBUG, "collected while zeroing", *message);
+          AOS_LOG_STRUCT(DEBUG, "collected while zeroing", *message);
           message->angle = 0.0;
           message->velocity = 0.0;
           message.Send();
@@ -141,7 +141,7 @@
         if (joystick_state_fetcher_.get() && joystick_state_fetcher_->enabled &&
             zeroing_data_.full()) {
           zero_offset_ = -zeroing_data_.GetAverage();
-          LOG(INFO, "total zero offset %f\n", zero_offset_);
+          AOS_LOG(INFO, "total zero offset %f\n", zero_offset_);
           zeroed_ = true;
         }
       }
diff --git a/frc971/wpilib/interrupt_edge_counting.cc b/frc971/wpilib/interrupt_edge_counting.cc
index a06df8f..546e64b 100644
--- a/frc971/wpilib/interrupt_edge_counting.cc
+++ b/frc971/wpilib/interrupt_edge_counting.cc
@@ -55,8 +55,8 @@
       }
       current_value_ = hall_value;
     } else {
-      LOG(WARNING, "Detected spurious edge on %d.  Dropping it.\n",
-          input_->GetChannel());
+      AOS_LOG(WARNING, "Detected spurious edge on %d.  Dropping it.\n",
+              input_->GetChannel());
     }
   }
 }
@@ -93,7 +93,7 @@
   ::std::unique_lock<::aos::stl_mutex> mutex_guard(mutex_);
   for (auto &c : handlers_) {
     if (c->interrupt_count_changed()) {
-      LOG(WARNING, "got an interrupt while sampling. retrying\n");
+      AOS_LOG(WARNING, "got an interrupt while sampling. retrying\n");
       return false;
     }
   }
diff --git a/frc971/wpilib/interrupt_edge_counting.h b/frc971/wpilib/interrupt_edge_counting.h
index 50dc94d..160682c 100644
--- a/frc971/wpilib/interrupt_edge_counting.h
+++ b/frc971/wpilib/interrupt_edge_counting.h
@@ -46,8 +46,8 @@
   // Starts the thread running.
   // set_priority and set_mutex must be called first.
   void Start() {
-    CHECK_NE(nullptr, mutex_);
-    CHECK_NE(0, priority_);
+    AOS_CHECK_NE(nullptr, mutex_);
+    AOS_CHECK_NE(0, priority_);
     thread_ = ::std::thread(::std::ref(*this));
   }
 
diff --git a/frc971/wpilib/joystick_sender.cc b/frc971/wpilib/joystick_sender.cc
index a073066..31ecc6c 100644
--- a/frc971/wpilib/joystick_sender.cc
+++ b/frc971/wpilib/joystick_sender.cc
@@ -54,10 +54,10 @@
           if (ds->GetStickPOVCount(i) > 0) {
             new_state->joysticks[i].pov = ds->GetStickPOV(i, 0);
           }
-          LOG_STRUCT(DEBUG, "joystick_state", *new_state);
+          AOS_LOG_STRUCT(DEBUG, "joystick_state", *new_state);
         }
         if (!new_state.Send()) {
-          LOG(WARNING, "sending joystick_state failed\n");
+          AOS_LOG(WARNING, "sending joystick_state failed\n");
         }
       });
     }
diff --git a/frc971/wpilib/loop_output_handler_test.cc b/frc971/wpilib/loop_output_handler_test.cc
index 8a7e903..12c3f96 100644
--- a/frc971/wpilib/loop_output_handler_test.cc
+++ b/frc971/wpilib/loop_output_handler_test.cc
@@ -49,14 +49,14 @@
 
  protected:
   void Write(const LoopOutputHandlerTestOutput &output) override {
-    LOG_STRUCT(DEBUG, "output", output);
+    AOS_LOG_STRUCT(DEBUG, "output", output);
     ++count_;
     last_time_ = event_loop()->monotonic_now();
   }
 
   void Stop() override {
     stop_time_ = event_loop()->monotonic_now();
-    LOG(DEBUG, "Stopping\n");
+    AOS_LOG(DEBUG, "Stopping\n");
   }
 
  private:
@@ -92,7 +92,7 @@
 
           ++count;
         }
-        LOG(INFO, "Ping\n");
+        AOS_LOG(INFO, "Ping\n");
       });
 
   // Kick off the ping timer handler.
diff --git a/frc971/wpilib/pdp_fetcher.cc b/frc971/wpilib/pdp_fetcher.cc
index 98da761..aa85184 100644
--- a/frc971/wpilib/pdp_fetcher.cc
+++ b/frc971/wpilib/pdp_fetcher.cc
@@ -29,7 +29,7 @@
 
 void PDPFetcher::Loop(int iterations) {
   if (iterations != 1) {
-    LOG(DEBUG, "PDPFetcher skipped %d iterations\n", iterations - 1);
+    AOS_LOG(DEBUG, "PDPFetcher skipped %d iterations\n", iterations - 1);
   }
   auto message = pdp_values_sender_.MakeMessage();
   message->voltage = pdp_->GetVoltage();
@@ -38,9 +38,9 @@
   for (int i = 0; i < 16; ++i) {
     message->currents[i] = pdp_->GetCurrent(i);
   }
-  LOG_STRUCT(DEBUG, "got", *message);
+  AOS_LOG_STRUCT(DEBUG, "got", *message);
   if (!message.Send()) {
-    LOG(WARNING, "sending pdp values failed\n");
+    AOS_LOG(WARNING, "sending pdp values failed\n");
   }
 }
 
diff --git a/frc971/wpilib/sensor_reader.cc b/frc971/wpilib/sensor_reader.cc
index 209054b..63d3992 100644
--- a/frc971/wpilib/sensor_reader.cc
+++ b/frc971/wpilib/sensor_reader.cc
@@ -102,9 +102,9 @@
   period_ =
       pwm_trigger_ ? chrono::microseconds(5050) : chrono::microseconds(5000);
   if (pwm_trigger_) {
-    LOG(INFO, "Using PWM trigger and a 5.05 ms period\n");
+    AOS_LOG(INFO, "Using PWM trigger and a 5.05 ms period\n");
   } else {
-    LOG(INFO, "Defaulting to open loop pwm synchronization\n");
+    AOS_LOG(INFO, "Defaulting to open loop pwm synchronization\n");
   }
 
   // Now that we are configured, actually fill in the defaults.
@@ -117,7 +117,7 @@
 
 void SensorReader::Loop(const int iterations) {
   if (iterations != 1) {
-    LOG(WARNING, "SensorReader skipped %d iterations\n", iterations - 1);
+    AOS_LOG(WARNING, "SensorReader skipped %d iterations\n", iterations - 1);
   }
 
   const monotonic_clock::time_point monotonic_now =
@@ -126,7 +126,7 @@
   {
     auto new_state = robot_state_sender_.MakeMessage();
     ::frc971::wpilib::PopulateRobotState(new_state.get(), my_pid_);
-    LOG_STRUCT(DEBUG, "robot_state", *new_state);
+    AOS_LOG_STRUCT(DEBUG, "robot_state", *new_state);
     new_state.Send();
   }
   RunIteration();
@@ -136,8 +136,8 @@
   }
 
   if (pwm_trigger_) {
-    LOG(DEBUG, "PWM wakeup delta: %lld\n",
-        (monotonic_now - last_monotonic_now_).count());
+    AOS_LOG(DEBUG, "PWM wakeup delta: %lld\n",
+            (monotonic_now - last_monotonic_now_).count());
     last_monotonic_now_ = monotonic_now;
 
     monotonic_clock::time_point last_tick_timepoint = GetPWMStartTime();
diff --git a/frc971/wpilib/spi_rx_clearer.cc b/frc971/wpilib/spi_rx_clearer.cc
index dfe7e8b..245f073 100644
--- a/frc971/wpilib/spi_rx_clearer.cc
+++ b/frc971/wpilib/spi_rx_clearer.cc
@@ -11,18 +11,18 @@
 namespace wpilib {
 
 SpiRxClearer::SpiRxClearer() {
-  const int fd = PCHECK(open("/dev/mem", O_RDWR));
+  const int fd = AOS_PCHECK(open("/dev/mem", O_RDWR));
   void *const mmap_result = mmap(nullptr, kMappingSize, PROT_READ | PROT_WRITE,
                                  MAP_SHARED, fd, spi_peripheral_base_);
   if (mmap_result == MAP_FAILED) {
-    PLOG(FATAL, "mmap the SPI peripheral from /dev/mem failed\n");
+    AOS_PLOG(FATAL, "mmap the SPI peripheral from /dev/mem failed\n");
   }
-  PCHECK(close(fd));
+  AOS_PCHECK(close(fd));
   mapping_ = static_cast<volatile uint32_t *>(mmap_result);
 }
 
 SpiRxClearer::~SpiRxClearer() {
-  PCHECK(munmap(const_cast<uint32_t *>(mapping_), kMappingSize));
+  AOS_PCHECK(munmap(const_cast<uint32_t *>(mapping_), kMappingSize));
 }
 
 void SpiRxClearer::ClearRxFifo() {
@@ -34,9 +34,9 @@
       return;
     }
     // Read the next byte.
-    LOG(DEBUG, "Read from RX FIFO: %" PRIx32 "\n", ReadRegister(0x20));
+    AOS_LOG(DEBUG, "Read from RX FIFO: %" PRIx32 "\n", ReadRegister(0x20));
   }
-  LOG(FATAL, "Failed to clear the RX FIFO\n");
+  AOS_LOG(FATAL, "Failed to clear the RX FIFO\n");
 }
 
 }  // namespace wpilib
diff --git a/frc971/wpilib/wpilib_interface.cc b/frc971/wpilib/wpilib_interface.cc
index 851d809..4216e3b 100644
--- a/frc971/wpilib/wpilib_interface.cc
+++ b/frc971/wpilib/wpilib_interface.cc
@@ -23,7 +23,7 @@
   robot_state->voltage_battery = HAL_GetVinVoltage(&status);
 
   if (status != 0) {
-    LOG(FATAL, "Failed to get robot state: %d\n", status);
+    AOS_LOG(FATAL, "Failed to get robot state: %d\n", status);
   }
 }
 
diff --git a/frc971/wpilib/wpilib_robot_base.h b/frc971/wpilib/wpilib_robot_base.h
index ef3ec31..86672c4 100644
--- a/frc971/wpilib/wpilib_robot_base.h
+++ b/frc971/wpilib/wpilib_robot_base.h
@@ -28,7 +28,7 @@
       thread.join();
     }
 
-    LOG(ERROR, "Exiting WPILibRobot\n");
+    AOS_LOG(ERROR, "Exiting WPILibRobot\n");
 
     ::aos::Cleanup();
   }
diff --git a/frc971/zeroing/zeroing.cc b/frc971/zeroing/zeroing.cc
index 1ed98a3..1399efd 100644
--- a/frc971/zeroing/zeroing.cc
+++ b/frc971/zeroing/zeroing.cc
@@ -30,7 +30,7 @@
 
 void PotAndIndexPulseZeroingEstimator::TriggerError() {
   if (!error_) {
-    LOG(ERROR, "Manually triggered zeroing error.\n");
+    AOS_LOG(ERROR, "Manually triggered zeroing error.\n");
     error_ = true;
   }
 }
@@ -98,7 +98,7 @@
     // Save the first starting position.
     if (!zeroed_) {
       first_start_pos_ = offset_;
-      LOG(INFO, "latching start position %f\n", first_start_pos_);
+      AOS_LOG(INFO, "latching start position %f\n", first_start_pos_);
     }
 
     // Now that we have an accurate starting position we can consider ourselves
@@ -109,7 +109,8 @@
     if (::std::abs(first_start_pos_ - offset_) >
         constants_.allowable_encoder_error * constants_.index_difference) {
       if (!error_) {
-        LOG(ERROR,
+        AOS_LOG(
+            ERROR,
             "Encoder ticks out of range since last index pulse. first start "
             "position: %f recent starting position: %f, allowable error: %f\n",
             first_start_pos_, offset_,
@@ -156,7 +157,7 @@
 
 void HallEffectAndPositionZeroingEstimator::TriggerError() {
   if (!error_) {
-    LOG(ERROR, "Manually triggered zeroing error.\n");
+    AOS_LOG(ERROR, "Manually triggered zeroing error.\n");
     error_ = true;
   }
 }
@@ -224,7 +225,7 @@
     // Save the first starting position.
     if (!zeroed_) {
       first_start_pos_ = offset_;
-      LOG(INFO, "latching start position %f\n", first_start_pos_);
+      AOS_LOG(INFO, "latching start position %f\n", first_start_pos_);
     }
 
     // Now that we have an accurate starting position we can consider ourselves
@@ -292,12 +293,12 @@
   // code below. NaN values are given when the Absolute Encoder is disconnected.
   if (::std::isnan(info.absolute_encoder)) {
     if (zeroed_) {
-      LOG(ERROR, "NAN on absolute encoder\n");
+      AOS_LOG(ERROR, "NAN on absolute encoder\n");
       error_ = true;
     } else {
       ++nan_samples_;
-      LOG(ERROR, "NAN on absolute encoder while zeroing %d\n",
-          static_cast<int>(nan_samples_));
+      AOS_LOG(ERROR, "NAN on absolute encoder while zeroing %d\n",
+              static_cast<int>(nan_samples_));
       if (nan_samples_ >= constants_.average_filter_size) {
         error_ = true;
         zeroed_ = true;
@@ -401,11 +402,13 @@
       if (::std::abs(first_offset_ - offset_) >
           constants_.allowable_encoder_error *
               constants_.one_revolution_distance) {
-        LOG(ERROR,
+        AOS_LOG(
+            ERROR,
             "Offset moved too far. Initial: %f, current %f, allowable change: "
             "%f\n",
-            first_offset_, offset_, constants_.allowable_encoder_error *
-                                        constants_.one_revolution_distance);
+            first_offset_, offset_,
+            constants_.allowable_encoder_error *
+                constants_.one_revolution_distance);
         error_ = true;
       }
 
@@ -471,8 +474,9 @@
   const int index_pulse_count = IndexPulseCount();
   if (index_pulse_count > constants_.index_pulse_count) {
     if (!error_) {
-      LOG(ERROR, "Got more index pulses than expected. Got %d expected %d.\n",
-          index_pulse_count, constants_.index_pulse_count);
+      AOS_LOG(ERROR,
+              "Got more index pulses than expected. Got %d expected %d.\n",
+              index_pulse_count, constants_.index_pulse_count);
       error_ = true;
     }
   }
@@ -502,15 +506,15 @@
     // This lets us check if the index pulse is within an acceptable error
     // margin of where we expected it to be.
     if (::std::abs(error) > constants_.allowable_encoder_error) {
-      LOG(ERROR,
-          "Encoder ticks out of range since last index pulse. known index "
-          "pulse: %f, expected index pulse: %f, actual index pulse: %f, "
-          "allowable error: %f\n",
-          constants_.measured_index_position,
-          round(relative_distance) * constants_.index_difference +
+      AOS_LOG(ERROR,
+              "Encoder ticks out of range since last index pulse. known index "
+              "pulse: %f, expected index pulse: %f, actual index pulse: %f, "
+              "allowable error: %f\n",
               constants_.measured_index_position,
-          info.latched_encoder + offset_,
-          constants_.allowable_encoder_error * constants_.index_difference);
+              round(relative_distance) * constants_.index_difference +
+                  constants_.measured_index_position,
+              info.latched_encoder + offset_,
+              constants_.allowable_encoder_error * constants_.index_difference);
       error_ = true;
     }
   }
@@ -568,12 +572,12 @@
   // code below. NaN values are given when the Absolute Encoder is disconnected.
   if (::std::isnan(info.absolute_encoder)) {
     if (zeroed_) {
-      LOG(ERROR, "NAN on absolute encoder\n");
+      AOS_LOG(ERROR, "NAN on absolute encoder\n");
       error_ = true;
     } else {
       ++nan_samples_;
-      LOG(ERROR, "NAN on absolute encoder while zeroing %d\n",
-          static_cast<int>(nan_samples_));
+      AOS_LOG(ERROR, "NAN on absolute encoder while zeroing %d\n",
+              static_cast<int>(nan_samples_));
       if (nan_samples_ >= constants_.average_filter_size) {
         error_ = true;
         zeroed_ = true;
@@ -669,11 +673,13 @@
       if (::std::abs(first_offset_ - offset_) >
           constants_.allowable_encoder_error *
               constants_.one_revolution_distance) {
-        LOG(ERROR,
+        AOS_LOG(
+            ERROR,
             "Offset moved too far. Initial: %f, current %f, allowable change: "
             "%f\n",
-            first_offset_, offset_, constants_.allowable_encoder_error *
-                                        constants_.one_revolution_distance);
+            first_offset_, offset_,
+            constants_.allowable_encoder_error *
+                constants_.one_revolution_distance);
         error_ = true;
       }
 
diff --git a/y2012/joystick_reader.cc b/y2012/joystick_reader.cc
index 8f35b92..460d850 100644
--- a/y2012/joystick_reader.cc
+++ b/y2012/joystick_reader.cc
@@ -113,7 +113,7 @@
     drivetrain_message->quickturn = data.IsPressed(kQuickTurn);
 
     if (!drivetrain_message.Send()) {
-      LOG(WARNING, "sending stick values failed\n");
+      AOS_LOG(WARNING, "sending stick values failed\n");
     }
   }
 
@@ -125,7 +125,7 @@
     accessories_message->sticks[0] = data.GetAxis(kAdjustClawGoal);
     accessories_message->sticks[1] = data.GetAxis(kAdjustClawSeparation);
     if (!accessories_message.Send()) {
-      LOG(WARNING, "sending accessories goal failed\n");
+      AOS_LOG(WARNING, "sending accessories goal failed\n");
     }
   }
 
diff --git a/y2012/wpilib_interface.cc b/y2012/wpilib_interface.cc
index 46f1ec2..a85f096 100644
--- a/y2012/wpilib_interface.cc
+++ b/y2012/wpilib_interface.cc
@@ -149,13 +149,13 @@
 
   void Loop(const int iterations) {
     if (iterations != 1) {
-      LOG(DEBUG, "Solenoids skipped %d iterations\n", iterations - 1);
+      AOS_LOG(DEBUG, "Solenoids skipped %d iterations\n", iterations - 1);
     }
 
     {
       accessories_fetcher_.Fetch();
       if (accessories_fetcher_.get()) {
-        LOG_STRUCT(DEBUG, "solenoids", *accessories_fetcher_);
+        AOS_LOG_STRUCT(DEBUG, "solenoids", *accessories_fetcher_);
         s1_->Set(accessories_fetcher_->solenoids[0]);
         s2_->Set(accessories_fetcher_->solenoids[1]);
         s3_->Set(accessories_fetcher_->solenoids[2]);
@@ -165,7 +165,7 @@
     {
       drivetrain_fetcher_.Fetch();
       if (drivetrain_fetcher_.get()) {
-        LOG_STRUCT(DEBUG, "solenoids", *drivetrain_fetcher_);
+        AOS_LOG_STRUCT(DEBUG, "solenoids", *drivetrain_fetcher_);
         const bool high =
             drivetrain_fetcher_->left_high || drivetrain_fetcher_->right_high;
         drivetrain_high_->Set(high);
@@ -177,7 +177,7 @@
       ::frc971::wpilib::PneumaticsToLog to_log;
       pcm_->Flush();
       to_log.read_solenoids = pcm_->GetAll();
-      LOG_STRUCT(DEBUG, "pneumatics info", to_log);
+      AOS_LOG_STRUCT(DEBUG, "pneumatics info", to_log);
     }
   }
 
@@ -213,11 +213,11 @@
   virtual void Write(const AccessoriesQueue::Message &output) override {
     talon1_->SetSpeed(output.sticks[0]);
     talon2_->SetSpeed(output.sticks[1]);
-    LOG_STRUCT(DEBUG, "will output", output);
+    AOS_LOG_STRUCT(DEBUG, "will output", output);
   }
 
   virtual void Stop() override {
-    LOG(WARNING, "shooter output too old\n");
+    AOS_LOG(WARNING, "shooter output too old\n");
     talon1_->SetDisabled();
     talon2_->SetDisabled();
   }
diff --git a/y2014/actors/autonomous_actor.cc b/y2014/actors/autonomous_actor.cc
index 76a037c..4e2c9aa 100644
--- a/y2014/actors/autonomous_actor.cc
+++ b/y2014/actors/autonomous_actor.cc
@@ -58,7 +58,7 @@
   goal_message->centering = centering_power;
 
   if (!goal_message.Send()) {
-    LOG(WARNING, "sending claw goal failed\n");
+    AOS_LOG(WARNING, "sending claw goal failed\n");
   }
 }
 
@@ -69,7 +69,7 @@
   goal_message->intake = 12.0;
   goal_message->centering = 12.0;
   if (!goal_message.Send()) {
-    LOG(WARNING, "sending claw goal failed\n");
+    AOS_LOG(WARNING, "sending claw goal failed\n");
   }
 }
 
@@ -82,7 +82,7 @@
   goal_message->intake = 4.0;
   goal_message->centering = 1.0;
   if (!goal_message.Send()) {
-    LOG(WARNING, "sending claw goal failed\n");
+    AOS_LOG(WARNING, "sending claw goal failed\n");
   }
 }
 
@@ -93,19 +93,19 @@
   goal_message->intake = 4.0;
   goal_message->centering = 1.0;
   if (!goal_message.Send()) {
-    LOG(WARNING, "sending claw goal failed\n");
+    AOS_LOG(WARNING, "sending claw goal failed\n");
   }
 }
 
 void AutonomousActor::SetShotPower(double power) {
-  LOG(INFO, "Setting shot power to %f\n", power);
+  AOS_LOG(INFO, "Setting shot power to %f\n", power);
   auto goal_message = shooter_goal_sender_.MakeMessage();
   goal_message->shot_power = power;
   goal_message->shot_requested = false;
   goal_message->unload_requested = false;
   goal_message->load_requested = false;
   if (!goal_message.Send()) {
-    LOG(WARNING, "sending shooter goal failed\n");
+    AOS_LOG(WARNING, "sending shooter goal failed\n");
   }
 }
 
@@ -161,10 +161,10 @@
     hot_goal_fetcher_->Fetch();
     if (hot_goal_fetcher_->get()) {
       start_counts_ = *hot_goal_fetcher_->get();
-      LOG_STRUCT(INFO, "counts reset to", start_counts_);
+      AOS_LOG_STRUCT(INFO, "counts reset to", start_counts_);
       start_counts_valid_ = true;
     } else {
-      LOG(WARNING, "no hot goal message. ignoring\n");
+      AOS_LOG(WARNING, "no hot goal message. ignoring\n");
       start_counts_valid_ = false;
     }
   }
@@ -172,7 +172,7 @@
   void Update() {
     hot_goal_fetcher_->Fetch();
     if (hot_goal_fetcher_->get())
-      LOG_STRUCT(INFO, "new counts", *hot_goal_fetcher_->get());
+      AOS_LOG_STRUCT(INFO, "new counts", *hot_goal_fetcher_->get());
   }
 
   bool left_triggered() const {
@@ -250,12 +250,12 @@
   static const double kTurnAngle = 0.3;
 
   const monotonic_clock::time_point start_time = monotonic_now();
-  LOG(INFO, "Handling auto mode\n");
+  AOS_LOG(INFO, "Handling auto mode\n");
 
   AutoVersion auto_version;
   auto_mode_fetcher_.Fetch();
   if (!auto_mode_fetcher_.get()) {
-    LOG(WARNING, "not sure which auto mode to use\n");
+    AOS_LOG(WARNING, "not sure which auto mode to use\n");
     auto_version = AutoVersion::kStraight;
   } else {
     static const double kSelectorMin = 0.2, kSelectorMax = 4.4;
@@ -269,7 +269,8 @@
       auto_version = AutoVersion::kDoubleHot;
     }
   }
-  LOG(INFO, "running auto %" PRIu8 "\n", static_cast<uint8_t>(auto_version));
+  AOS_LOG(INFO, "running auto %" PRIu8 "\n",
+          static_cast<uint8_t>(auto_version));
 
   const ProfileParameters &drive_params =
       (auto_version == AutoVersion::kStraight) ? kFastDrive : kSlowDrive;
@@ -284,37 +285,37 @@
   Reset();
 
   // Turn the claw on, keep it straight up until the ball has been grabbed.
-  LOG(INFO, "Claw going up at %f\n",
-      ::aos::time::DurationInSeconds(monotonic_now() - start_time));
+  AOS_LOG(INFO, "Claw going up at %f\n",
+          ::aos::time::DurationInSeconds(monotonic_now() - start_time));
   PositionClawVertically(12.0, 4.0);
   SetShotPower(115.0);
 
   // Wait for the ball to enter the claw.
   this_thread::sleep_for(chrono::milliseconds(250));
   if (ShouldCancel()) return true;
-  LOG(INFO, "Readying claw for shot at %f\n",
-      ::aos::time::DurationInSeconds(monotonic_now() - start_time));
+  AOS_LOG(INFO, "Readying claw for shot at %f\n",
+          ::aos::time::DurationInSeconds(monotonic_now() - start_time));
 
   if (ShouldCancel()) return true;
   // Drive to the goal.
   StartDrive(-kShootDistance, 0.0, drive_params, kFastTurn);
   this_thread::sleep_for(chrono::milliseconds(750));
   PositionClawForShot();
-  LOG(INFO, "Waiting until drivetrain is finished\n");
+  AOS_LOG(INFO, "Waiting until drivetrain is finished\n");
   WaitForDriveProfileDone();
   if (ShouldCancel()) return true;
 
   hot_goal_decoder.Update();
   if (hot_goal_decoder.is_left()) {
-    LOG(INFO, "first shot left\n");
+    AOS_LOG(INFO, "first shot left\n");
     first_shot_left = true;
     second_shot_left_default = false;
   } else if (hot_goal_decoder.is_right()) {
-    LOG(INFO, "first shot right\n");
+    AOS_LOG(INFO, "first shot right\n");
     first_shot_left = false;
     second_shot_left_default = true;
   } else {
-    LOG(INFO, "first shot defaulting left\n");
+    AOS_LOG(INFO, "first shot defaulting left\n");
     first_shot_left = true;
     second_shot_left_default = true;
   }
@@ -337,8 +338,8 @@
   }
 
   // Shoot.
-  LOG(INFO, "Shooting at %f\n",
-      ::aos::time::DurationInSeconds(monotonic_now() - start_time));
+  AOS_LOG(INFO, "Shooting at %f\n",
+          ::aos::time::DurationInSeconds(monotonic_now() - start_time));
   Shoot();
   this_thread::sleep_for(chrono::milliseconds(50));
 
@@ -349,8 +350,8 @@
     WaitForDriveProfileDone();
     if (ShouldCancel()) return true;
   } else if (auto_version == AutoVersion::kSingleHot) {
-    LOG(INFO, "auto done at %f\n",
-        ::aos::time::DurationInSeconds(monotonic_now() - start_time));
+    AOS_LOG(INFO, "auto done at %f\n",
+            ::aos::time::DurationInSeconds(monotonic_now() - start_time));
     PositionClawVertically(0.0, 0.0);
     return true;
   }
@@ -358,22 +359,22 @@
   {
     if (ShouldCancel()) return true;
     // Intake the new ball.
-    LOG(INFO, "Claw ready for intake at %f\n",
-        ::aos::time::DurationInSeconds(monotonic_now() - start_time));
+    AOS_LOG(INFO, "Claw ready for intake at %f\n",
+            ::aos::time::DurationInSeconds(monotonic_now() - start_time));
     PositionClawBackIntake();
     StartDrive(kShootDistance + kPickupDistance, 0.0, drive_params, kFastTurn);
-    LOG(INFO, "Waiting until drivetrain is finished\n");
+    AOS_LOG(INFO, "Waiting until drivetrain is finished\n");
     WaitForDriveProfileDone();
     if (ShouldCancel()) return true;
-    LOG(INFO, "Wait for the claw at %f\n",
-        ::aos::time::DurationInSeconds(monotonic_now() - start_time));
+    AOS_LOG(INFO, "Wait for the claw at %f\n",
+            ::aos::time::DurationInSeconds(monotonic_now() - start_time));
     if (!WaitUntilClawDone()) return true;
   }
 
   // Drive back.
   {
-    LOG(INFO, "Driving back at %f\n",
-        ::aos::time::DurationInSeconds(monotonic_now() - start_time));
+    AOS_LOG(INFO, "Driving back at %f\n",
+            ::aos::time::DurationInSeconds(monotonic_now() - start_time));
     StartDrive(-(kShootDistance + kPickupDistance), 0.0, drive_params,
                kFastTurn);
     this_thread::sleep_for(chrono::milliseconds(300));
@@ -382,7 +383,7 @@
     PositionClawUpClosed();
     if (!WaitUntilClawDone()) return true;
     PositionClawForShot();
-    LOG(INFO, "Waiting until drivetrain is finished\n");
+    AOS_LOG(INFO, "Waiting until drivetrain is finished\n");
     WaitForDriveProfileDone();
     if (ShouldCancel()) return true;
     if (!WaitUntilClawDone()) return true;
@@ -390,14 +391,14 @@
 
   hot_goal_decoder.Update();
   if (hot_goal_decoder.is_left()) {
-    LOG(INFO, "second shot left\n");
+    AOS_LOG(INFO, "second shot left\n");
     second_shot_left = true;
   } else if (hot_goal_decoder.is_right()) {
-    LOG(INFO, "second shot right\n");
+    AOS_LOG(INFO, "second shot right\n");
     second_shot_left = false;
   } else {
-    LOG(INFO, "second shot defaulting %s\n",
-        second_shot_left_default ? "left" : "right");
+    AOS_LOG(INFO, "second shot defaulting %s\n",
+            second_shot_left_default ? "left" : "right");
     second_shot_left = second_shot_left_default;
   }
   if (auto_version == AutoVersion::kDoubleHot) {
@@ -410,8 +411,8 @@
     this_thread::sleep_for(chrono::milliseconds(400));
   }
 
-  LOG(INFO, "Shooting at %f\n",
-      ::aos::time::DurationInSeconds(monotonic_now() - start_time));
+  AOS_LOG(INFO, "Shooting at %f\n",
+          ::aos::time::DurationInSeconds(monotonic_now() - start_time));
   // Shoot
   Shoot();
   if (ShouldCancel()) return true;
diff --git a/y2014/actors/shoot_actor.cc b/y2014/actors/shoot_actor.cc
index 736632d..7fb4c05 100644
--- a/y2014/actors/shoot_actor.cc
+++ b/y2014/actors/shoot_actor.cc
@@ -47,7 +47,7 @@
 bool ShootActor::IntakeOff() {
   claw_goal_fetcher_.Fetch();
   if (!claw_goal_fetcher_.get()) {
-    LOG(WARNING, "no claw goal\n");
+    AOS_LOG(WARNING, "no claw goal\n");
     // If it doesn't have a goal, then the intake isn't on so we don't have to
     // turn it off.
     return true;
@@ -60,7 +60,7 @@
     goal_message->centering = 0.0;
 
     if (!goal_message.Send()) {
-      LOG(WARNING, "sending claw goal failed\n");
+      AOS_LOG(WARNING, "sending claw goal failed\n");
       return false;
     }
   }
@@ -82,16 +82,16 @@
   goal_message->unload_requested = false;
   goal_message->load_requested = false;
   if (!goal_message.Send()) {
-    LOG(WARNING, "sending shooter goal failed\n");
+    AOS_LOG(WARNING, "sending shooter goal failed\n");
     return false;
   }
 
-  LOG(INFO, "finished\n");
+  AOS_LOG(INFO, "finished\n");
   return true;
 }
 
 void ShootActor::InnerRunAction() {
-  LOG(INFO, "Shooting at the current angle and power.\n");
+  AOS_LOG(INFO, "Shooting at the current angle and power.\n");
 
   // wait for claw to be ready
   if (WaitUntil(::std::bind(&ShootActor::DoneSetupShot, this))) {
@@ -114,7 +114,7 @@
     goal_message->unload_requested = false;
     goal_message->load_requested = false;
     if (!goal_message.Send()) {
-      LOG(WARNING, "sending shooter goal failed\n");
+      AOS_LOG(WARNING, "sending shooter goal failed\n");
       return;
     }
   }
@@ -134,25 +134,26 @@
                          claw_goal_fetcher_->bottom_angle) < 0.10) &&
              (::std::abs(claw_status_fetcher_->separation -
                          claw_goal_fetcher_->separation_angle) < 0.4);
-  LOG(DEBUG, "Claw is %sready zeroed %d bottom_velocity %f bottom %f sep %f\n",
-      ans ? "" : "not ", claw_status_fetcher_->zeroed,
-      ::std::abs(claw_status_fetcher_->bottom_velocity),
-      ::std::abs(claw_status_fetcher_->bottom -
-                 claw_goal_fetcher_->bottom_angle),
-      ::std::abs(claw_status_fetcher_->separation -
-                 claw_goal_fetcher_->separation_angle));
+  AOS_LOG(DEBUG,
+          "Claw is %sready zeroed %d bottom_velocity %f bottom %f sep %f\n",
+          ans ? "" : "not ", claw_status_fetcher_->zeroed,
+          ::std::abs(claw_status_fetcher_->bottom_velocity),
+          ::std::abs(claw_status_fetcher_->bottom -
+                     claw_goal_fetcher_->bottom_angle),
+          ::std::abs(claw_status_fetcher_->separation -
+                     claw_goal_fetcher_->separation_angle));
   return ans;
 }
 
 bool ShootActor::ShooterIsReady() {
   shooter_goal_fetcher_.Fetch();
 
-  LOG(DEBUG, "Power error is %f - %f -> %f, ready %d\n",
-      shooter_status_fetcher_->hard_stop_power,
-      shooter_goal_fetcher_->shot_power,
-      ::std::abs(shooter_status_fetcher_->hard_stop_power -
-                 shooter_goal_fetcher_->shot_power),
-      shooter_status_fetcher_->ready);
+  AOS_LOG(DEBUG, "Power error is %f - %f -> %f, ready %d\n",
+          shooter_status_fetcher_->hard_stop_power,
+          shooter_goal_fetcher_->shot_power,
+          ::std::abs(shooter_status_fetcher_->hard_stop_power -
+                     shooter_goal_fetcher_->shot_power),
+          shooter_status_fetcher_->ready);
   return (::std::abs(shooter_status_fetcher_->hard_stop_power -
                      shooter_goal_fetcher_->shot_power) < 1.0) &&
          shooter_status_fetcher_->ready;
@@ -164,7 +165,7 @@
   // Make sure that both the shooter and claw have reached the necessary
   // states.
   if (ShooterIsReady() && ClawIsReady()) {
-    LOG(INFO, "Claw and Shooter ready for shooting.\n");
+    AOS_LOG(INFO, "Claw and Shooter ready for shooting.\n");
     return true;
   }
 
@@ -174,7 +175,7 @@
 bool ShootActor::DonePreShotOpen() {
   claw_status_fetcher_.Fetch();
   if (claw_status_fetcher_->separation > kClawShootingSeparation) {
-    LOG(INFO, "Opened up enough to shoot.\n");
+    AOS_LOG(INFO, "Opened up enough to shoot.\n");
     return true;
   }
   return false;
@@ -184,7 +185,7 @@
   shooter_status_fetcher_.Fetch();
   if (shooter_status_fetcher_.get() &&
       shooter_status_fetcher_->shots > previous_shots_) {
-    LOG(INFO, "Shot succeeded!\n");
+    AOS_LOG(INFO, "Shot succeeded!\n");
     return true;
   }
   return false;
diff --git a/y2014/constants.cc b/y2014/constants.cc
index 6981e48..19be8f9 100644
--- a/y2014/constants.cc
+++ b/y2014/constants.cc
@@ -178,13 +178,13 @@
       };
       break;
     default:
-      LOG(FATAL, "unknown team #%" PRIu16 "\n", team);
+      AOS_LOG(FATAL, "unknown team #%" PRIu16 "\n", team);
   }
 }
 
 const Values *DoGetValues() {
   uint16_t team = ::aos::network::GetTeamNumber();
-  LOG(INFO, "creating a Constants for team %" PRIu16 "\n", team);
+  AOS_LOG(INFO, "creating a Constants for team %" PRIu16 "\n", team);
   return DoGetValuesForTeam(team);
 }
 
diff --git a/y2014/control_loops/claw/claw.cc b/y2014/control_loops/claw/claw.cc
index 7a28a23..14dbf11 100644
--- a/y2014/control_loops/claw/claw.cc
+++ b/y2014/control_loops/claw/claw.cc
@@ -94,7 +94,7 @@
   double max_voltage = is_zeroing_ ? kZeroingVoltage : kMaxVoltage;
 
   if (::std::abs(u_bottom) > max_voltage || ::std::abs(u_top) > max_voltage) {
-    LOG_MATRIX(DEBUG, "U at start", U());
+    AOS_LOG_MATRIX(DEBUG, "U at start", U());
     // H * U <= k
     // U = UPos + UVel
     // H * (UPos + UVel) <= k
@@ -116,7 +116,7 @@
     position_error << error(0, 0), error(1, 0);
     Eigen::Matrix<double, 2, 1> velocity_error;
     velocity_error << error(2, 0), error(3, 0);
-    LOG_MATRIX(DEBUG, "error", error);
+    AOS_LOG_MATRIX(DEBUG, "error", error);
 
     const auto &poly = is_zeroing_ ? U_Poly_zeroing_ : U_Poly_;
     const Eigen::Matrix<double, 4, 2> pos_poly_H = poly.H() * position_K;
@@ -183,28 +183,28 @@
       }
     }
 
-    LOG_MATRIX(DEBUG, "adjusted_pos_error", adjusted_pos_error);
+    AOS_LOG_MATRIX(DEBUG, "adjusted_pos_error", adjusted_pos_error);
     mutable_U() = velocity_K * velocity_error + position_K * adjusted_pos_error;
-    LOG_MATRIX(DEBUG, "U is now", U());
+    AOS_LOG_MATRIX(DEBUG, "U is now", U());
 
     {
       const auto values = constants::GetValues().claw;
       if (top_known_) {
         if (X_hat(0, 0) + X_hat(1, 0) > values.upper_claw.upper_limit && U(1, 0) > 0) {
-          LOG(WARNING, "upper claw too high and moving up\n");
+          AOS_LOG(WARNING, "upper claw too high and moving up\n");
           mutable_U(1, 0) = 0;
         } else if (X_hat(0, 0) + X_hat(1, 0) < values.upper_claw.lower_limit &&
                    U(1, 0) < 0) {
-          LOG(WARNING, "upper claw too low and moving down\n");
+          AOS_LOG(WARNING, "upper claw too low and moving down\n");
           mutable_U(1, 0) = 0;
         }
       }
       if (bottom_known_) {
         if (X_hat(0, 0) > values.lower_claw.upper_limit && U(0, 0) > 0) {
-          LOG(WARNING, "lower claw too high and moving up\n");
+          AOS_LOG(WARNING, "lower claw too high and moving up\n");
           mutable_U(0, 0) = 0;
         } else if (X_hat(0, 0) < values.lower_claw.lower_limit && U(0, 0) < 0) {
-          LOG(WARNING, "lower claw too low and moving down\n");
+          AOS_LOG(WARNING, "lower claw too low and moving down\n");
           mutable_U(0, 0) = 0;
         }
       }
@@ -318,7 +318,7 @@
   double edge_encoder;
   double edge_angle;
   if (GetPositionOfEdge(claw_values, &edge_encoder, &edge_angle)) {
-    LOG(INFO, "Calibration edge edge should be %f.\n", edge_angle);
+    AOS_LOG(INFO, "Calibration edge edge should be %f.\n", edge_angle);
     SetCalibration(edge_encoder, edge_angle);
     set_zeroing_state(zeroing_state);
     return true;
@@ -333,9 +333,9 @@
   if (GetPositionOfEdge(claw_values, &edge_encoder, &edge_angle)) {
     const double calibration_error =
         ComputeCalibrationChange(edge_encoder, edge_angle);
-    LOG(INFO, "Top calibration error is %f\n", calibration_error);
+    AOS_LOG(INFO, "Top calibration error is %f\n", calibration_error);
     if (::std::abs(calibration_error) > kRezeroThreshold) {
-      LOG(WARNING, "rezeroing top\n");
+      AOS_LOG(WARNING, "rezeroing top\n");
       SetCalibration(edge_encoder, edge_angle);
       set_zeroing_state(ZeroedStateFeedbackLoop::UNKNOWN_POSITION);
     }
@@ -350,9 +350,9 @@
   if (GetPositionOfEdge(claw_values, &edge_encoder, &edge_angle)) {
     const double calibration_error =
         ComputeCalibrationChange(edge_encoder, edge_angle);
-    LOG(INFO, "Bottom calibration error is %f\n", calibration_error);
+    AOS_LOG(INFO, "Bottom calibration error is %f\n", calibration_error);
     if (::std::abs(calibration_error) > kRezeroThreshold) {
-      LOG(WARNING, "rezeroing bottom\n");
+      AOS_LOG(WARNING, "rezeroing bottom\n");
       SetCalibration(edge_encoder, edge_angle);
       set_zeroing_state(ZeroedStateFeedbackLoop::UNKNOWN_POSITION);
     }
@@ -365,7 +365,7 @@
   double edge_encoder;
   double edge_angle;
   if (GetPositionOfEdge(claw_values, &edge_encoder, &edge_angle)) {
-    LOG(INFO, "Calibration edge.\n");
+    AOS_LOG(INFO, "Calibration edge.\n");
     SetCalibration(edge_encoder, edge_angle);
     set_zeroing_state(zeroing_state);
     return true;
@@ -437,20 +437,22 @@
 
   if (SawFilteredPosedge(this_sensor, sensorA, sensorB)) {
     if (min_hall_effect_off_angle_ == max_hall_effect_off_angle_) {
-      LOG(WARNING, "%s: Uncertain which side, rejecting posedge\n", name_);
+      AOS_LOG(WARNING, "%s: Uncertain which side, rejecting posedge\n", name_);
     } else {
       const double average_last_encoder =
           (min_hall_effect_off_angle_ + max_hall_effect_off_angle_) / 2.0;
       if (this_sensor.posedge_value() < average_last_encoder) {
         *edge_angle = angles.upper_decreasing_angle;
-        LOG(INFO, "%s Posedge upper of %s -> %f posedge: %f avg_encoder: %f\n",
-            name_, hall_effect_name, *edge_angle, this_sensor.posedge_value(),
-            average_last_encoder);
+        AOS_LOG(INFO,
+                "%s Posedge upper of %s -> %f posedge: %f avg_encoder: %f\n",
+                name_, hall_effect_name, *edge_angle,
+                this_sensor.posedge_value(), average_last_encoder);
       } else {
         *edge_angle = angles.lower_angle;
-        LOG(INFO, "%s Posedge lower of %s -> %f posedge: %f avg_encoder: %f\n",
-            name_, hall_effect_name, *edge_angle, this_sensor.posedge_value(),
-            average_last_encoder);
+        AOS_LOG(INFO,
+                "%s Posedge lower of %s -> %f posedge: %f avg_encoder: %f\n",
+                name_, hall_effect_name, *edge_angle,
+                this_sensor.posedge_value(), average_last_encoder);
       }
       *edge_encoder = this_sensor.posedge_value();
       found_edge = true;
@@ -459,20 +461,22 @@
 
   if (SawFilteredNegedge(this_sensor, sensorA, sensorB)) {
     if (min_hall_effect_on_angle_ == max_hall_effect_on_angle_) {
-      LOG(WARNING, "%s: Uncertain which side, rejecting negedge\n", name_);
+      AOS_LOG(WARNING, "%s: Uncertain which side, rejecting negedge\n", name_);
     } else {
       const double average_last_encoder =
           (min_hall_effect_on_angle_ + max_hall_effect_on_angle_) / 2.0;
       if (this_sensor.negedge_value() > average_last_encoder) {
         *edge_angle = angles.upper_angle;
-        LOG(INFO, "%s Negedge upper of %s -> %f negedge: %f avg_encoder: %f\n",
-            name_, hall_effect_name, *edge_angle, this_sensor.negedge_value(),
-            average_last_encoder);
+        AOS_LOG(INFO,
+                "%s Negedge upper of %s -> %f negedge: %f avg_encoder: %f\n",
+                name_, hall_effect_name, *edge_angle,
+                this_sensor.negedge_value(), average_last_encoder);
       } else {
         *edge_angle = angles.lower_decreasing_angle;
-        LOG(INFO, "%s Negedge lower of %s -> %f negedge: %f avg_encoder: %f\n",
-            name_, hall_effect_name, *edge_angle, this_sensor.negedge_value(),
-            average_last_encoder);
+        AOS_LOG(INFO,
+                "%s Negedge lower of %s -> %f negedge: %f avg_encoder: %f\n",
+                name_, hall_effect_name, *edge_angle,
+                this_sensor.negedge_value(), average_last_encoder);
       }
       *edge_encoder = this_sensor.negedge_value();
       found_edge = true;
@@ -546,12 +550,12 @@
 
 void ClawLimitedLoop::ChangeTopOffset(double doffset) {
   mutable_X_hat()(1, 0) += doffset;
-  LOG(INFO, "Changing top offset by %f\n", doffset);
+  AOS_LOG(INFO, "Changing top offset by %f\n", doffset);
 }
 void ClawLimitedLoop::ChangeBottomOffset(double doffset) {
   mutable_X_hat()(0, 0) += doffset;
   mutable_X_hat()(1, 0) -= doffset;
-  LOG(INFO, "Changing bottom offset by %f\n", doffset);
+  AOS_LOG(INFO, "Changing bottom offset by %f\n", doffset);
 }
 
 void LimitClawGoal(double *bottom_goal, double *top_goal,
@@ -559,45 +563,45 @@
   // first update position based on angle limit
   const double separation = *top_goal - *bottom_goal;
   if (separation > values.claw.soft_max_separation) {
-    LOG_STRUCT(DEBUG, "before", ClawPositionToLog(*top_goal, *bottom_goal));
+    AOS_LOG_STRUCT(DEBUG, "before", ClawPositionToLog(*top_goal, *bottom_goal));
     const double dsep = (separation - values.claw.soft_max_separation) / 2.0;
     *bottom_goal += dsep;
     *top_goal -= dsep;
-    LOG_STRUCT(DEBUG, "after", ClawPositionToLog(*top_goal, *bottom_goal));
+    AOS_LOG_STRUCT(DEBUG, "after", ClawPositionToLog(*top_goal, *bottom_goal));
   }
   if (separation < values.claw.soft_min_separation) {
-    LOG_STRUCT(DEBUG, "before", ClawPositionToLog(*top_goal, *bottom_goal));
+    AOS_LOG_STRUCT(DEBUG, "before", ClawPositionToLog(*top_goal, *bottom_goal));
     const double dsep = (separation - values.claw.soft_min_separation) / 2.0;
     *bottom_goal += dsep;
     *top_goal -= dsep;
-    LOG_STRUCT(DEBUG, "after", ClawPositionToLog(*top_goal, *bottom_goal));
+    AOS_LOG_STRUCT(DEBUG, "after", ClawPositionToLog(*top_goal, *bottom_goal));
   }
 
   // now move both goals in unison
   if (*bottom_goal < values.claw.lower_claw.lower_limit) {
-    LOG_STRUCT(DEBUG, "before", ClawPositionToLog(*top_goal, *bottom_goal));
+    AOS_LOG_STRUCT(DEBUG, "before", ClawPositionToLog(*top_goal, *bottom_goal));
     *top_goal += values.claw.lower_claw.lower_limit - *bottom_goal;
     *bottom_goal = values.claw.lower_claw.lower_limit;
-    LOG_STRUCT(DEBUG, "after", ClawPositionToLog(*top_goal, *bottom_goal));
+    AOS_LOG_STRUCT(DEBUG, "after", ClawPositionToLog(*top_goal, *bottom_goal));
   }
   if (*bottom_goal > values.claw.lower_claw.upper_limit) {
-    LOG_STRUCT(DEBUG, "before", ClawPositionToLog(*top_goal, *bottom_goal));
+    AOS_LOG_STRUCT(DEBUG, "before", ClawPositionToLog(*top_goal, *bottom_goal));
     *top_goal -= *bottom_goal - values.claw.lower_claw.upper_limit;
     *bottom_goal = values.claw.lower_claw.upper_limit;
-    LOG_STRUCT(DEBUG, "after", ClawPositionToLog(*top_goal, *bottom_goal));
+    AOS_LOG_STRUCT(DEBUG, "after", ClawPositionToLog(*top_goal, *bottom_goal));
   }
 
   if (*top_goal < values.claw.upper_claw.lower_limit) {
-    LOG_STRUCT(DEBUG, "before", ClawPositionToLog(*top_goal, *bottom_goal));
+    AOS_LOG_STRUCT(DEBUG, "before", ClawPositionToLog(*top_goal, *bottom_goal));
     *bottom_goal += values.claw.upper_claw.lower_limit - *top_goal;
     *top_goal = values.claw.upper_claw.lower_limit;
-    LOG_STRUCT(DEBUG, "after", ClawPositionToLog(*top_goal, *bottom_goal));
+    AOS_LOG_STRUCT(DEBUG, "after", ClawPositionToLog(*top_goal, *bottom_goal));
   }
   if (*top_goal > values.claw.upper_claw.upper_limit) {
-    LOG_STRUCT(DEBUG, "before", ClawPositionToLog(*top_goal, *bottom_goal));
+    AOS_LOG_STRUCT(DEBUG, "before", ClawPositionToLog(*top_goal, *bottom_goal));
     *bottom_goal -= *top_goal - values.claw.upper_claw.upper_limit;
     *top_goal = values.claw.upper_claw.upper_limit;
-    LOG_STRUCT(DEBUG, "after", ClawPositionToLog(*top_goal, *bottom_goal));
+    AOS_LOG_STRUCT(DEBUG, "after", ClawPositionToLog(*top_goal, *bottom_goal));
   }
 }
 
@@ -667,9 +671,9 @@
       initial_separation_ =
           top_claw_.absolute_position() - bottom_claw_.absolute_position();
     }
-    LOG_STRUCT(DEBUG, "absolute position",
-               ClawPositionToLog(top_claw_.absolute_position(),
-                                 bottom_claw_.absolute_position()));
+    AOS_LOG_STRUCT(DEBUG, "absolute position",
+                   ClawPositionToLog(top_claw_.absolute_position(),
+                                     bottom_claw_.absolute_position()));
   }
 
   bool autonomous, enabled;
@@ -717,7 +721,7 @@
     }
     if (bottom_claw_.zeroing_state() != ZeroedStateFeedbackLoop::CALIBRATED) {
       // always get the bottom claw to calibrated first
-      LOG(DEBUG, "Calibrating the bottom of the claw\n");
+      AOS_LOG(DEBUG, "Calibrating the bottom of the claw\n");
       if (!doing_calibration_fine_tune_) {
         if (::std::abs(bottom_absolute_position() -
                        values.claw.start_fine_tune_pos) <
@@ -726,12 +730,12 @@
           bottom_claw_goal_ += values.claw.claw_zeroing_speed * kDt;
           top_claw_velocity_ = bottom_claw_velocity_ =
               values.claw.claw_zeroing_speed;
-          LOG(DEBUG, "Ready to fine tune the bottom\n");
+          AOS_LOG(DEBUG, "Ready to fine tune the bottom\n");
           mode_ = FINE_TUNE_BOTTOM;
         } else {
           // send bottom to zeroing start
           bottom_claw_goal_ = values.claw.start_fine_tune_pos;
-          LOG(DEBUG, "Going to the start position for the bottom\n");
+          AOS_LOG(DEBUG, "Going to the start position for the bottom\n");
           mode_ = PREP_FINE_TUNE_BOTTOM;
         }
       } else {
@@ -746,7 +750,7 @@
           doing_calibration_fine_tune_ = false;
           bottom_claw_goal_ = values.claw.start_fine_tune_pos;
           top_claw_velocity_ = bottom_claw_velocity_ = 0.0;
-          LOG(DEBUG, "Found a limit, starting over.\n");
+          AOS_LOG(DEBUG, "Found a limit, starting over.\n");
           mode_ = PREP_FINE_TUNE_BOTTOM;
         }
 
@@ -760,14 +764,15 @@
           bottom_claw_.set_zeroing_state(ZeroedStateFeedbackLoop::CALIBRATED);
           // calibrated so we are done fine tuning bottom
           doing_calibration_fine_tune_ = false;
-          LOG(DEBUG, "Calibrated the bottom correctly!\n");
+          AOS_LOG(DEBUG, "Calibrated the bottom correctly!\n");
         } else if (bottom_claw_.calibration().last_value()) {
-          LOG(DEBUG, "Aborting bottom fine tune because sensor triggered\n");
+          AOS_LOG(DEBUG,
+                  "Aborting bottom fine tune because sensor triggered\n");
           doing_calibration_fine_tune_ = false;
           bottom_claw_.set_zeroing_state(
               ZeroedStateFeedbackLoop::UNKNOWN_POSITION);
         } else {
-          LOG(DEBUG, "Fine tuning\n");
+          AOS_LOG(DEBUG, "Fine tuning\n");
         }
       }
       // now set the top claw to track
@@ -783,12 +788,12 @@
           top_claw_goal_ += values.claw.claw_zeroing_speed * kDt;
           top_claw_velocity_ = bottom_claw_velocity_ =
               values.claw.claw_zeroing_speed;
-          LOG(DEBUG, "Ready to fine tune the top\n");
+          AOS_LOG(DEBUG, "Ready to fine tune the top\n");
           mode_ = FINE_TUNE_TOP;
         } else {
           // send top to zeroing start
           top_claw_goal_ = values.claw.start_fine_tune_pos;
-          LOG(DEBUG, "Going to the start position for the top\n");
+          AOS_LOG(DEBUG, "Going to the start position for the top\n");
           mode_ = PREP_FINE_TUNE_TOP;
         }
       } else {
@@ -802,7 +807,7 @@
           doing_calibration_fine_tune_ = false;
           top_claw_goal_ = values.claw.start_fine_tune_pos;
           top_claw_velocity_ = bottom_claw_velocity_ = 0.0;
-          LOG(DEBUG, "Found a limit, starting over.\n");
+          AOS_LOG(DEBUG, "Found a limit, starting over.\n");
           mode_ = PREP_FINE_TUNE_TOP;
         }
 
@@ -816,9 +821,9 @@
           top_claw_.set_zeroing_state(ZeroedStateFeedbackLoop::CALIBRATED);
           // calibrated so we are done fine tuning top
           doing_calibration_fine_tune_ = false;
-          LOG(DEBUG, "Calibrated the top correctly!\n");
+          AOS_LOG(DEBUG, "Calibrated the top correctly!\n");
         } else if (top_claw_.calibration().last_value()) {
-          LOG(DEBUG, "Aborting top fine tune because sensor triggered\n");
+          AOS_LOG(DEBUG, "Aborting top fine tune because sensor triggered\n");
           doing_calibration_fine_tune_ = false;
           top_claw_.set_zeroing_state(
               ZeroedStateFeedbackLoop::UNKNOWN_POSITION);
@@ -852,7 +857,7 @@
         bottom_claw_goal_ += values.claw.claw_zeroing_off_speed * kDt;
         top_claw_velocity_ = bottom_claw_velocity_ =
             values.claw.claw_zeroing_off_speed;
-        LOG(DEBUG, "Bottom is known.\n");
+        AOS_LOG(DEBUG, "Bottom is known.\n");
       }
     } else {
       // We don't know where either claw is.  Slowly start moving down to find
@@ -862,7 +867,7 @@
         bottom_claw_goal_ -= values.claw.claw_zeroing_off_speed * kDt;
         top_claw_velocity_ = bottom_claw_velocity_ =
             -values.claw.claw_zeroing_off_speed;
-        LOG(DEBUG, "Both are unknown.\n");
+        AOS_LOG(DEBUG, "Both are unknown.\n");
       }
     }
 
@@ -902,7 +907,7 @@
   if (has_top_claw_goal_ && has_bottom_claw_goal_) {
     claw_.mutable_R() << bottom_claw_goal_, top_claw_goal_ - bottom_claw_goal_,
         bottom_claw_velocity_, top_claw_velocity_ - bottom_claw_velocity_;
-    LOG_MATRIX(DEBUG, "actual goal", claw_.R());
+    AOS_LOG_MATRIX(DEBUG, "actual goal", claw_.R());
 
     // Only cap power when one of the halves of the claw is moving slowly and
     // could wind up.
@@ -937,12 +942,13 @@
             claw_.R(3, 0);
         claw_.mutable_U() = claw_.controller().K() * (R - claw_.X_hat());
         capped_goal_ = true;
-        LOG(DEBUG, "Moving the goal by %f to prevent windup."
-            " Uncapped is %f, max is %f, difference is %f\n",
-            dx,
-            claw_.uncapped_average_voltage(), values.claw.max_zeroing_voltage,
-            (claw_.uncapped_average_voltage() -
-             values.claw.max_zeroing_voltage));
+        AOS_LOG(DEBUG,
+                "Moving the goal by %f to prevent windup."
+                " Uncapped is %f, max is %f, difference is %f\n",
+                dx, claw_.uncapped_average_voltage(),
+                values.claw.max_zeroing_voltage,
+                (claw_.uncapped_average_voltage() -
+                 values.claw.max_zeroing_voltage));
       } else if (claw_.uncapped_average_voltage() <
                  -values.claw.max_zeroing_voltage) {
         double dx_bot =
@@ -959,7 +965,7 @@
             claw_.R(3, 0);
         claw_.mutable_U() = claw_.controller().K() * (R - claw_.X_hat());
         capped_goal_ = true;
-        LOG(DEBUG, "Moving the goal by %f to prevent windup\n", dx);
+        AOS_LOG(DEBUG, "Moving the goal by %f to prevent windup\n", dx);
       }
     } break;
   }
diff --git a/y2014/control_loops/claw/claw_lib_test.cc b/y2014/control_loops/claw/claw_lib_test.cc
index c88daa8..41dbfca 100644
--- a/y2014/control_loops/claw/claw_lib_test.cc
+++ b/y2014/control_loops/claw/claw_lib_test.cc
@@ -59,8 +59,8 @@
 
   void Reinitialize(double initial_top_position,
                     double initial_bottom_position) {
-    LOG(INFO, "Reinitializing to {top: %f, bottom: %f}\n", initial_top_position,
-        initial_bottom_position);
+    AOS_LOG(INFO, "Reinitializing to {top: %f, bottom: %f}\n",
+            initial_top_position, initial_bottom_position);
     claw_plant_->mutable_X(0, 0) = initial_bottom_position;
     claw_plant_->mutable_X(1, 0) = initial_top_position - initial_bottom_position;
     claw_plant_->mutable_X(2, 0) = 0.0;
@@ -120,8 +120,8 @@
 
     double pos[2] = {GetAbsolutePosition(TOP_CLAW),
                      GetAbsolutePosition(BOTTOM_CLAW)};
-    LOG(DEBUG, "Physical claws are at {top: %f, bottom: %f}\n", pos[TOP_CLAW],
-        pos[BOTTOM_CLAW]);
+    AOS_LOG(DEBUG, "Physical claws are at {top: %f, bottom: %f}\n",
+            pos[TOP_CLAW], pos[BOTTOM_CLAW]);
 
     const constants::Values& values = constants::GetValues();
 
@@ -143,12 +143,12 @@
       ++position->posedge_count;
 
       if (last_angle < pair.lower_angle) {
-        LOG(DEBUG, "%s: Positive lower edge on %s hall effect\n", claw_name,
-            hall_effect_name);
+        AOS_LOG(DEBUG, "%s: Positive lower edge on %s hall effect\n", claw_name,
+                hall_effect_name);
         position->posedge_value = pair.lower_angle - initial_position;
       } else {
-        LOG(DEBUG, "%s: Positive upper edge on %s hall effect\n", claw_name,
-            hall_effect_name);
+        AOS_LOG(DEBUG, "%s: Positive upper edge on %s hall effect\n", claw_name,
+                hall_effect_name);
         position->posedge_value = pair.upper_angle - initial_position;
       }
     }
@@ -156,12 +156,12 @@
       ++position->negedge_count;
 
       if (angle < pair.lower_angle) {
-        LOG(DEBUG, "%s: Negative lower edge on %s hall effect\n", claw_name,
-            hall_effect_name);
+        AOS_LOG(DEBUG, "%s: Negative lower edge on %s hall effect\n", claw_name,
+                hall_effect_name);
         position->negedge_value = pair.lower_angle - initial_position;
       } else {
-        LOG(DEBUG, "%s: Negative upper edge on %s hall effect\n", claw_name,
-            hall_effect_name);
+        AOS_LOG(DEBUG, "%s: Negative upper edge on %s hall effect\n", claw_name,
+                hall_effect_name);
         position->negedge_value = pair.upper_angle - initial_position;
       }
     }
diff --git a/y2014/control_loops/shooter/shooter.cc b/y2014/control_loops/shooter/shooter.cc
index d1ef2a5..bf14aad 100644
--- a/y2014/control_loops/shooter/shooter.cc
+++ b/y2014/control_loops/shooter/shooter.cc
@@ -35,17 +35,17 @@
   // against last cycle's voltage.
   if (X_hat(2, 0) > last_voltage_ + 4.0) {
     voltage_ -= X_hat(2, 0) - (last_voltage_ + 4.0);
-    LOG(DEBUG, "Capping due to runaway\n");
+    AOS_LOG(DEBUG, "Capping due to runaway\n");
   } else if (X_hat(2, 0) < last_voltage_ - 4.0) {
     voltage_ += X_hat(2, 0) - (last_voltage_ - 4.0);
-    LOG(DEBUG, "Capping due to runaway\n");
+    AOS_LOG(DEBUG, "Capping due to runaway\n");
   }
 
   voltage_ = std::min(max_voltage_, voltage_);
   voltage_ = std::max(-max_voltage_, voltage_);
   mutable_U(0, 0) = voltage_ - old_voltage;
 
-  LOG_STRUCT(
+  AOS_LOG_STRUCT(
       DEBUG, "shooter_output",
       ::y2014::control_loops::ShooterVoltageToLog(X_hat(2, 0), voltage_));
 
@@ -67,8 +67,8 @@
       mutable_R(0, 0) -= dx;
     }
     capped_goal_ = true;
-    LOG_STRUCT(DEBUG, "to prevent windup",
-               ::y2014::control_loops::ShooterMovingGoal(dx));
+    AOS_LOG_STRUCT(DEBUG, "to prevent windup",
+                   ::y2014::control_loops::ShooterMovingGoal(dx));
   } else if (uncapped_voltage() < -max_voltage_) {
     double dx;
     if (index() == 0) {
@@ -82,8 +82,8 @@
       mutable_R(0, 0) -= dx;
     }
     capped_goal_ = true;
-    LOG_STRUCT(DEBUG, "to prevent windup",
-               ::y2014::control_loops::ShooterMovingGoal(dx));
+    AOS_LOG_STRUCT(DEBUG, "to prevent windup",
+                   ::y2014::control_loops::ShooterMovingGoal(dx));
   } else {
     capped_goal_ = false;
   }
@@ -110,10 +110,10 @@
   if (index() == 0) {
     mutable_R(2, 0) += -plant().A(1, 0) / plant().A(1, 2) * (doffset);
   }
-  LOG_STRUCT(DEBUG, "sensor edge (fake?)",
-             ::y2014::control_loops::ShooterChangeCalibration(
-                 encoder_val, known_position, old_position, absolute_position(),
-                 previous_offset, offset_));
+  AOS_LOG_STRUCT(DEBUG, "sensor edge (fake?)",
+                 ::y2014::control_loops::ShooterChangeCalibration(
+                     encoder_val, known_position, old_position,
+                     absolute_position(), previous_offset, offset_));
 }
 
 ShooterMotor::ShooterMotor(::aos::EventLoop *event_loop,
@@ -137,20 +137,21 @@
                      (kMaxExtension - values.shooter.upper_limit) *
                          (kMaxExtension - values.shooter.upper_limit));
   if (power < 0) {
-    LOG_STRUCT(WARNING, "negative power",
-               ::y2014::control_loops::PowerAdjustment(power, 0));
+    AOS_LOG_STRUCT(WARNING, "negative power",
+                   ::y2014::control_loops::PowerAdjustment(power, 0));
     power = 0;
   } else if (power > maxpower) {
-    LOG_STRUCT(WARNING, "power too high",
-               ::y2014::control_loops::PowerAdjustment(power, maxpower));
+    AOS_LOG_STRUCT(WARNING, "power too high",
+                   ::y2014::control_loops::PowerAdjustment(power, maxpower));
     power = maxpower;
   }
 
   double mp = kMaxExtension * kMaxExtension - (power + power) / kSpringConstant;
   double new_pos = 0.10;
   if (mp < 0) {
-    LOG(ERROR,
-        "Power calculation has negative number before square root (%f).\n", mp);
+    AOS_LOG(ERROR,
+            "Power calculation has negative number before square root (%f).\n",
+            mp);
   } else {
     new_pos = kMaxExtension - ::std::sqrt(mp);
   }
@@ -167,7 +168,7 @@
 
 void ShooterMotor::CheckCalibrations(
     const ::y2014::control_loops::ShooterQueue::Position *position) {
-  CHECK_NOTNULL(position);
+  AOS_CHECK_NOTNULL(position);
   const constants::Values &values = constants::GetValues();
 
   // TODO(austin): Validate that this is the right edge.
@@ -184,7 +185,7 @@
             position->pusher_proximal.posedge_value,
             values.shooter.pusher_proximal.upper_angle);
 
-        LOG(DEBUG, "Setting calibration using proximal sensor\n");
+        AOS_LOG(DEBUG, "Setting calibration using proximal sensor\n");
         zeroed_ = true;
       }
     } else {
@@ -204,7 +205,7 @@
             position->pusher_distal.posedge_value,
             values.shooter.pusher_distal.upper_angle);
 
-        LOG(DEBUG, "Setting calibration using distal sensor\n");
+        AOS_LOG(DEBUG, "Setting calibration using distal sensor\n");
         zeroed_ = true;
       }
     } else {
@@ -221,14 +222,14 @@
     ::y2014::control_loops::ShooterQueue::Status *status) {
   const monotonic_clock::time_point monotonic_now = event_loop()->monotonic_now();
   if (goal && ::std::isnan(goal->shot_power)) {
-	  state_ = STATE_ESTOP;
-    LOG(ERROR, "Estopping because got a shot power of NAN.\n");
+    state_ = STATE_ESTOP;
+    AOS_LOG(ERROR, "Estopping because got a shot power of NAN.\n");
   }
 
   // we must always have these or we have issues.
   if (status == NULL) {
     if (output) output->voltage = 0;
-    LOG(ERROR, "Thought I would just check for null and die.\n");
+    AOS_LOG(ERROR, "Thought I would just check for null and die.\n");
     return;
   }
   status->ready = false;
@@ -303,8 +304,8 @@
           state_ = STATE_REQUEST_LOAD;
         } else {
           shooter_loop_disable = true;
-          LOG(DEBUG,
-              "Not moving on until the latch has moved to avoid a crash\n");
+          AOS_LOG(DEBUG,
+                  "Not moving on until the latch has moved to avoid a crash\n");
         }
       } else {
         // If we can't start yet because we don't know where we are, set the
@@ -419,7 +420,7 @@
               (load_timeout_ + chrono::milliseconds(500) <
                monotonic_now)) {
             state_ = STATE_ESTOP;
-            LOG(ERROR, "Estopping because took too long to load.\n");
+            AOS_LOG(ERROR, "Estopping because took too long to load.\n");
           }
         }
       }
@@ -446,8 +447,8 @@
       // up the latch.
       shooter_.SetGoalPosition(values.shooter.lower_limit, 0.0);
       if (position) {
-        LOG(DEBUG, "Waiting on latch: plunger %d, latch: %d\n",
-            position->plunger, position->latch);
+        AOS_LOG(DEBUG, "Waiting on latch: plunger %d, latch: %d\n",
+                position->plunger, position->latch);
       }
 
       latch_piston_ = true;
@@ -461,10 +462,10 @@
         shooter_.SetGoalPosition(PowerToPosition(goal->shot_power), 0.0);
       }
 
-      LOG(DEBUG, "PDIFF: absolute_position: %.2f, pow: %.2f\n",
-          shooter_.absolute_position(),
-          goal ? PowerToPosition(goal->shot_power)
-               : ::std::numeric_limits<double>::quiet_NaN());
+      AOS_LOG(DEBUG, "PDIFF: absolute_position: %.2f, pow: %.2f\n",
+              shooter_.absolute_position(),
+              goal ? PowerToPosition(goal->shot_power)
+                   : ::std::numeric_limits<double>::quiet_NaN());
       if (goal &&
           ::std::abs(shooter_.absolute_position() -
                      PowerToPosition(goal->shot_power)) < 0.001 &&
@@ -483,7 +484,7 @@
       }
       break;
     case STATE_READY:
-      LOG(DEBUG, "In ready\n");
+      AOS_LOG(DEBUG, "In ready\n");
       // Wait until the brake is set, and a shot is requested or the shot power
       // is changed.
       if (monotonic_now > shooter_brake_set_time_) {
@@ -491,9 +492,9 @@
         // We have waited long enough for the brake to set, turn the shooter
         // control loop off.
         shooter_loop_disable = true;
-        LOG(DEBUG, "Brake is now set\n");
+        AOS_LOG(DEBUG, "Brake is now set\n");
         if (goal && goal->shot_requested && !disabled) {
-          LOG(DEBUG, "Shooting now\n");
+          AOS_LOG(DEBUG, "Shooting now\n");
           shooter_loop_disable = true;
           shot_end_time_ = monotonic_now + kShotEndTimeout;
           firing_starting_position_ = shooter_.absolute_position();
@@ -508,7 +509,7 @@
         // TODO(austin): Do we want to set the brake here or after shooting?
         // Depends on air usage.
         status->ready = false;
-        LOG(DEBUG, "Preparing shot again.\n");
+        AOS_LOG(DEBUG, "Preparing shot again.\n");
         state_ = STATE_PREPARE_SHOT;
       }
 
@@ -596,7 +597,7 @@
         // We have been stuck trying to unload for way too long, give up and
         // turn everything off.
         state_ = STATE_ESTOP;
-        LOG(ERROR, "Estopping because took too long to unload.\n");
+        AOS_LOG(ERROR, "Estopping because took too long to unload.\n");
       }
 
       brake_piston_ = false;
@@ -642,7 +643,7 @@
       break;
 
     case STATE_ESTOP:
-      LOG(WARNING, "estopped\n");
+      AOS_LOG(WARNING, "estopped\n");
       // Totally lost, go to a safe state.
       shooter_loop_disable = true;
       latch_piston_ = true;
@@ -651,9 +652,9 @@
   }
 
   if (!shooter_loop_disable) {
-    LOG_STRUCT(DEBUG, "running the loop",
-               ::y2014::control_loops::ShooterStatusToLog(
-                   shooter_.goal_position(), shooter_.absolute_position()));
+    AOS_LOG_STRUCT(DEBUG, "running the loop",
+                   ::y2014::control_loops::ShooterStatusToLog(
+                       shooter_.goal_position(), shooter_.absolute_position()));
     if (!cap_goal) {
       shooter_.set_max_voltage(12.0);
     }
@@ -678,12 +679,13 @@
   }
 
   if (position) {
-    LOG_STRUCT(DEBUG, "internal state",
-               ::y2014::control_loops::ShooterStateToLog(
-                   shooter_.absolute_position(), shooter_.absolute_velocity(),
-                   state_, position->latch, position->pusher_proximal.current,
-                   position->pusher_distal.current, position->plunger,
-                   brake_piston_, latch_piston_));
+    AOS_LOG_STRUCT(
+        DEBUG, "internal state",
+        ::y2014::control_loops::ShooterStateToLog(
+            shooter_.absolute_position(), shooter_.absolute_velocity(), state_,
+            position->latch, position->pusher_proximal.current,
+            position->pusher_distal.current, position->plunger, brake_piston_,
+            latch_piston_));
 
     last_position_ = *position;
 
diff --git a/y2014/control_loops/shooter/shooter.h b/y2014/control_loops/shooter/shooter.h
index 01096a0..e755b0f 100644
--- a/y2014/control_loops/shooter/shooter.h
+++ b/y2014/control_loops/shooter/shooter.h
@@ -79,8 +79,8 @@
   }
 
   void SetGoalPosition(double desired_position, double desired_velocity) {
-    LOG(DEBUG, "Goal position: %f Goal velocity: %f\n", desired_position,
-        desired_velocity);
+    AOS_LOG(DEBUG, "Goal position: %f Goal velocity: %f\n", desired_position,
+            desired_velocity);
 
     mutable_R() << desired_position - kPositionOffset, desired_velocity,
         (-plant().A(1, 0) / plant().A(1, 2) *
diff --git a/y2014/control_loops/shooter/shooter_lib_test.cc b/y2014/control_loops/shooter/shooter_lib_test.cc
index b6883ad..f910b6d 100644
--- a/y2014/control_loops/shooter/shooter_lib_test.cc
+++ b/y2014/control_loops/shooter/shooter_lib_test.cc
@@ -61,7 +61,7 @@
   constexpr static double kPositionOffset = kMaxExtension;
 
   void Reinitialize(double initial_position) {
-    LOG(INFO, "Reinitializing to {pos: %f}\n", initial_position);
+    AOS_LOG(INFO, "Reinitializing to {pos: %f}\n", initial_position);
     StateFeedbackPlant<2, 1, 1> *plant = shooter_plant_.get();
     initial_position_ = initial_position;
     plant->mutable_X(0, 0) = initial_position_ - kPositionOffset;
@@ -93,9 +93,9 @@
       ::y2014::control_loops::ShooterQueue::Position *position) {
     const constants::Values &values = constants::GetValues();
 
-   	position->position = GetPosition();
+    position->position = GetPosition();
 
-    LOG(DEBUG, "Physical shooter at {%f}\n", GetAbsolutePosition());
+    AOS_LOG(DEBUG, "Physical shooter at {%f}\n", GetAbsolutePosition());
 
     // Signal that the hall effect sensor has been triggered if it is within
     // the correct range.
@@ -132,12 +132,14 @@
     if (sensor->current && !last_sensor.current) {
       ++sensor->posedge_count;
       if (last_position.position + initial_position_ < limits.lower_angle) {
-        LOG(DEBUG, "Posedge value on lower edge of sensor, count is now %d\n",
-            sensor->posedge_count);
+        AOS_LOG(DEBUG,
+                "Posedge value on lower edge of sensor, count is now %d\n",
+                sensor->posedge_count);
         sensor->posedge_value = limits.lower_angle - initial_position_;
       } else {
-        LOG(DEBUG, "Posedge value on upper edge of sensor, count is now %d\n",
-            sensor->posedge_count);
+        AOS_LOG(DEBUG,
+                "Posedge value on upper edge of sensor, count is now %d\n",
+                sensor->posedge_count);
         sensor->posedge_value = limits.upper_angle - initial_position_;
       }
     }
@@ -229,11 +231,11 @@
       U << last_voltage_;
       shooter_plant_->Update(U);
     }
-    LOG(DEBUG, "Plant index is %d\n", shooter_plant_->index());
+    AOS_LOG(DEBUG, "Plant index is %d\n", shooter_plant_->index());
 
     // Handle latch hall effect
     if (!latch_piston_state_ && latch_delay_count_ > 0) {
-      LOG(DEBUG, "latching simulation: %dp\n", latch_delay_count_);
+      AOS_LOG(DEBUG, "latching simulation: %dp\n", latch_delay_count_);
       if (latch_delay_count_ == 1) {
         latch_piston_state_ = true;
         EXPECT_GE(constants::GetValues().shooter.latch_max_safe_position,
@@ -242,7 +244,7 @@
       }
       latch_delay_count_--;
     } else if (latch_piston_state_ && latch_delay_count_ < 0) {
-      LOG(DEBUG, "latching simulation: %dn\n", latch_delay_count_);
+      AOS_LOG(DEBUG, "latching simulation: %dn\n", latch_delay_count_);
       if (latch_delay_count_ == -1) {
         latch_piston_state_ = false;
         if (GetAbsolutePosition() > 0.002) {
@@ -616,7 +618,7 @@
          shooter_motor_.state() != ShooterMotor::STATE_READY_UNLOAD) {
     RunFor(dt());
     if (shooter_motor_.state() == ShooterMotor::STATE_UNLOAD_MOVE) {
-      LOG(DEBUG, "State is UnloadMove\n");
+      AOS_LOG(DEBUG, "State is UnloadMove\n");
       --kicked_delay;
       if (kicked_delay == 0) {
         shooter_motor_.shooter_.mutable_R(0, 0) -= 100;
@@ -659,7 +661,7 @@
          shooter_motor_.state() != ShooterMotor::STATE_READY_UNLOAD) {
     RunFor(dt());
     if (shooter_motor_.state() == ShooterMotor::STATE_UNLOAD_MOVE) {
-      LOG(DEBUG, "State is UnloadMove\n");
+      AOS_LOG(DEBUG, "State is UnloadMove\n");
       --kicked_delay;
       if (kicked_delay == 0) {
         shooter_motor_.shooter_.mutable_R(0, 0) += 0.1;
diff --git a/y2014/hot_goal_reader.cc b/y2014/hot_goal_reader.cc
index a772633..773397d 100644
--- a/y2014/hot_goal_reader.cc
+++ b/y2014/hot_goal_reader.cc
@@ -28,10 +28,10 @@
     if (my_socket == -1) {
       my_socket = socket(AF_INET, SOCK_STREAM, 0);
       if (my_socket == -1) {
-        PLOG(WARNING, "socket(AF_INET, SOCK_STREAM, 0) failed");
+        AOS_PLOG(WARNING, "socket(AF_INET, SOCK_STREAM, 0) failed");
         continue;
       } else {
-        LOG(INFO, "opened socket (is %d)\n", my_socket);
+        AOS_LOG(INFO, "opened socket (is %d)\n", my_socket);
         sockaddr_in address, *sockaddr_pointer;
         memset(&address, 0, sizeof(address));
         address.sin_family = AF_INET;
@@ -40,15 +40,15 @@
         sockaddr_pointer = &address;
         memcpy(&address_pointer, &sockaddr_pointer, sizeof(void *));
         if (bind(my_socket, address_pointer, sizeof(address)) == -1) {
-          PLOG(WARNING, "bind(%d, %p, %zu) failed",
-               my_socket, &address, sizeof(address));
+          AOS_PLOG(WARNING, "bind(%d, %p, %zu) failed", my_socket, &address,
+                   sizeof(address));
           close(my_socket);
           my_socket = -1;
           continue;
         }
 
         if (listen(my_socket, 1) == -1) {
-          PLOG(WARNING, "listen(%d, 1) failed", my_socket);
+          AOS_PLOG(WARNING, "listen(%d, 1) failed", my_socket);
           close(my_socket);
           my_socket = -1;
           continue;
@@ -58,10 +58,10 @@
 
     int connection = accept4(my_socket, nullptr, nullptr, SOCK_NONBLOCK);
     if (connection == -1) {
-      PLOG(WARNING, "accept(%d, nullptr, nullptr) failed", my_socket);
+      AOS_PLOG(WARNING, "accept(%d, nullptr, nullptr) failed", my_socket);
       continue;
     }
-    LOG(INFO, "accepted (is %d)\n", connection);
+    AOS_LOG(INFO, "accepted (is %d)\n", connection);
 
     while (connection != -1) {
       fd_set fds;
@@ -76,8 +76,8 @@
           uint8_t data;
           ssize_t read_bytes = read(connection, &data, sizeof(data));
           if (read_bytes != sizeof(data)) {
-            LOG(WARNING, "read %zd bytes instead of %zd\n", read_bytes,
-                sizeof(data));
+            AOS_LOG(WARNING, "read %zd bytes instead of %zd\n", read_bytes,
+                    sizeof(data));
             break;
           }
           if (data & 0x01) ++right_count;
@@ -85,21 +85,20 @@
           auto message = hot_goal_sender.MakeMessage();
           message->left_count = left_count;
           message->right_count = right_count;
-          LOG_STRUCT(DEBUG, "sending", *message);
+          AOS_LOG_STRUCT(DEBUG, "sending", *message);
           message.Send();
         } break;
         case 0:
-          LOG(WARNING, "read on %d timed out\n", connection);
+          AOS_LOG(WARNING, "read on %d timed out\n", connection);
           close(connection);
           connection = -1;
           break;
         default:
-          PLOG(FATAL,
-               "select(%d, %p, nullptr, nullptr, %p) failed",
-               connection + 1, &fds, &timeout_timeval);
+          AOS_PLOG(FATAL, "select(%d, %p, nullptr, nullptr, %p) failed",
+                   connection + 1, &fds, &timeout_timeval);
       }
     }
   }
 
-  LOG(FATAL, "finished???\n");
+  AOS_LOG(FATAL, "finished???\n");
 }
diff --git a/y2014/joystick_reader.cc b/y2014/joystick_reader.cc
index 24ac312..29cb354 100644
--- a/y2014/joystick_reader.cc
+++ b/y2014/joystick_reader.cc
@@ -234,93 +234,93 @@
 
       if (data.IsPressed(kIntakeOpenPosition)) {
         CancelAllActions();
-        LOG(DEBUG, "Canceling\n");
+        AOS_LOG(DEBUG, "Canceling\n");
         SetGoal(kFlippedIntakeOpenGoal);
       } else if (data.IsPressed(kIntakePosition)) {
         CancelAllActions();
-        LOG(DEBUG, "Canceling\n");
+        AOS_LOG(DEBUG, "Canceling\n");
         SetGoal(kFlippedIntakeGoal);
       } else if (data.IsPressed(kVerticalTuck)) {
         CancelAllActions();
-        LOG(DEBUG, "Canceling\n");
+        AOS_LOG(DEBUG, "Canceling\n");
         SetGoal(kVerticalTuckGoal);
       } else if (data.IsPressed(kTuck)) {
         CancelAllActions();
-        LOG(DEBUG, "Canceling\n");
+        AOS_LOG(DEBUG, "Canceling\n");
         SetGoal(kFlippedTuckGoal);
       } else if (data.PosEdge(kLongShot)) {
         CancelAllActions();
-        LOG(DEBUG, "Canceling\n");
+        AOS_LOG(DEBUG, "Canceling\n");
         SetGoal(kFlippedLongShotGoal);
       } else if (data.PosEdge(kCloseShot)) {
         CancelAllActions();
-        LOG(DEBUG, "Canceling\n");
+        AOS_LOG(DEBUG, "Canceling\n");
         SetGoal(kFlippedMediumShotGoal);
       } else if (data.PosEdge(kFenderShot)) {
         CancelAllActions();
-        LOG(DEBUG, "Canceling\n");
+        AOS_LOG(DEBUG, "Canceling\n");
         SetGoal(kFlippedShortShotGoal);
       } else if (data.PosEdge(kHumanPlayerShot)) {
         CancelAllActions();
-        LOG(DEBUG, "Canceling\n");
+        AOS_LOG(DEBUG, "Canceling\n");
         SetGoal(kFlippedHumanShotGoal);
       } else if (data.PosEdge(kUserLeft)) {
         CancelAllActions();
-        LOG(DEBUG, "Canceling\n");
+        AOS_LOG(DEBUG, "Canceling\n");
         SetGoal(kFlipped254PassGoal);
       } else if (data.PosEdge(kUserRight)) {
         CancelAllActions();
-        LOG(DEBUG, "Canceling\n");
+        AOS_LOG(DEBUG, "Canceling\n");
         SetGoal(kFlippedDemoShotGoal);
       } else if (data.PosEdge(kTrussShot)) {
         CancelAllActions();
-        LOG(DEBUG, "Canceling\n");
+        AOS_LOG(DEBUG, "Canceling\n");
         SetGoal(kFlippedTrussShotGoal);
       }
     } else {
       if (data.IsPressed(kIntakeOpenPosition)) {
         CancelAllActions();
-        LOG(DEBUG, "Canceling\n");
+        AOS_LOG(DEBUG, "Canceling\n");
         SetGoal(kIntakeOpenGoal);
       } else if (data.IsPressed(kIntakePosition)) {
         CancelAllActions();
-        LOG(DEBUG, "Canceling\n");
+        AOS_LOG(DEBUG, "Canceling\n");
         SetGoal(kIntakeGoal);
       } else if (data.IsPressed(kVerticalTuck)) {
         CancelAllActions();
-        LOG(DEBUG, "Canceling\n");
+        AOS_LOG(DEBUG, "Canceling\n");
         SetGoal(kVerticalTuckGoal);
       } else if (data.IsPressed(kTuck)) {
         CancelAllActions();
-        LOG(DEBUG, "Canceling\n");
+        AOS_LOG(DEBUG, "Canceling\n");
         SetGoal(kTuckGoal);
       } else if (data.PosEdge(kLongShot)) {
         CancelAllActions();
-        LOG(DEBUG, "Canceling\n");
+        AOS_LOG(DEBUG, "Canceling\n");
         SetGoal(kLongShotGoal);
       } else if (data.PosEdge(kCloseShot)) {
         CancelAllActions();
-        LOG(DEBUG, "Canceling\n");
+        AOS_LOG(DEBUG, "Canceling\n");
         SetGoal(kCloseShotGoal);
       } else if (data.PosEdge(kFenderShot)) {
         CancelAllActions();
-        LOG(DEBUG, "Canceling\n");
+        AOS_LOG(DEBUG, "Canceling\n");
         SetGoal(kFenderShotGoal);
       } else if (data.PosEdge(kHumanPlayerShot)) {
         CancelAllActions();
-        LOG(DEBUG, "Canceling\n");
+        AOS_LOG(DEBUG, "Canceling\n");
         SetGoal(kHumanShotGoal);
       } else if (data.PosEdge(kUserLeft)) {
         CancelAllActions();
-        LOG(DEBUG, "Canceling\n");
+        AOS_LOG(DEBUG, "Canceling\n");
         SetGoal(k254PassGoal);
       } else if (data.PosEdge(kUserRight)) {
         CancelAllActions();
-        LOG(DEBUG, "Canceling\n");
+        AOS_LOG(DEBUG, "Canceling\n");
         SetGoal(kDemoShotGoal);
       } else if (data.PosEdge(kTrussShot)) {
         CancelAllActions();
-        LOG(DEBUG, "Canceling\n");
+        AOS_LOG(DEBUG, "Canceling\n");
         SetGoal(kTrussShotGoal);
       }
     }
@@ -333,7 +333,7 @@
 
     if (data.IsPressed(kUnload) || data.IsPressed(kReload)) {
       CancelAllActions();
-        LOG(DEBUG, "Canceling\n");
+      AOS_LOG(DEBUG, "Canceling\n");
       intake_power_ = 0.0;
       velocity_compensation_ = 0.0;
     }
@@ -356,7 +356,7 @@
         goal_angle +=
             SpeedToAngleOffset(drivetrain_status_fetcher_->robot_speed);
       } else {
-        LOG_INTERVAL(no_drivetrain_status_);
+        AOS_LOG_INTERVAL(no_drivetrain_status_);
       }
 
       if (moving_for_shot_) {
@@ -390,7 +390,7 @@
         goal_message->centering = intaking ? 12.0 : 0.0;
 
         if (!goal_message.Send()) {
-          LOG(WARNING, "sending claw goal failed\n");
+          AOS_LOG(WARNING, "sending claw goal failed\n");
         }
       }
 
@@ -401,7 +401,7 @@
         goal_message->unload_requested = data.IsPressed(kUnload);
         goal_message->load_requested = data.IsPressed(kReload);
         if (!goal_message.Send()) {
-          LOG(WARNING, "sending shooter goal failed\n");
+          AOS_LOG(WARNING, "sending shooter goal failed\n");
         }
       }
     }
diff --git a/y2014/wpilib_interface.cc b/y2014/wpilib_interface.cc
index d4d7ad6..7952adc 100644
--- a/y2014/wpilib_interface.cc
+++ b/y2014/wpilib_interface.cc
@@ -478,13 +478,13 @@
 
   void Loop(const int iterations) {
     if (iterations != 1) {
-      LOG(DEBUG, "Solenoids skipped %d iterations\n", iterations - 1);
+      AOS_LOG(DEBUG, "Solenoids skipped %d iterations\n", iterations - 1);
     }
 
     {
       shooter_.Fetch();
       if (shooter_.get()) {
-        LOG_STRUCT(DEBUG, "solenoids", *shooter_);
+        AOS_LOG_STRUCT(DEBUG, "solenoids", *shooter_);
         shooter_latch_->Set(!shooter_->latch_piston);
         shooter_brake_->Set(!shooter_->brake_piston);
       }
@@ -493,7 +493,7 @@
     {
       drivetrain_.Fetch();
       if (drivetrain_.get()) {
-        LOG_STRUCT(DEBUG, "solenoids", *drivetrain_);
+        AOS_LOG_STRUCT(DEBUG, "solenoids", *drivetrain_);
         drivetrain_left_->Set(!drivetrain_->left_high);
         drivetrain_right_->Set(!drivetrain_->right_high);
       }
@@ -513,7 +513,7 @@
 
       pcm_->Flush();
       to_log.read_solenoids = pcm_->GetAll();
-      LOG_STRUCT(DEBUG, "pneumatics info", to_log);
+      AOS_LOG_STRUCT(DEBUG, "pneumatics info", to_log);
     }
   }
 
@@ -545,12 +545,12 @@
 
  private:
   virtual void Write(const ShooterQueue::Output &output) override {
-    LOG_STRUCT(DEBUG, "will output", output);
+    AOS_LOG_STRUCT(DEBUG, "will output", output);
     shooter_talon_->SetSpeed(output.voltage / 12.0);
   }
 
   virtual void Stop() override {
-    LOG(WARNING, "shooter output too old\n");
+    AOS_LOG(WARNING, "shooter output too old\n");
     shooter_talon_->SetDisabled();
   }
 
@@ -590,7 +590,7 @@
 
  private:
   virtual void Write(const ClawQueue::Output &output) override {
-    LOG_STRUCT(DEBUG, "will output", output);
+    AOS_LOG_STRUCT(DEBUG, "will output", output);
     intake1_talon_->SetSpeed(output.intake_voltage / 12.0);
     intake2_talon_->SetSpeed(output.intake_voltage / 12.0);
     bottom_claw_talon_->SetSpeed(-output.bottom_claw_voltage / 12.0);
@@ -600,7 +600,7 @@
   }
 
   virtual void Stop() override {
-    LOG(WARNING, "claw output too old\n");
+    AOS_LOG(WARNING, "claw output too old\n");
     intake1_talon_->SetDisabled();
     intake2_talon_->SetDisabled();
     bottom_claw_talon_->SetDisabled();
diff --git a/y2014_bot3/actors/autonomous_actor.cc b/y2014_bot3/actors/autonomous_actor.cc
index 1a25c55..ee67813 100644
--- a/y2014_bot3/actors/autonomous_actor.cc
+++ b/y2014_bot3/actors/autonomous_actor.cc
@@ -31,14 +31,15 @@
 bool AutonomousActor::RunAction(
     const ::frc971::autonomous::AutonomousActionParams &params) {
   const monotonic_clock::time_point start_time = monotonic_now();
-  LOG(INFO, "Starting autonomous action with mode %" PRId32 "\n", params.mode);
+  AOS_LOG(INFO, "Starting autonomous action with mode %" PRId32 "\n",
+          params.mode);
   Reset();
 
   StartDrive(1.0, 0.0, kDrive, kTurn);
   if (!WaitForDriveDone()) return true;
 
-  LOG(INFO, "Done %f\n",
-      ::aos::time::DurationInSeconds(monotonic_now() - start_time));
+  AOS_LOG(INFO, "Done %f\n",
+          ::aos::time::DurationInSeconds(monotonic_now() - start_time));
 
   ::aos::time::PhasedLoop phased_loop(::std::chrono::milliseconds(5),
                                       monotonic_now(),
@@ -46,7 +47,7 @@
   while (!ShouldCancel()) {
     phased_loop.SleepUntilNext();
   }
-  LOG(DEBUG, "Done running\n");
+  AOS_LOG(DEBUG, "Done running\n");
 
   return true;
 }
diff --git a/y2014_bot3/joystick_reader.cc b/y2014_bot3/joystick_reader.cc
index 44eb2b8..dc43f30 100644
--- a/y2014_bot3/joystick_reader.cc
+++ b/y2014_bot3/joystick_reader.cc
@@ -85,7 +85,7 @@
   void HandleTeleop(const ::aos::input::driver_station::Data &data) {
     if (!data.GetControlBit(ControlBit::kEnabled)) {
       action_queue_.CancelAllActions();
-      LOG(DEBUG, "Canceling\n");
+      AOS_LOG(DEBUG, "Canceling\n");
     }
 
     // Rollers.
@@ -103,20 +103,20 @@
       rollers_goal->human_player = true;
     }
     if (!rollers_goal.Send()) {
-      LOG(WARNING, "Sending rollers values failed.\n");
+      AOS_LOG(WARNING, "Sending rollers values failed.\n");
     }
   }
 
  private:
   void StartAuto() {
-    LOG(INFO, "Starting auto mode.\n");
+    AOS_LOG(INFO, "Starting auto mode.\n");
     ::frc971::autonomous::AutonomousActionParams params;
     params.mode = 0;
     action_queue_.EnqueueAction(autonomous_action_factory_.Make(params));
   }
 
   void StopAuto() {
-    LOG(INFO, "Stopping auto mode\n");
+    AOS_LOG(INFO, "Stopping auto mode\n");
     action_queue_.CancelAllActions();
   }
 
diff --git a/y2014_bot3/wpilib_interface.cc b/y2014_bot3/wpilib_interface.cc
index c526742..9b1d4e8 100644
--- a/y2014_bot3/wpilib_interface.cc
+++ b/y2014_bot3/wpilib_interface.cc
@@ -163,14 +163,14 @@
 
   void Loop(const int iterations) {
     if (iterations != 1) {
-      LOG(DEBUG, "Solenoids skipped %d iterations\n", iterations - 1);
+      AOS_LOG(DEBUG, "Solenoids skipped %d iterations\n", iterations - 1);
     }
 
     // Drivetrain
     {
       drivetrain_.Fetch();
       if (drivetrain_.get()) {
-        LOG_STRUCT(DEBUG, "solenoids", *drivetrain_);
+        AOS_LOG_STRUCT(DEBUG, "solenoids", *drivetrain_);
         drivetrain_left_->Set(drivetrain_->left_high);
         drivetrain_right_->Set(drivetrain_->right_high);
       }
@@ -180,7 +180,7 @@
     {
       rollers_.Fetch();
       if (rollers_.get()) {
-        LOG_STRUCT(DEBUG, "solenoids", *rollers_);
+        AOS_LOG_STRUCT(DEBUG, "solenoids", *rollers_);
         rollers_front_->Set(rollers_->front_extended);
         rollers_back_->Set(rollers_->back_extended);
       }
@@ -202,7 +202,7 @@
 
       pcm_->Flush();
       to_log.read_solenoids = pcm_->GetAll();
-      LOG_STRUCT(DEBUG, "pneumatics info", to_log);
+      AOS_LOG_STRUCT(DEBUG, "pneumatics info", to_log);
     }
   }
 
@@ -247,7 +247,7 @@
  private:
   virtual void Write(const ::y2014_bot3::control_loops::RollersQueue::Output
                          &output) override {
-    LOG_STRUCT(DEBUG, "will output", output);
+    AOS_LOG_STRUCT(DEBUG, "will output", output);
     rollers_front_left_intake_talon_->SetSpeed(output.front_intake_voltage /
                                                12.0);
     rollers_front_right_intake_talon_->SetSpeed(
@@ -260,7 +260,7 @@
   }
 
   virtual void Stop() override {
-    LOG(WARNING, "Intake output too old\n");
+    AOS_LOG(WARNING, "Intake output too old\n");
     rollers_front_left_intake_talon_->SetDisabled();
     rollers_front_right_intake_talon_->SetDisabled();
     rollers_back_left_intake_talon_->SetDisabled();
diff --git a/y2016/actors/autonomous_actor.cc b/y2016/actors/autonomous_actor.cc
index a02362e..498a6f1 100644
--- a/y2016/actors/autonomous_actor.cc
+++ b/y2016/actors/autonomous_actor.cc
@@ -111,7 +111,7 @@
   new_superstructure_goal->unfold_climber = false;
 
   if (!new_superstructure_goal.Send()) {
-    LOG(ERROR, "Sending superstructure goal failed.\n");
+    AOS_LOG(ERROR, "Sending superstructure goal failed.\n");
   }
 }
 
@@ -124,7 +124,7 @@
   shooter_goal->push_to_shooter = false;
   shooter_goal->force_lights_on = false;
   if (!shooter_goal.Send()) {
-    LOG(ERROR, "Sending shooter goal failed.\n");
+    AOS_LOG(ERROR, "Sending shooter goal failed.\n");
   }
 }
 
@@ -138,7 +138,7 @@
   shooter_goal->force_lights_on = false;
 
   if (!shooter_goal.Send()) {
-    LOG(ERROR, "Sending shooter goal failed.\n");
+    AOS_LOG(ERROR, "Sending shooter goal failed.\n");
   }
 }
 
@@ -156,7 +156,7 @@
   shooter_goal->force_lights_on = force_lights_on;
 
   if (!shooter_goal.Send()) {
-    LOG(ERROR, "Sending shooter goal failed.\n");
+    AOS_LOG(ERROR, "Sending shooter goal failed.\n");
   }
 }
 
@@ -179,7 +179,7 @@
   shooter_goal->force_lights_on = force_lights_on;
 
   if (!shooter_goal.Send()) {
-    LOG(ERROR, "Sending shooter goal failed.\n");
+    AOS_LOG(ERROR, "Sending shooter goal failed.\n");
   }
 
   ::aos::time::PhasedLoop phased_loop(::std::chrono::milliseconds(5),
@@ -270,7 +270,7 @@
       }
       if (ready_to_fire > 15) {
         break;
-        LOG(INFO, "Vision align success!\n");
+        AOS_LOG(INFO, "Vision align success!\n");
       }
     }
     phased_loop.SleepUntilNext();
@@ -278,7 +278,7 @@
 
   vision_action_->Cancel();
   WaitUntilDoneOrCanceled(::std::move(vision_action_));
-  LOG(INFO, "Done waiting for vision\n");
+  AOS_LOG(INFO, "Done waiting for vision\n");
 }
 
 bool AutonomousActor::IntakeDone() {
@@ -289,7 +289,7 @@
 
   if (superstructure_status_fetcher_->state < 12 ||
       superstructure_status_fetcher_->state == 16) {
-    LOG(ERROR, "Superstructure no longer running, aborting action\n");
+    AOS_LOG(ERROR, "Superstructure no longer running, aborting action\n");
     return true;
   }
 
@@ -297,12 +297,12 @@
                  superstructure_goal_.intake) < kProfileError &&
       ::std::abs(superstructure_status_fetcher_->intake
                      .goal_angular_velocity) < kProfileError) {
-    LOG(DEBUG, "Profile done.\n");
+    AOS_LOG(DEBUG, "Profile done.\n");
     if (::std::abs(superstructure_status_fetcher_->intake.angle -
                    superstructure_goal_.intake) < kEpsilon &&
         ::std::abs(superstructure_status_fetcher_->intake
                        .angular_velocity) < kEpsilon) {
-      LOG(INFO, "Near goal, done.\n");
+      AOS_LOG(INFO, "Near goal, done.\n");
       return true;
     }
   }
@@ -312,7 +312,7 @@
 bool AutonomousActor::SuperstructureProfileDone() {
   if (superstructure_status_fetcher_->state < 12 ||
       superstructure_status_fetcher_->state == 16) {
-    LOG(ERROR, "Superstructure no longer running, aborting action\n");
+    AOS_LOG(ERROR, "Superstructure no longer running, aborting action\n");
     return true;
   }
 
@@ -339,7 +339,7 @@
 
   constexpr double kEpsilon = 0.03;
   if (SuperstructureProfileDone()) {
-    LOG(DEBUG, "Profile done.\n");
+    AOS_LOG(DEBUG, "Profile done.\n");
     if (::std::abs(superstructure_status_fetcher_->intake.angle -
                    superstructure_goal_.intake) < (kEpsilon + 0.1) &&
         ::std::abs(superstructure_status_fetcher_->shoulder.angle -
@@ -352,7 +352,7 @@
                        .angular_velocity) < (kEpsilon + 0.10) &&
         ::std::abs(superstructure_status_fetcher_->wrist
                        .angular_velocity) < (kEpsilon + 0.05)) {
-      LOG(INFO, "Near goal, done.\n");
+      AOS_LOG(INFO, "Near goal, done.\n");
       return true;
     }
   }
@@ -384,43 +384,43 @@
 }
 
 void AutonomousActor::BackLongShotLowBarTwoBall() {
-  LOG(INFO, "Expanding for back long shot\n");
+  AOS_LOG(INFO, "Expanding for back long shot\n");
   MoveSuperstructure(0.00, M_PI / 2.0 - 0.2, -0.55, {7.0, 40.0}, {4.0, 6.0},
                      {10.0, 25.0}, false, 0.0);
 }
 
 void AutonomousActor::BackLongShotTwoBall() {
-  LOG(INFO, "Expanding for back long shot\n");
+  AOS_LOG(INFO, "Expanding for back long shot\n");
   MoveSuperstructure(0.00, M_PI / 2.0 - 0.2, -0.55, {7.0, 40.0}, {4.0, 6.0},
                      {10.0, 25.0}, false, 0.0);
 }
 
 void AutonomousActor::BackLongShotTwoBallFinish() {
-  LOG(INFO, "Expanding for back long shot\n");
+  AOS_LOG(INFO, "Expanding for back long shot\n");
   MoveSuperstructure(0.00, M_PI / 2.0 - 0.2, -0.625 + 0.03, {7.0, 40.0},
                      {4.0, 6.0}, {10.0, 25.0}, false, 0.0);
 }
 
 void AutonomousActor::BackLongShot() {
-  LOG(INFO, "Expanding for back long shot\n");
+  AOS_LOG(INFO, "Expanding for back long shot\n");
   MoveSuperstructure(0.80, M_PI / 2.0 - 0.2, -0.62, {7.0, 40.0}, {4.0, 6.0},
                      {10.0, 25.0}, false, 0.0);
 }
 
 void AutonomousActor::BackMiddleShot() {
-  LOG(INFO, "Expanding for back middle shot\n");
+  AOS_LOG(INFO, "Expanding for back middle shot\n");
   MoveSuperstructure(-0.05, M_PI / 2.0 - 0.2, -0.665, {7.0, 40.0}, {4.0, 10.0},
                      {10.0, 25.0}, false, 0.0);
 }
 
 void AutonomousActor::FrontLongShot() {
-  LOG(INFO, "Expanding for front long shot\n");
+  AOS_LOG(INFO, "Expanding for front long shot\n");
   MoveSuperstructure(0.80, M_PI / 2.0 + 0.1, M_PI + 0.41 + 0.02, {7.0, 40.0},
                      {4.0, 6.0}, {10.0, 25.0}, false, 0.0);
 }
 
 void AutonomousActor::FrontMiddleShot() {
-  LOG(INFO, "Expanding for front middle shot\n");
+  AOS_LOG(INFO, "Expanding for front middle shot\n");
   MoveSuperstructure(-0.05, M_PI / 2.0 + 0.1, M_PI + 0.44, {7.0, 40.0},
                      {4.0, 10.0}, {10.0, 25.0}, true, 0.0);
 }
@@ -433,37 +433,37 @@
 void AutonomousActor::DoFullShot() {
   if (ShouldCancel()) return;
   // Make sure that the base is aligned with the base.
-  LOG(INFO, "Waiting for the superstructure\n");
+  AOS_LOG(INFO, "Waiting for the superstructure\n");
   WaitForSuperstructure();
 
   this_thread::sleep_for(chrono::milliseconds(500));
 
   if (ShouldCancel()) return;
-  LOG(INFO, "Triggering the vision actor\n");
+  AOS_LOG(INFO, "Triggering the vision actor\n");
   AlignWithVisionGoal();
 
   // Wait for the drive base to be aligned with the target and make sure that
   // the shooter is up to speed.
-  LOG(INFO, "Waiting for vision to be aligned\n");
+  AOS_LOG(INFO, "Waiting for vision to be aligned\n");
   WaitForAlignedWithVision(chrono::milliseconds(2000));
   if (ShouldCancel()) return;
-  LOG(INFO, "Waiting for shooter to be up to speed\n");
+  AOS_LOG(INFO, "Waiting for shooter to be up to speed\n");
   WaitForShooterSpeed();
   if (ShouldCancel()) return;
 
   this_thread::sleep_for(chrono::milliseconds(300));
-  LOG(INFO, "Shoot!\n");
+  AOS_LOG(INFO, "Shoot!\n");
   Shoot();
 
   // Turn off the shooter and fold up the superstructure.
   if (ShouldCancel()) return;
-  LOG(INFO, "Stopping shooter\n");
+  AOS_LOG(INFO, "Stopping shooter\n");
   SetShooterSpeed(0.0);
-  LOG(INFO, "Folding superstructure back down\n");
+  AOS_LOG(INFO, "Folding superstructure back down\n");
   TuckArm(false, false);
 
   // Wait for everything to be folded up.
-  LOG(INFO, "Waiting for superstructure to be folded back down\n");
+  AOS_LOG(INFO, "Waiting for superstructure to be folded back down\n");
   WaitForSuperstructureLow();
 }
 
@@ -505,7 +505,7 @@
     const double distance_to_go = (left_error + right_error) / 2.0;
     const double distance_compensation =
         goal_distance - tip_distance - distance_to_go;
-    LOG(INFO, "Going %f further at the bump\n", distance_compensation);
+    AOS_LOG(INFO, "Going %f further at the bump\n", distance_compensation);
     StartDrive(distance_compensation, 0.0, kMoatDrive, kSlowTurn);
   }
 }
@@ -577,11 +577,11 @@
   MoveSuperstructure(0.10, -0.010, 0.0, {8.0, 60.0}, {4.0, 10.0}, {10.0, 25.0},
                      false, 12.0);
   if (ShouldCancel()) return;
-  LOG(INFO, "Waiting for the intake to come down.\n");
+  AOS_LOG(INFO, "Waiting for the intake to come down.\n");
 
   WaitForIntake();
-  LOG(INFO, "Intake done at %f seconds, starting to drive\n",
-      ::aos::time::DurationInSeconds(monotonic_now() - start_time));
+  AOS_LOG(INFO, "Intake done at %f seconds, starting to drive\n",
+          ::aos::time::DurationInSeconds(monotonic_now() - start_time));
   if (ShouldCancel()) return;
   const double kDriveDistance = 5.05;
   StartDrive(-kDriveDistance, 0.0, kTwoBallLowDrive, kSlowTurn);
@@ -595,13 +595,14 @@
   if (ball_detector_fetcher_.get()) {
     const bool ball_detected = ball_detector_fetcher_->voltage > 2.5;
     first_ball_there = ball_detected;
-    LOG(INFO, "Saw the ball: %d at %f\n", first_ball_there,
-        ::aos::time::DurationInSeconds(monotonic_now() - start_time));
+    AOS_LOG(INFO, "Saw the ball: %d at %f\n", first_ball_there,
+            ::aos::time::DurationInSeconds(monotonic_now() - start_time));
   }
   MoveSuperstructure(0.10, -0.010, 0.0, {8.0, 40.0}, {4.0, 10.0}, {10.0, 25.0},
                      false, 0.0);
-  LOG(INFO, "Shutting off rollers at %f seconds, starting to straighten out\n",
-      ::aos::time::DurationInSeconds(monotonic_now() - start_time));
+  AOS_LOG(INFO,
+          "Shutting off rollers at %f seconds, starting to straighten out\n",
+          ::aos::time::DurationInSeconds(monotonic_now() - start_time));
   StartDrive(0.0, -0.4, kTwoBallLowDrive, kSwerveTurn);
   MoveSuperstructure(-0.05, -0.010, 0.0, {8.0, 40.0}, {4.0, 10.0}, {10.0, 25.0},
                      false, 0.0);
@@ -610,7 +611,7 @@
 
   // We are now under the low bar.  Start lifting.
   BackLongShotLowBarTwoBall();
-  LOG(INFO, "Spinning up the shooter wheels\n");
+  AOS_LOG(INFO, "Spinning up the shooter wheels\n");
   SetShooterSpeed(640.0);
   StartDrive(0.0, 0.0, kTwoBallFastDrive, kSwerveTurn);
 
@@ -620,8 +621,8 @@
   BackLongShotTwoBall();
 
   if (!WaitForDriveDone()) return;
-  LOG(INFO, "First shot done driving at %f seconds\n",
-      ::aos::time::DurationInSeconds(monotonic_now() - start_time));
+  AOS_LOG(INFO, "First shot done driving at %f seconds\n",
+          ::aos::time::DurationInSeconds(monotonic_now() - start_time));
 
   WaitForSuperstructureProfile();
 
@@ -636,19 +637,19 @@
   BackLongShotTwoBallFinish();
   WaitForSuperstructureProfile();
   if (ShouldCancel()) return;
-  LOG(INFO, "Shoot!\n");
+  AOS_LOG(INFO, "Shoot!\n");
   if (first_ball_there) {
     Shoot();
   } else {
-    LOG(INFO, "Nah, not shooting\n");
+    AOS_LOG(INFO, "Nah, not shooting\n");
   }
 
-  LOG(INFO, "First shot at %f seconds\n",
-      ::aos::time::DurationInSeconds(monotonic_now() - start_time));
+  AOS_LOG(INFO, "First shot at %f seconds\n",
+          ::aos::time::DurationInSeconds(monotonic_now() - start_time));
   if (ShouldCancel()) return;
 
   SetShooterSpeed(0.0);
-  LOG(INFO, "Folding superstructure back down\n");
+  AOS_LOG(INFO, "Folding superstructure back down\n");
   TuckArm(true, true);
 
   // Undo vision move.
@@ -663,8 +664,8 @@
   StartDrive(0, 0, kTwoBallReturnSlow, kSwerveTurn);
 
   if (!WaitForDriveNear(0.06, kDoNotTurnCare)) return;
-  LOG(INFO, "At Low Bar %f\n",
-      ::aos::time::DurationInSeconds(monotonic_now() - start_time));
+  AOS_LOG(INFO, "At Low Bar %f\n",
+          ::aos::time::DurationInSeconds(monotonic_now() - start_time));
 
   OpenShooter();
   constexpr double kSecondBallAfterBarDrive = 2.10;
@@ -681,8 +682,8 @@
   MoveSuperstructure(0.10, -0.010, 0.0, {8.0, 60.0}, {4.0, 10.0}, {10.0, 25.0},
                      false, 12.0);
 
-  LOG(INFO, "Done backing up %f\n",
-      ::aos::time::DurationInSeconds(monotonic_now() - start_time));
+  AOS_LOG(INFO, "Done backing up %f\n",
+          ::aos::time::DurationInSeconds(monotonic_now() - start_time));
 
   constexpr double kDriveBackDistance = 5.15 - 0.4;
   StartDrive(-kDriveBackDistance, 0.0, kTwoBallLowDrive, kFinishTurn);
@@ -690,8 +691,8 @@
   if (!WaitForDriveNear(kDriveBackDistance - 0.75, kDoNotTurnCare)) return;
 
   StartDrive(0.0, -kBallSmallWallTurn, kTwoBallLowDrive, kFinishTurn);
-  LOG(INFO, "Straightening up at %f\n",
-      ::aos::time::DurationInSeconds(monotonic_now() - start_time));
+  AOS_LOG(INFO, "Straightening up at %f\n",
+          ::aos::time::DurationInSeconds(monotonic_now() - start_time));
 
   CloseIfBall();
   if (!WaitForDriveNear(kDriveBackDistance - 2.3, kDoNotTurnCare)) return;
@@ -701,15 +702,15 @@
     const bool ball_detected = ball_detector_fetcher_->voltage > 2.5;
     if (!ball_detected) {
       if (!WaitForDriveDone()) return;
-      LOG(INFO, "Aborting, no ball %f\n",
-          ::aos::time::DurationInSeconds(monotonic_now() - start_time));
+      AOS_LOG(INFO, "Aborting, no ball %f\n",
+              ::aos::time::DurationInSeconds(monotonic_now() - start_time));
       return;
     }
   }
   CloseShooter();
 
   BackLongShotLowBarTwoBall();
-  LOG(INFO, "Spinning up the shooter wheels\n");
+  AOS_LOG(INFO, "Spinning up the shooter wheels\n");
   SetShooterSpeed(640.0);
   StartDrive(0.0, 0.0, kTwoBallFastDrive, kSwerveTurn);
 
@@ -718,8 +719,8 @@
   BackLongShotTwoBall();
 
   if (!WaitForDriveDone()) return;
-  LOG(INFO, "Second shot done driving at %f seconds\n",
-      ::aos::time::DurationInSeconds(monotonic_now() - start_time));
+  AOS_LOG(INFO, "Second shot done driving at %f seconds\n",
+          ::aos::time::DurationInSeconds(monotonic_now() - start_time));
   WaitForSuperstructure();
   AlignWithVisionGoal();
   if (ShouldCancel()) return;
@@ -729,32 +730,32 @@
 
   // 2.2 with 0.4 of vision.
   // 1.8 without any vision.
-  LOG(INFO, "Going to vision align at %f\n",
-      ::aos::time::DurationInSeconds(monotonic_now() - start_time));
+  AOS_LOG(INFO, "Going to vision align at %f\n",
+          ::aos::time::DurationInSeconds(monotonic_now() - start_time));
   WaitForAlignedWithVision(
       (start_time + chrono::milliseconds(13500) + kVisionExtra * 2) -
       monotonic_now());
   BackLongShotTwoBallFinish();
   WaitForSuperstructureProfile();
   if (ShouldCancel()) return;
-  LOG(INFO, "Shoot at %f\n",
-      ::aos::time::DurationInSeconds(monotonic_now() - start_time));
+  AOS_LOG(INFO, "Shoot at %f\n",
+          ::aos::time::DurationInSeconds(monotonic_now() - start_time));
   Shoot();
 
-  LOG(INFO, "Second shot at %f seconds\n",
-      ::aos::time::DurationInSeconds(monotonic_now() - start_time));
+  AOS_LOG(INFO, "Second shot at %f seconds\n",
+          ::aos::time::DurationInSeconds(monotonic_now() - start_time));
   if (ShouldCancel()) return;
 
   SetShooterSpeed(0.0);
-  LOG(INFO, "Folding superstructure back down\n");
+  AOS_LOG(INFO, "Folding superstructure back down\n");
   TuckArm(true, false);
-  LOG(INFO, "Shot %f\n",
-      ::aos::time::DurationInSeconds(monotonic_now() - start_time));
+  AOS_LOG(INFO, "Shot %f\n",
+          ::aos::time::DurationInSeconds(monotonic_now() - start_time));
 
   WaitForSuperstructureLow();
 
-  LOG(INFO, "Done %f\n",
-      ::aos::time::DurationInSeconds(monotonic_now() - start_time));
+  AOS_LOG(INFO, "Done %f\n",
+          ::aos::time::DurationInSeconds(monotonic_now() - start_time));
 }
 
 void AutonomousActor::StealAndMoveOverBy(double distance) {
@@ -762,7 +763,7 @@
   MoveSuperstructure(0.10, -0.010, 0.0, {8.0, 60.0}, {4.0, 10.0}, {10.0, 25.0},
                      true, 12.0);
   if (ShouldCancel()) return;
-  LOG(INFO, "Waiting for the intake to come down.\n");
+  AOS_LOG(INFO, "Waiting for the intake to come down.\n");
 
   WaitForIntake();
   if (ShouldCancel()) return;
@@ -780,7 +781,8 @@
 bool AutonomousActor::RunAction(
     const ::frc971::autonomous::AutonomousActionParams &params) {
   monotonic_clock::time_point start_time = monotonic_now();
-  LOG(INFO, "Starting autonomous action with mode %" PRId32 "\n", params.mode);
+  AOS_LOG(INFO, "Starting autonomous action with mode %" PRId32 "\n",
+          params.mode);
 
   InitializeEncoders();
   ResetDrivetrain();
@@ -790,11 +792,11 @@
       LowBarDrive();
       if (!WaitForDriveDone()) return true;
       // Get the superstructure to unfold and get ready for shooting.
-      LOG(INFO, "Unfolding superstructure\n");
+      AOS_LOG(INFO, "Unfolding superstructure\n");
       FrontLongShot();
 
       // Spin up the shooter wheels.
-      LOG(INFO, "Spinning up the shooter wheels\n");
+      AOS_LOG(INFO, "Spinning up the shooter wheels\n");
       SetShooterSpeed(640.0);
 
       break;
@@ -802,11 +804,11 @@
       TwoFromMiddleDrive();
       if (!WaitForDriveDone()) return true;
       // Get the superstructure to unfold and get ready for shooting.
-      LOG(INFO, "Unfolding superstructure\n");
+      AOS_LOG(INFO, "Unfolding superstructure\n");
       FrontMiddleShot();
 
       // Spin up the shooter wheels.
-      LOG(INFO, "Spinning up the shooter wheels\n");
+      AOS_LOG(INFO, "Spinning up the shooter wheels\n");
       SetShooterSpeed(600.0);
 
       break;
@@ -814,11 +816,11 @@
       OneFromMiddleDrive(true);
       if (!WaitForDriveDone()) return true;
       // Get the superstructure to unfold and get ready for shooting.
-      LOG(INFO, "Unfolding superstructure\n");
+      AOS_LOG(INFO, "Unfolding superstructure\n");
       FrontMiddleShot();
 
       // Spin up the shooter wheels.
-      LOG(INFO, "Spinning up the shooter wheels\n");
+      AOS_LOG(INFO, "Spinning up the shooter wheels\n");
       SetShooterSpeed(600.0);
 
       break;
@@ -826,11 +828,11 @@
       MiddleDrive();
       if (!WaitForDriveDone()) return true;
       // Get the superstructure to unfold and get ready for shooting.
-      LOG(INFO, "Unfolding superstructure\n");
+      AOS_LOG(INFO, "Unfolding superstructure\n");
       FrontMiddleShot();
 
       // Spin up the shooter wheels.
-      LOG(INFO, "Spinning up the shooter wheels\n");
+      AOS_LOG(INFO, "Spinning up the shooter wheels\n");
       SetShooterSpeed(600.0);
 
       break;
@@ -838,11 +840,11 @@
       OneFromMiddleDrive(false);
       if (!WaitForDriveDone()) return true;
       // Get the superstructure to unfold and get ready for shooting.
-      LOG(INFO, "Unfolding superstructure\n");
+      AOS_LOG(INFO, "Unfolding superstructure\n");
       FrontMiddleShot();
 
       // Spin up the shooter wheels.
-      LOG(INFO, "Spinning up the shooter wheels\n");
+      AOS_LOG(INFO, "Spinning up the shooter wheels\n");
       SetShooterSpeed(600.0);
 
       break;
@@ -858,11 +860,11 @@
       TwoFromMiddleDrive();
       if (!WaitForDriveDone()) return true;
       // Get the superstructure to unfold and get ready for shooting.
-      LOG(INFO, "Unfolding superstructure\n");
+      AOS_LOG(INFO, "Unfolding superstructure\n");
       FrontMiddleShot();
 
       // Spin up the shooter wheels.
-      LOG(INFO, "Spinning up the shooter wheels\n");
+      AOS_LOG(INFO, "Spinning up the shooter wheels\n");
       SetShooterSpeed(600.0);
 
       break;
@@ -873,11 +875,11 @@
       OneFromMiddleDrive(true);
       if (!WaitForDriveDone()) return true;
       // Get the superstructure to unfold and get ready for shooting.
-      LOG(INFO, "Unfolding superstructure\n");
+      AOS_LOG(INFO, "Unfolding superstructure\n");
       FrontMiddleShot();
 
       // Spin up the shooter wheels.
-      LOG(INFO, "Spinning up the shooter wheels\n");
+      AOS_LOG(INFO, "Spinning up the shooter wheels\n");
       SetShooterSpeed(600.0);
 
       break;
@@ -888,11 +890,11 @@
       MiddleDrive();
       if (!WaitForDriveDone()) return true;
       // Get the superstructure to unfold and get ready for shooting.
-      LOG(INFO, "Unfolding superstructure\n");
+      AOS_LOG(INFO, "Unfolding superstructure\n");
       FrontMiddleShot();
 
       // Spin up the shooter wheels.
-      LOG(INFO, "Spinning up the shooter wheels\n");
+      AOS_LOG(INFO, "Spinning up the shooter wheels\n");
       SetShooterSpeed(600.0);
 
     } break;
@@ -903,16 +905,16 @@
       OneFromMiddleDrive(false);
       if (!WaitForDriveDone()) return true;
       // Get the superstructure to unfold and get ready for shooting.
-      LOG(INFO, "Unfolding superstructure\n");
+      AOS_LOG(INFO, "Unfolding superstructure\n");
       FrontMiddleShot();
 
       // Spin up the shooter wheels.
-      LOG(INFO, "Spinning up the shooter wheels\n");
+      AOS_LOG(INFO, "Spinning up the shooter wheels\n");
       SetShooterSpeed(600.0);
 
     } break;
     default:
-      LOG(ERROR, "Invalid auto mode %d\n", params.mode);
+      AOS_LOG(ERROR, "Invalid auto mode %d\n", params.mode);
       return true;
   }
 
@@ -921,7 +923,7 @@
   StartDrive(0.5, 0.0, kMoatDrive, kFastTurn);
   if (!WaitForDriveDone()) return true;
 
-  LOG(INFO, "Done %f\n",
+  AOS_LOG(INFO, "Done %f\n",
       ::aos::time::DurationInSeconds(monotonic_now() - start_time));
 
   ::aos::time::PhasedLoop phased_loop(::std::chrono::milliseconds(5),
@@ -931,7 +933,7 @@
   while (!ShouldCancel()) {
     phased_loop.SleepUntilNext();
   }
-  LOG(DEBUG, "Done running\n");
+  AOS_LOG(DEBUG, "Done running\n");
 
   return true;
 }
diff --git a/y2016/actors/superstructure_actor.cc b/y2016/actors/superstructure_actor.cc
index 26fdd7e..2875cbd 100644
--- a/y2016/actors/superstructure_actor.cc
+++ b/y2016/actors/superstructure_actor.cc
@@ -26,7 +26,7 @@
 
 bool SuperstructureActor::RunAction(
     const actors::SuperstructureActionParams &params) {
-  LOG(INFO, "Starting superstructure action\n");
+  AOS_LOG(INFO, "Starting superstructure action\n");
 
   MoveSuperstructure(params.partial_angle, params.shooter_angle, false);
   WaitForSuperstructure();
@@ -68,7 +68,7 @@
   new_superstructure_goal->unfold_climber = unfold_climber;
 
   if (!new_superstructure_goal.Send()) {
-    LOG(ERROR, "Sending superstructure move failed.\n");
+    AOS_LOG(ERROR, "Sending superstructure move failed.\n");
   }
 }
 
@@ -93,13 +93,13 @@
   // estopped.
   if (superstructure_status_fetcher_->state < 12 ||
       superstructure_status_fetcher_->state == 16) {
-    LOG(ERROR, "Superstructure no longer running, aborting action\n");
+    AOS_LOG(ERROR, "Superstructure no longer running, aborting action\n");
     return true;
   }
 
   if (SuperstructureProfileDone()) {
-    LOG(DEBUG, "Profile done.\n");
-      return true;
+    AOS_LOG(DEBUG, "Profile done.\n");
+    return true;
   }
   return false;
 }
diff --git a/y2016/actors/vision_align_actor.cc b/y2016/actors/vision_align_actor.cc
index f42aad9..1685d22 100644
--- a/y2016/actors/vision_align_actor.cc
+++ b/y2016/actors/vision_align_actor.cc
@@ -42,8 +42,8 @@
   while (true) {
     const int iterations = phased_loop.SleepUntilNext();
     if (iterations != 1) {
-      LOG(WARNING, "vision align actor skipped %d iterations\n",
-          iterations - 1);
+      AOS_LOG(WARNING, "vision align actor skipped %d iterations\n",
+              iterations - 1);
     }
 
     if (ShouldCancel()) {
@@ -77,11 +77,11 @@
     drivetrain_message->right_goal = right_current - side_distance_change;
 
     if (!drivetrain_message.Send()) {
-      LOG(WARNING, "sending drivetrain goal failed\n");
+      AOS_LOG(WARNING, "sending drivetrain goal failed\n");
     }
   }
 
-  LOG(INFO, "Done moving\n");
+  AOS_LOG(INFO, "Done moving\n");
   return true;
 }
 
diff --git a/y2016/constants.cc b/y2016/constants.cc
index d4f61c1..8518b6b 100644
--- a/y2016/constants.cc
+++ b/y2016/constants.cc
@@ -142,13 +142,13 @@
       };
       break;
     default:
-      LOG(FATAL, "unknown team #%" PRIu16 "\n", team);
+      AOS_LOG(FATAL, "unknown team #%" PRIu16 "\n", team);
   }
 }
 
 const Values *DoGetValues() {
   uint16_t team = ::aos::network::GetTeamNumber();
-  LOG(INFO, "creating a Constants for team %" PRIu16 "\n", team);
+  AOS_LOG(INFO, "creating a Constants for team %" PRIu16 "\n", team);
   return DoGetValuesForTeam(team);
 }
 
diff --git a/y2016/control_loops/superstructure/superstructure.cc b/y2016/control_loops/superstructure/superstructure.cc
index c3155bf..99a130c 100644
--- a/y2016/control_loops/superstructure/superstructure.cc
+++ b/y2016/control_loops/superstructure/superstructure.cc
@@ -175,11 +175,12 @@
       shoulder_angle <=
           CollisionAvoidance::kMinShoulderAngleForIntakeUpInterference &&
       intake_angle > CollisionAvoidance::kMaxIntakeAngleBeforeArmInterference) {
-    LOG(DEBUG, "Collided: Intake %f > %f, and shoulder %f < %f < %f.\n",
-        intake_angle, CollisionAvoidance::kMaxIntakeAngleBeforeArmInterference,
-        CollisionAvoidance::kMaxShoulderAngleUntilSafeIntakeStowing,
-        shoulder_angle,
-        CollisionAvoidance::kMinShoulderAngleForIntakeUpInterference);
+    AOS_LOG(DEBUG, "Collided: Intake %f > %f, and shoulder %f < %f < %f.\n",
+            intake_angle,
+            CollisionAvoidance::kMaxIntakeAngleBeforeArmInterference,
+            CollisionAvoidance::kMaxShoulderAngleUntilSafeIntakeStowing,
+            shoulder_angle,
+            CollisionAvoidance::kMinShoulderAngleForIntakeUpInterference);
     return true;
   }
 
@@ -191,7 +192,8 @@
       intake_angle > Superstructure::kIntakeLowerClear &&
       (wrist_angle > CollisionAvoidance::kMaxWristAngleForMovingByIntake ||
        wrist_angle < CollisionAvoidance::kMinWristAngleForMovingByIntake)) {
-    LOG(DEBUG,
+    AOS_LOG(
+        DEBUG,
         "Collided: Intake %f < %f < %f, shoulder %f < %f < %f, and %f < %f < "
         "%f.\n",
         Superstructure::kIntakeLowerClear, intake_angle,
@@ -209,10 +211,10 @@
   if (shoulder_angle <
           CollisionAvoidance::kMinShoulderAngleForHorizontalShooter &&
       ::std::abs(wrist_angle) > kMaxWristAngleForSafeArmStowing) {
-    LOG(DEBUG, "Collided: Shoulder %f < %f and wrist |%f| > %f.\n",
-        shoulder_angle,
-        CollisionAvoidance::kMinShoulderAngleForHorizontalShooter, wrist_angle,
-        kMaxWristAngleForSafeArmStowing);
+    AOS_LOG(DEBUG, "Collided: Shoulder %f < %f and wrist |%f| > %f.\n",
+            shoulder_angle,
+            CollisionAvoidance::kMinShoulderAngleForHorizontalShooter,
+            wrist_angle, kMaxWristAngleForSafeArmStowing);
     return true;
   }
 
@@ -293,7 +295,7 @@
     control_loops::SuperstructureQueue::Status *status) {
   const State state_before_switch = state_;
   if (WasReset()) {
-    LOG(ERROR, "WPILib reset, restarting\n");
+    AOS_LOG(ERROR, "WPILib reset, restarting\n");
     arm_.Reset();
     intake_.Reset();
     state_ = UNINITIALIZED;
@@ -323,7 +325,7 @@
     case UNINITIALIZED:
       // Wait in the uninitialized state until both the arm and intake are
       // initialized.
-      LOG(DEBUG, "Uninitialized, waiting for intake and arm\n");
+      AOS_LOG(DEBUG, "Uninitialized, waiting for intake and arm\n");
       if (arm_.initialized() && intake_.initialized()) {
         state_ = DISABLED_INITIALIZED;
       }
@@ -414,10 +416,10 @@
         if (arm_.zeroed() && intake_.zeroed()) {
           state_ = RUNNING;
         } else if (IsArmNear(kLooseTolerance)) {
-          LOG(ERROR,
-              "Failed to zero while executing the HIGH_ARM_ZERO sequence. "
-              "Arm: %d Intake %d\n",
-              arm_.zeroed(), intake_.zeroed());
+          AOS_LOG(ERROR,
+                  "Failed to zero while executing the HIGH_ARM_ZERO sequence. "
+                  "Arm: %d Intake %d\n",
+                  arm_.zeroed(), intake_.zeroed());
           state_ = ESTOP;
         }
       }
@@ -515,10 +517,10 @@
           if (arm_.zeroed() && intake_.zeroed()) {
             state_ = RUNNING;
           } else {
-            LOG(ERROR,
-                "Failed to zero while executing the LOW_ARM_ZERO sequence. "
-                "Arm: %d Intake %d\n",
-                arm_.zeroed(), intake_.zeroed());
+            AOS_LOG(ERROR,
+                    "Failed to zero while executing the LOW_ARM_ZERO sequence. "
+                    "Arm: %d Intake %d\n",
+                    arm_.zeroed(), intake_.zeroed());
             state_ = ESTOP;
           }
         }
@@ -627,7 +629,7 @@
     } break;
 
     case ESTOP:
-      LOG(ERROR, "Estop\n");
+      AOS_LOG(ERROR, "Estop\n");
       disable = true;
       break;
   }
diff --git a/y2016/control_loops/superstructure/superstructure_controls.cc b/y2016/control_loops/superstructure/superstructure_controls.cc
index e787f79..b8f3a48 100644
--- a/y2016/control_loops/superstructure/superstructure_controls.cc
+++ b/y2016/control_loops/superstructure/superstructure_controls.cc
@@ -55,7 +55,8 @@
 
 void Arm::UpdateWristOffset(double offset) {
   const double doffset = offset - offset_(1, 0);
-  LOG(INFO, "Adjusting Wrist offset from %f to %f\n", offset_(1, 0), offset);
+  AOS_LOG(INFO, "Adjusting Wrist offset from %f to %f\n", offset_(1, 0),
+          offset);
 
   loop_->mutable_X_hat()(2, 0) += doffset;
   Y_(1, 0) += doffset;
@@ -72,7 +73,8 @@
 
 void Arm::UpdateShoulderOffset(double offset) {
   const double doffset = offset - offset_(0, 0);
-  LOG(INFO, "Adjusting Shoulder offset from %f to %f\n", offset_(0, 0), offset);
+  AOS_LOG(INFO, "Adjusting Shoulder offset from %f to %f\n", offset_(0, 0),
+          offset);
 
   loop_->mutable_X_hat()(0, 0) += doffset;
   loop_->mutable_X_hat()(2, 0) += doffset;
@@ -101,11 +103,11 @@
 
   // Handle zeroing errors
   if (estimators_[kShoulderIndex].error()) {
-    LOG(ERROR, "zeroing error with shoulder_estimator\n");
+    AOS_LOG(ERROR, "zeroing error with shoulder_estimator\n");
     return;
   }
   if (estimators_[kWristIndex].error()) {
-    LOG(ERROR, "zeroing error with wrist_estimator\n");
+    AOS_LOG(ERROR, "zeroing error with wrist_estimator\n");
     return;
   }
 
@@ -138,26 +140,26 @@
   // Limit the goals to min/max allowable angles.
 
   if ((*goal)(0, 0) > constants::Values::kShoulderRange.upper) {
-    LOG(WARNING, "Shoulder goal %s above limit, %f > %f\n", name, (*goal)(0, 0),
-        constants::Values::kShoulderRange.upper);
+    AOS_LOG(WARNING, "Shoulder goal %s above limit, %f > %f\n", name,
+            (*goal)(0, 0), constants::Values::kShoulderRange.upper);
     (*goal)(0, 0) = constants::Values::kShoulderRange.upper;
   }
   if ((*goal)(0, 0) < constants::Values::kShoulderRange.lower) {
-    LOG(WARNING, "Shoulder goal %s below limit, %f < %f\n", name, (*goal)(0, 0),
-        constants::Values::kShoulderRange.lower);
+    AOS_LOG(WARNING, "Shoulder goal %s below limit, %f < %f\n", name,
+            (*goal)(0, 0), constants::Values::kShoulderRange.lower);
     (*goal)(0, 0) = constants::Values::kShoulderRange.lower;
   }
 
   const double wrist_goal_angle_ungrounded = (*goal)(2, 0) - (*goal)(0, 0);
 
   if (wrist_goal_angle_ungrounded > constants::Values::kWristRange.upper) {
-    LOG(WARNING, "Wrist goal %s above limit, %f > %f\n", name,
-        wrist_goal_angle_ungrounded, constants::Values::kWristRange.upper);
+    AOS_LOG(WARNING, "Wrist goal %s above limit, %f > %f\n", name,
+            wrist_goal_angle_ungrounded, constants::Values::kWristRange.upper);
     (*goal)(2, 0) = constants::Values::kWristRange.upper + (*goal)(0, 0);
   }
   if (wrist_goal_angle_ungrounded < constants::Values::kWristRange.lower) {
-    LOG(WARNING, "Wrist goal %s below limit, %f < %f\n", name,
-        wrist_goal_angle_ungrounded, constants::Values::kWristRange.lower);
+    AOS_LOG(WARNING, "Wrist goal %s below limit, %f < %f\n", name,
+            wrist_goal_angle_ungrounded, constants::Values::kWristRange.lower);
     (*goal)(2, 0) = constants::Values::kWristRange.lower + (*goal)(0, 0);
   }
 }
@@ -195,9 +197,9 @@
 bool Arm::CheckHardLimits() {
   if (shoulder_angle() > constants::Values::kShoulderRange.upper_hard ||
       shoulder_angle() < constants::Values::kShoulderRange.lower_hard) {
-    LOG(ERROR, "Shoulder at %f out of bounds [%f, %f], ESTOPing\n",
-        shoulder_angle(), constants::Values::kShoulderRange.lower_hard,
-        constants::Values::kShoulderRange.upper_hard);
+    AOS_LOG(ERROR, "Shoulder at %f out of bounds [%f, %f], ESTOPing\n",
+            shoulder_angle(), constants::Values::kShoulderRange.lower_hard,
+            constants::Values::kShoulderRange.upper_hard);
     return true;
   }
 
@@ -205,10 +207,10 @@
           constants::Values::kWristRange.upper_hard ||
       wrist_angle() - shoulder_angle() <
           constants::Values::kWristRange.lower_hard) {
-    LOG(ERROR, "Wrist at %f out of bounds [%f, %f], ESTOPing\n",
-        wrist_angle() - shoulder_angle(),
-        constants::Values::kWristRange.lower_hard,
-        constants::Values::kWristRange.upper_hard);
+    AOS_LOG(ERROR, "Wrist at %f out of bounds [%f, %f], ESTOPing\n",
+            wrist_angle() - shoulder_angle(),
+            constants::Values::kWristRange.lower_hard,
+            constants::Values::kWristRange.upper_hard);
     return true;
   }
 
@@ -239,15 +241,15 @@
 
   // Shoulder saturated
   if (!disable && loop_->U(0, 0) != loop_->U_uncapped(0, 0)) {
-    LOG(DEBUG, "Moving shoulder state.  U: %f, %f\n", loop_->U(0, 0),
-        loop_->U_uncapped(0, 0));
+    AOS_LOG(DEBUG, "Moving shoulder state.  U: %f, %f\n", loop_->U(0, 0),
+            loop_->U_uncapped(0, 0));
     shoulder_profile_.MoveCurrentState(loop_->R().block<2, 1>(0, 0));
   }
 
   // Wrist saturated
   if (!disable && loop_->U(1, 0) != loop_->U_uncapped(1, 0)) {
-    LOG(DEBUG, "Moving shooter state.  U: %f, %f\n", loop_->U(1, 0),
-        loop_->U_uncapped(1, 0));
+    AOS_LOG(DEBUG, "Moving shooter state.  U: %f, %f\n", loop_->U(1, 0),
+            loop_->U_uncapped(1, 0));
     wrist_profile_.MoveCurrentState(loop_->R().block<2, 1>(2, 0));
   }
 }
diff --git a/y2016/control_loops/superstructure/superstructure_controls.h b/y2016/control_loops/superstructure/superstructure_controls.h
index 49c8097..8936650 100644
--- a/y2016/control_loops/superstructure/superstructure_controls.h
+++ b/y2016/control_loops/superstructure/superstructure_controls.h
@@ -41,9 +41,9 @@
 
     const double bemf_voltage = X_hat(1, 0) / kV_shoulder;
     bool use_accelerating_controller = true;
-    LOG(DEBUG, "Accelerating at %f, decel %f, bemf %f\n",
-        accelerating_controller(0, 0), accelerating_controller(1, 0),
-        bemf_voltage);
+    AOS_LOG(DEBUG, "Accelerating at %f, decel %f, bemf %f\n",
+            accelerating_controller(0, 0), accelerating_controller(1, 0),
+            bemf_voltage);
     if (IsAccelerating(bemf_voltage, accelerating_controller(0, 0))) {
       use_accelerating_controller = true;
     } else {
@@ -71,7 +71,7 @@
       const double coupled_amount = (controller().Kff().block<1, 2>(1, 2) *
                                      plant().B().block<2, 1>(2, 0))(0, 0) *
                                     overage_amount;
-      LOG(DEBUG, "Removing coupled amount %f\n", coupled_amount);
+      AOS_LOG(DEBUG, "Removing coupled amount %f\n", coupled_amount);
       mutable_U(1, 0) += coupled_amount;
     }
     if (U(0, 0) < min_voltage(0)) {
@@ -80,7 +80,7 @@
       const double coupled_amount = (controller().Kff().block<1, 2>(1, 2) *
                                      plant().B().block<2, 1>(2, 0))(0, 0) *
                                     under_amount;
-      LOG(DEBUG, "Removing coupled amount %f\n", coupled_amount);
+      AOS_LOG(DEBUG, "Removing coupled amount %f\n", coupled_amount);
       mutable_U(1, 0) += coupled_amount;
     }
 
diff --git a/y2016/control_loops/superstructure/superstructure_lib_test.cc b/y2016/control_loops/superstructure/superstructure_lib_test.cc
index 969102f..79b4d24 100644
--- a/y2016/control_loops/superstructure/superstructure_lib_test.cc
+++ b/y2016/control_loops/superstructure/superstructure_lib_test.cc
@@ -194,24 +194,24 @@
     if (superstructure_status_fetcher_->state == Superstructure::RUNNING ||
         superstructure_status_fetcher_->state ==
             Superstructure::LANDING_RUNNING) {
-      CHECK_LE(::std::abs(superstructure_output_fetcher_->voltage_intake),
-               Superstructure::kOperatingVoltage);
-      CHECK_LE(::std::abs(superstructure_output_fetcher_->voltage_shoulder),
-               Superstructure::kOperatingVoltage);
-      CHECK_LE(::std::abs(superstructure_output_fetcher_->voltage_wrist),
-               Superstructure::kOperatingVoltage);
+      AOS_CHECK_LE(::std::abs(superstructure_output_fetcher_->voltage_intake),
+                   Superstructure::kOperatingVoltage);
+      AOS_CHECK_LE(::std::abs(superstructure_output_fetcher_->voltage_shoulder),
+                   Superstructure::kOperatingVoltage);
+      AOS_CHECK_LE(::std::abs(superstructure_output_fetcher_->voltage_wrist),
+                   Superstructure::kOperatingVoltage);
     } else {
-      CHECK_LE(::std::abs(superstructure_output_fetcher_->voltage_intake),
-               Superstructure::kZeroingVoltage);
-      CHECK_LE(::std::abs(superstructure_output_fetcher_->voltage_shoulder),
-               Superstructure::kZeroingVoltage);
-      CHECK_LE(::std::abs(superstructure_output_fetcher_->voltage_wrist),
-               Superstructure::kZeroingVoltage);
+      AOS_CHECK_LE(::std::abs(superstructure_output_fetcher_->voltage_intake),
+                   Superstructure::kZeroingVoltage);
+      AOS_CHECK_LE(::std::abs(superstructure_output_fetcher_->voltage_shoulder),
+                   Superstructure::kZeroingVoltage);
+      AOS_CHECK_LE(::std::abs(superstructure_output_fetcher_->voltage_wrist),
+                   Superstructure::kZeroingVoltage);
     }
     if (arm_plant_->X(0, 0) <=
         Superstructure::kShoulderTransitionToLanded + 1e-4) {
-      CHECK_GE(superstructure_output_fetcher_->voltage_shoulder,
-               Superstructure::kLandingShoulderDownVoltage - 0.00001);
+      AOS_CHECK_GE(superstructure_output_fetcher_->voltage_shoulder,
+                   Superstructure::kLandingShoulderDownVoltage - 0.00001);
     }
 
     // Use the plant to generate the next physical state given the voltages to
diff --git a/y2016/dashboard/dashboard.cc b/y2016/dashboard/dashboard.cc
index d69afcb..27036e0 100644
--- a/y2016/dashboard/dashboard.cc
+++ b/y2016/dashboard/dashboard.cc
@@ -152,7 +152,7 @@
 
 void DataCollector::AddPoint(const ::std::string &name, double value) {
   // Mutex should be locked when this method is called to synchronize packets.
-  CHECK(mutex_.OwnedBySelf());
+  AOS_CHECK(mutex_.OwnedBySelf());
 
   size_t index = GetIndex(sample_id_);
 
@@ -254,8 +254,8 @@
 
 void SocketHandler::onConnect(seasocks::WebSocket *connection) {
   connections_.insert(connection);
-  LOG(INFO, "Connected: %s : %s\n", connection->getRequestUri().c_str(),
-      seasocks::formatAddress(connection->getRemoteAddress()).c_str());
+  AOS_LOG(INFO, "Connected: %s : %s\n", connection->getRequestUri().c_str(),
+          seasocks::formatAddress(connection->getRemoteAddress()).c_str());
 }
 
 void SocketHandler::onData(seasocks::WebSocket *connection, const char *data) {
@@ -267,8 +267,8 @@
 
 void SocketHandler::onDisconnect(seasocks::WebSocket *connection) {
   connections_.erase(connection);
-  LOG(INFO, "Disconnected: %s : %s\n", connection->getRequestUri().c_str(),
-      seasocks::formatAddress(connection->getRemoteAddress()).c_str());
+  AOS_LOG(INFO, "Disconnected: %s : %s\n", connection->getRequestUri().c_str(),
+          seasocks::formatAddress(connection->getRemoteAddress()).c_str());
 }
 
 void SocketHandler::Quit() {
diff --git a/y2016/joystick_reader.cc b/y2016/joystick_reader.cc
index 4e4ccef..276fda6 100644
--- a/y2016/joystick_reader.cc
+++ b/y2016/joystick_reader.cc
@@ -126,10 +126,10 @@
         actors::VisionAlignActionParams params;
         EnqueueAction(vision_align_action_factory_.Make(params));
         vision_action_running_ = true;
-        LOG(INFO, "Starting vision align\n");
+        AOS_LOG(INFO, "Starting vision align\n");
       } else {
         if (!vision_valid_) {
-          LOG(INFO, "Vision align but not valid\n");
+          AOS_LOG(INFO, "Vision align but not valid\n");
         }
       }
     }
@@ -147,7 +147,7 @@
   void HandleTeleop(const ::aos::input::driver_station::Data &data) {
     if (!data.GetControlBit(ControlBit::kEnabled)) {
       // If we are not enabled, reset the waiting for zero bit.
-      LOG(DEBUG, "Waiting for zero.\n");
+      AOS_LOG(DEBUG, "Waiting for zero.\n");
       waiting_for_zero_ = true;
     }
 
@@ -158,18 +158,18 @@
     bool force_lights_on = false;
     if (!data.GetControlBit(ControlBit::kEnabled)) {
       CancelAllActions();
-      LOG(DEBUG, "Canceling\n");
+      AOS_LOG(DEBUG, "Canceling\n");
     }
 
     superstructure_status_fetcher_.Fetch();
     if (!superstructure_status_fetcher_.get()) {
-      LOG(ERROR, "Got no superstructure status packet.\n");
+      AOS_LOG(ERROR, "Got no superstructure status packet.\n");
     }
 
     if (superstructure_status_fetcher_.get() &&
         superstructure_status_fetcher_->zeroed) {
       if (waiting_for_zero_) {
-        LOG(DEBUG, "Zeroed! Starting teleop mode.\n");
+        AOS_LOG(DEBUG, "Zeroed! Starting teleop mode.\n");
         waiting_for_zero_ = false;
       }
     } else {
@@ -379,10 +379,10 @@
         new_superstructure_goal->force_intake = true;
 
         if (!new_superstructure_goal.Send()) {
-          LOG(ERROR, "Sending superstructure goal failed.\n");
+          AOS_LOG(ERROR, "Sending superstructure goal failed.\n");
         } else {
-          LOG(DEBUG, "sending goals: intake: %f, shoulder: %f, wrist: %f\n",
-              intake_goal_, shoulder_goal_, wrist_goal_);
+          AOS_LOG(DEBUG, "sending goals: intake: %f, shoulder: %f, wrist: %f\n",
+                  intake_goal_, shoulder_goal_, wrist_goal_);
         }
       }
 
@@ -394,7 +394,7 @@
       shooter_message->shooting_forwards = wrist_goal_ > 0;
 
       if (!shooter_message.Send()) {
-        LOG(ERROR, "Sending shooter goal failed.\n");
+        AOS_LOG(ERROR, "Sending shooter goal failed.\n");
       }
     }
   }
diff --git a/y2016/vision/stereo_geometry.cc b/y2016/vision/stereo_geometry.cc
index b58cb82..a58675c 100644
--- a/y2016/vision/stereo_geometry.cc
+++ b/y2016/vision/stereo_geometry.cc
@@ -10,8 +10,8 @@
       return calibration.calibration();
     }
   }
-  LOG(FATAL, "no calibration for %s found in %s\n", robot_name.c_str(),
-      calibration_file.ShortDebugString().c_str());
+  AOS_LOG(FATAL, "no calibration for %s found in %s\n", robot_name.c_str(),
+          calibration_file.ShortDebugString().c_str());
 }
 
 }  // namespace vision
diff --git a/y2016/vision/target_receiver.cc b/y2016/vision/target_receiver.cc
index a496848..a66be59 100644
--- a/y2016/vision/target_receiver.cc
+++ b/y2016/vision/target_receiver.cc
@@ -304,8 +304,8 @@
           ".y2016.vision.vision_status");
 
   StereoGeometry stereo(constants::GetValues().vision_name);
-  LOG(INFO, "calibration: %s\n",
-      stereo.calibration().ShortDebugString().c_str());
+  AOS_LOG(INFO, "calibration: %s\n",
+          stereo.calibration().ShortDebugString().c_str());
 
   DrivetrainOffsetCalculator drivetrain_offset(&event_loop);
 
@@ -328,7 +328,7 @@
         right.Received(target, now);
       }
     } else {
-      LOG(ERROR, "oh noes: parse error\n");
+      AOS_LOG(ERROR, "oh noes: parse error\n");
       continue;
     }
 
@@ -404,20 +404,22 @@
       }
 
       if (drivetrain_offset.CompleteVisionStatus(new_vision_status.get())) {
-        LOG_STRUCT(DEBUG, "vision", *new_vision_status);
+        AOS_LOG_STRUCT(DEBUG, "vision", *new_vision_status);
         if (!new_vision_status.Send()) {
-          LOG(ERROR, "Failed to send vision information\n");
+          AOS_LOG(ERROR, "Failed to send vision information\n");
         }
       } else {
-        LOG_STRUCT(WARNING, "vision without drivetrain", *new_vision_status);
+        AOS_LOG_STRUCT(WARNING, "vision without drivetrain",
+                       *new_vision_status);
       }
     }
 
     if (target.camera_index() == 0) {
-      LOG(DEBUG, "left_target: %s\n", left.target().ShortDebugString().c_str());
+      AOS_LOG(DEBUG, "left_target: %s\n",
+              left.target().ShortDebugString().c_str());
     } else {
-      LOG(DEBUG, "right_target: %s\n",
-          right.target().ShortDebugString().c_str());
+      AOS_LOG(DEBUG, "right_target: %s\n",
+              right.target().ShortDebugString().c_str());
     }
   }
 }
diff --git a/y2016/wpilib_interface.cc b/y2016/wpilib_interface.cc
index 5b5fecb..9b31a0f 100644
--- a/y2016/wpilib_interface.cc
+++ b/y2016/wpilib_interface.cc
@@ -307,7 +307,7 @@
     {
       auto ball_detector_message = ball_detector_sender_.MakeMessage();
       ball_detector_message->voltage = ball_detector_->GetVoltage();
-      LOG_STRUCT(DEBUG, "ball detector", *ball_detector_message);
+      AOS_LOG_STRUCT(DEBUG, "ball detector", *ball_detector_message);
       ball_detector_message.Send();
     }
 
@@ -319,7 +319,7 @@
           auto_mode_message->mode |= 1 << i;
         }
       }
-      LOG_STRUCT(DEBUG, "auto mode", *auto_mode_message);
+      AOS_LOG_STRUCT(DEBUG, "auto mode", *auto_mode_message);
       auto_mode_message.Send();
     }
   }
@@ -414,13 +414,13 @@
  private:
   void Loop(const int iterations) {
     if (iterations != 1) {
-      LOG(DEBUG, "Solenoids skipped %d iterations\n", iterations - 1);
+      AOS_LOG(DEBUG, "Solenoids skipped %d iterations\n", iterations - 1);
     }
 
     {
       drivetrain_.Fetch();
       if (drivetrain_.get()) {
-        LOG_STRUCT(DEBUG, "solenoids", *drivetrain_);
+        AOS_LOG_STRUCT(DEBUG, "solenoids", *drivetrain_);
         drivetrain_shifter_->Set(
             !(drivetrain_->left_high || drivetrain_->right_high));
       }
@@ -429,7 +429,7 @@
     {
       shooter_.Fetch();
       if (shooter_.get()) {
-        LOG_STRUCT(DEBUG, "solenoids", *shooter_);
+        AOS_LOG_STRUCT(DEBUG, "solenoids", *shooter_);
         shooter_clamp_->Set(shooter_->clamp_open);
         shooter_pusher_->Set(shooter_->push_to_shooter);
         lights_->Set(shooter_->lights_on);
@@ -452,7 +452,7 @@
     {
       superstructure_.Fetch();
       if (superstructure_.get()) {
-        LOG_STRUCT(DEBUG, "solenoids", *superstructure_);
+        AOS_LOG_STRUCT(DEBUG, "solenoids", *superstructure_);
 
         climber_trigger_->Set(superstructure_->unfold_climber);
 
@@ -467,7 +467,7 @@
 
       pcm_->Flush();
       to_log.read_solenoids = pcm_->GetAll();
-      LOG_STRUCT(DEBUG, "pneumatics info", to_log);
+      AOS_LOG_STRUCT(DEBUG, "pneumatics info", to_log);
     }
   }
 
@@ -501,14 +501,14 @@
 
  private:
   void Write(const ShooterQueue::Output &output) override {
-    LOG_STRUCT(DEBUG, "will output", output);
+    AOS_LOG_STRUCT(DEBUG, "will output", output);
 
     shooter_left_talon_->SetSpeed(output.voltage_left / 12.0);
     shooter_right_talon_->SetSpeed(-output.voltage_right / 12.0);
   }
 
   void Stop() override {
-    LOG(WARNING, "Shooter output too old.\n");
+    AOS_LOG(WARNING, "Shooter output too old.\n");
     shooter_left_talon_->SetDisabled();
     shooter_right_talon_->SetDisabled();
   }
@@ -551,7 +551,7 @@
  private:
   virtual void Write(const ::y2016::control_loops::SuperstructureQueue::Output
                          &output) override {
-    LOG_STRUCT(DEBUG, "will output", output);
+    AOS_LOG_STRUCT(DEBUG, "will output", output);
     intake_talon_->SetSpeed(::aos::Clip(output.voltage_intake,
                                         -kMaxBringupPower, kMaxBringupPower) /
                             12.0);
@@ -567,7 +567,7 @@
   }
 
   virtual void Stop() override {
-    LOG(WARNING, "Superstructure output too old.\n");
+    AOS_LOG(WARNING, "Superstructure output too old.\n");
     intake_talon_->SetDisabled();
     shoulder_talon_->SetDisabled();
     wrist_talon_->SetDisabled();
diff --git a/y2017/actors/autonomous_actor.cc b/y2017/actors/autonomous_actor.cc
index fa072ac..a678e79 100644
--- a/y2017/actors/autonomous_actor.cc
+++ b/y2017/actors/autonomous_actor.cc
@@ -49,7 +49,8 @@
 bool AutonomousActor::RunAction(
     const ::frc971::autonomous::AutonomousActionParams &params) {
   const monotonic_clock::time_point start_time = monotonic_now();
-  LOG(INFO, "Starting autonomous action with mode %" PRId32 "\n", params.mode);
+  AOS_LOG(INFO, "Starting autonomous action with mode %" PRId32 "\n",
+          params.mode);
   Reset();
 
   switch (params.mode) {
@@ -129,12 +130,12 @@
       StartDrive(kLongPegDrive, -kDriveDirection * M_PI / 4, kGearDrive,
                  kFirstGearStartTurn);
       if (!WaitForDriveNear(100.0, M_PI / 8.0)) return true;
-      LOG(INFO, "Turn Middle: %f left to go\n", DriveDistanceLeft());
+      AOS_LOG(INFO, "Turn Middle: %f left to go\n", DriveDistanceLeft());
 
       StartDrive(0.0, 0.0, kGearDrive, kFirstGearTurn);
 
       if (!WaitForTurnProfileDone()) return true;
-      LOG(INFO, "Turn profile ended: %f left to go\n", DriveDistanceLeft());
+      AOS_LOG(INFO, "Turn profile ended: %f left to go\n", DriveDistanceLeft());
 
       set_hood_goal(0.43);
       set_shooter_velocity(364.0);
@@ -179,8 +180,8 @@
       set_gear_servo(0.4);
 
       SendSuperstructureGoal();
-      LOG(INFO, "Starting drive back %f\n",
-          ::aos::time::DurationInSeconds(monotonic_now() - start_time));
+      AOS_LOG(INFO, "Starting drive back %f\n",
+              ::aos::time::DurationInSeconds(monotonic_now() - start_time));
 
       StartDrive(-2.75, kDriveDirection * 1.24, kSlowDrive,
                  kFirstGearStartTurn);
@@ -202,8 +203,8 @@
       if (!WaitForDriveNear(0.2, 0.2)) return true;
       StartDrive(0.0, -kDriveDirection * 0.15, kSlowDrive, kSmashTurn);
 
-      LOG(INFO, "Starting second shot %f\n",
-          ::aos::time::DurationInSeconds(monotonic_now() - start_time));
+      AOS_LOG(INFO, "Starting second shot %f\n",
+              ::aos::time::DurationInSeconds(monotonic_now() - start_time));
       set_indexer_angular_velocity(-2.15 * M_PI);
       SendSuperstructureGoal();
       if (!WaitForDriveNear(0.2, 0.1)) return true;
@@ -236,11 +237,11 @@
       StartDrive(-3.42, kDriveDirection * (M_PI / 10 - 0.057), kSlowDrive,
                  kFirstTurn);
       if (!WaitForDriveNear(3.30, 0.0)) return true;
-      LOG(INFO, "Turn ended: %f left to go\n", DriveDistanceLeft());
+      AOS_LOG(INFO, "Turn ended: %f left to go\n", DriveDistanceLeft());
       // We can go to 2.50 before we hit the previous profile.
 
       if (!WaitForDriveNear(2.48, 0.0)) return true;
-      LOG(INFO, "%f left to go\n", DriveDistanceLeft());
+      AOS_LOG(INFO, "%f left to go\n", DriveDistanceLeft());
 
       set_intake_goal(0.23);
       set_turret_goal(0.0);
@@ -279,8 +280,8 @@
       set_indexer_angular_velocity(-2.1 * M_PI);
       SendSuperstructureGoal();
 
-      LOG(INFO, "Started shooting at %f\n",
-          ::aos::time::DurationInSeconds(monotonic_now() - start_time));
+      AOS_LOG(INFO, "Started shooting at %f\n",
+              ::aos::time::DurationInSeconds(monotonic_now() - start_time));
 
       this_thread::sleep_for(start_time + chrono::seconds(9) - monotonic_now());
       if (ShouldCancel()) return true;
@@ -300,8 +301,8 @@
     } break;
   }
 
-  LOG(INFO, "Done %f\n",
-      ::aos::time::DurationInSeconds(monotonic_now() - start_time));
+  AOS_LOG(INFO, "Done %f\n",
+          ::aos::time::DurationInSeconds(monotonic_now() - start_time));
 
   ::aos::time::PhasedLoop phased_loop(::std::chrono::milliseconds(5),
                                       event_loop()->monotonic_now(),
@@ -310,7 +311,7 @@
   while (!ShouldCancel()) {
     phased_loop.SleepUntilNext();
   }
-  LOG(DEBUG, "Done running\n");
+  AOS_LOG(DEBUG, "Done running\n");
 
   return true;
 }
diff --git a/y2017/actors/autonomous_actor.h b/y2017/actors/autonomous_actor.h
index c10b003..f5d4c3f 100644
--- a/y2017/actors/autonomous_actor.h
+++ b/y2017/actors/autonomous_actor.h
@@ -125,7 +125,7 @@
     }
 
     if (!new_superstructure_goal.Send()) {
-      LOG(ERROR, "Sending superstructure goal failed.\n");
+      AOS_LOG(ERROR, "Sending superstructure goal failed.\n");
     }
   }
 };
diff --git a/y2017/constants.cc b/y2017/constants.cc
index 6f77838..e765acf 100644
--- a/y2017/constants.cc
+++ b/y2017/constants.cc
@@ -146,7 +146,7 @@
       break;
 
     default:
-      LOG(FATAL, "unknown team #%" PRIu16 "\n", team);
+      AOS_LOG(FATAL, "unknown team #%" PRIu16 "\n", team);
   }
 
   return r;
@@ -154,7 +154,7 @@
 
 const Values *DoGetValues() {
   uint16_t team = ::aos::network::GetTeamNumber();
-  LOG(INFO, "creating a Constants for team %" PRIu16 "\n", team);
+  AOS_LOG(INFO, "creating a Constants for team %" PRIu16 "\n", team);
   return DoGetValuesForTeam(team);
 }
 
diff --git a/y2017/control_loops/superstructure/column/column.cc b/y2017/control_loops/superstructure/column/column.cc
index 2a3cde7..ab1ff72 100644
--- a/y2017/control_loops/superstructure/column/column.cc
+++ b/y2017/control_loops/superstructure/column/column.cc
@@ -71,10 +71,10 @@
   const double indexer_doffset = indexer_offset - offset_(0, 0);
   const double turret_doffset = turret_offset - offset_(1, 0);
 
-  LOG(INFO, "Adjusting indexer offset from %f to %f\n", offset_(0, 0),
-      indexer_offset);
-  LOG(INFO, "Adjusting turret offset from %f to %f\n", offset_(1, 0),
-      turret_offset);
+  AOS_LOG(INFO, "Adjusting indexer offset from %f to %f\n", offset_(0, 0),
+          indexer_offset);
+  AOS_LOG(INFO, "Adjusting turret offset from %f to %f\n", offset_(1, 0),
+          turret_offset);
 
   loop_->mutable_X_hat()(0, 0) += indexer_doffset;
   loop_->mutable_X_hat()(2, 0) += turret_doffset + indexer_doffset;
@@ -99,7 +99,7 @@
   estimators_[0].UpdateEstimate(new_position);
 
   if (estimators_[0].error()) {
-    LOG(ERROR, "zeroing error\n");
+    AOS_LOG(ERROR, "zeroing error\n");
     return;
   }
 
@@ -162,13 +162,13 @@
   // Limit the goal to min/max allowable positions.
   if (zeroed()) {
     if ((*goal)(2, 0) > range_.upper) {
-      LOG(WARNING, "Goal %s above limit, %f > %f\n", name, (*goal)(2, 0),
-          range_.upper);
+      AOS_LOG(WARNING, "Goal %s above limit, %f > %f\n", name, (*goal)(2, 0),
+              range_.upper);
       (*goal)(2, 0) = range_.upper;
     }
     if ((*goal)(2, 0) < range_.lower) {
-      LOG(WARNING, "Goal %s below limit, %f < %f\n", name, (*goal)(2, 0),
-          range_.lower);
+      AOS_LOG(WARNING, "Goal %s below limit, %f < %f\n", name, (*goal)(2, 0),
+              range_.lower);
       (*goal)(2, 0) = range_.lower;
     }
   } else {
@@ -181,13 +181,13 @@
     // Upper - lower hard may be a bit generous, but we are moving slow.
 
     if ((*goal)(2, 0) > kMaxRange) {
-      LOG(WARNING, "Goal %s above limit, %f > %f\n", name, (*goal)(2, 0),
-          kMaxRange);
+      AOS_LOG(WARNING, "Goal %s above limit, %f > %f\n", name, (*goal)(2, 0),
+              kMaxRange);
       (*goal)(2, 0) = kMaxRange;
     }
     if ((*goal)(2, 0) < -kMaxRange) {
-      LOG(WARNING, "Goal %s below limit, %f < %f\n", name, (*goal)(2, 0),
-          -kMaxRange);
+      AOS_LOG(WARNING, "Goal %s below limit, %f < %f\n", name, (*goal)(2, 0),
+              -kMaxRange);
       (*goal)(2, 0) = -kMaxRange;
     }
   }
@@ -241,7 +241,7 @@
     loop_->mutable_X_hat(4, 0) = 0.0;
     loop_->mutable_X_hat(5, 0) = 0.0;
 
-    LOG(INFO, "Resetting\n");
+    AOS_LOG(INFO, "Resetting\n");
     stuck_indexer_detector_->mutable_X_hat() = loop_->X_hat();
     should_reset_ = false;
     saturated_ = false;
@@ -294,9 +294,9 @@
 
   if (turret_position() > range_.upper_hard ||
       turret_position() < range_.lower_hard) {
-    LOG(ERROR,
-        "ColumnProfiledSubsystem at %f out of bounds [%f, %f], ESTOPing\n",
-        turret_position(), range_.lower_hard, range_.upper_hard);
+    AOS_LOG(ERROR,
+            "ColumnProfiledSubsystem at %f out of bounds [%f, %f], ESTOPing\n",
+            turret_position(), range_.lower_hard, range_.upper_hard);
     return true;
   }
 
@@ -465,7 +465,8 @@
                      profiled_subsystem_.goal(2, 0) -
                          kStuckZeroingTrackingError ||
                  profiled_subsystem_.saturated()) {
-        LOG(INFO,
+        AOS_LOG(
+            INFO,
             "Turret stuck going positive, switching directions.  At %f, goal "
             "%f\n",
             profiled_subsystem_.turret_position(),
@@ -499,7 +500,8 @@
                          kStuckZeroingTrackingError ||
                  profiled_subsystem_.saturated()) {
         // The turret got too far behind.  Declare it stuck and reverse.
-        LOG(INFO,
+        AOS_LOG(
+            INFO,
             "Turret stuck going negative, switching directions.  At %f, goal "
             "%f\n",
             profiled_subsystem_.turret_position(),
@@ -530,7 +532,8 @@
 
         if (unsafe_turret_goal->track) {
           if (vision_time_adjuster_.valid()) {
-            LOG(INFO, "Vision aligning to %f\n", vision_time_adjuster_.goal());
+            AOS_LOG(INFO, "Vision aligning to %f\n",
+                    vision_time_adjuster_.goal());
             profiled_subsystem_.set_turret_unprofiled_goal(
                 vision_time_adjuster_.goal() + vision_error_);
           }
@@ -552,7 +555,7 @@
     } break;
 
     case State::ESTOP:
-      LOG(ERROR, "Estop\n");
+      AOS_LOG(ERROR, "Estop\n");
       disable = true;
       break;
   }
@@ -574,8 +577,8 @@
         indexer_state_ = IndexerState::REVERSING;
         last_transition_time_ = monotonic_now;
         profiled_subsystem_.PartialIndexerReset();
-        LOG(INFO, "Partial indexer reset while going forwards\n");
-        LOG(INFO, "Indexer RUNNING -> REVERSING\n");
+        AOS_LOG(INFO, "Partial indexer reset while going forwards\n");
+        AOS_LOG(INFO, "Indexer RUNNING -> REVERSING\n");
       }
       break;
     case IndexerState::REVERSING:
@@ -588,12 +591,12 @@
            monotonic_now > last_transition_time_ + kReverseMinTimeout) ||
           monotonic_now > kReverseTimeout + last_transition_time_) {
         indexer_state_ = IndexerState::RUNNING;
-        LOG(INFO, "Indexer REVERSING -> RUNNING, stuck %d\n",
-            profiled_subsystem_.IsIndexerStuck());
+        AOS_LOG(INFO, "Indexer REVERSING -> RUNNING, stuck %d\n",
+                profiled_subsystem_.IsIndexerStuck());
 
         // Only reset if we got stuck going this way too.
         if (monotonic_now > kReverseTimeout + last_transition_time_) {
-          LOG(INFO, "Partial indexer reset while reversing\n");
+          AOS_LOG(INFO, "Partial indexer reset while reversing\n");
           profiled_subsystem_.PartialIndexerReset();
         }
         last_transition_time_ = monotonic_now;
diff --git a/y2017/control_loops/superstructure/column/column_zeroing.cc b/y2017/control_loops/superstructure/column/column_zeroing.cc
index d5a378c..30500ca 100644
--- a/y2017/control_loops/superstructure/column/column_zeroing.cc
+++ b/y2017/control_loops/superstructure/column/column_zeroing.cc
@@ -25,7 +25,7 @@
 
 void ColumnZeroingEstimator::TriggerError() {
   if (!error_) {
-    LOG(ERROR, "Manually triggered zeroing error.\n");
+    AOS_LOG(ERROR, "Manually triggered zeroing error.\n");
     error_ = true;
   }
 }
diff --git a/y2017/control_loops/superstructure/hood/hood.cc b/y2017/control_loops/superstructure/hood/hood.cc
index 862a32c..8588a16 100644
--- a/y2017/control_loops/superstructure/hood/hood.cc
+++ b/y2017/control_loops/superstructure/hood/hood.cc
@@ -40,13 +40,13 @@
     // enough to find them (and the index pulse which might be right next to
     // one).
     if ((*goal)(0, 0) > kMaxRange) {
-      LOG(WARNING, "Goal %s above limit, %f > %f\n", name, (*goal)(0, 0),
-          kMaxRange);
+      AOS_LOG(WARNING, "Goal %s above limit, %f > %f\n", name, (*goal)(0, 0),
+              kMaxRange);
       (*goal)(0, 0) = kMaxRange;
     }
     if ((*goal)(0, 0) < -kMaxRange) {
-      LOG(WARNING, "Goal %s below limit, %f < %f\n", name, (*goal)(0, 0),
-          kMaxRange);
+      AOS_LOG(WARNING, "Goal %s below limit, %f < %f\n", name, (*goal)(0, 0),
+              kMaxRange);
       (*goal)(0, 0) = -kMaxRange;
     }
   }
@@ -71,7 +71,7 @@
   switch (state_) {
     case State::UNINITIALIZED:
       // Wait in the uninitialized state until the hood is initialized.
-      LOG(DEBUG, "Uninitialized, waiting for hood\n");
+      AOS_LOG(DEBUG, "Uninitialized, waiting for hood\n");
       if (profiled_subsystem_.initialized()) {
         state_ = State::DISABLED_INITIALIZED;
       }
@@ -163,7 +163,7 @@
     } break;
 
     case State::ESTOP:
-      LOG(ERROR, "Estop\n");
+      AOS_LOG(ERROR, "Estop\n");
       disable = true;
       break;
   }
diff --git a/y2017/control_loops/superstructure/intake/intake.cc b/y2017/control_loops/superstructure/intake/intake.cc
index 76c44a4..baa4693 100644
--- a/y2017/control_loops/superstructure/intake/intake.cc
+++ b/y2017/control_loops/superstructure/intake/intake.cc
@@ -39,7 +39,7 @@
   switch (state_) {
     case State::UNINITIALIZED:
       // Wait in the uninitialized state until the intake is initialized.
-      LOG(DEBUG, "Uninitialized, waiting for intake\n");
+      AOS_LOG(DEBUG, "Uninitialized, waiting for intake\n");
       if (profiled_subsystem_.initialized()) {
         state_ = State::DISABLED_INITIALIZED;
       }
@@ -101,8 +101,8 @@
 
       // Force the intake to be at least at min_position_ out.
       if (profiled_subsystem_.unprofiled_goal(0, 0) < min_position_) {
-        LOG(DEBUG, "Limiting intake to %f from %f\n", min_position_,
-            profiled_subsystem_.unprofiled_goal(0, 0));
+        AOS_LOG(DEBUG, "Limiting intake to %f from %f\n", min_position_,
+                profiled_subsystem_.unprofiled_goal(0, 0));
         profiled_subsystem_.set_unprofiled_goal(min_position_);
       }
 
@@ -114,7 +114,7 @@
     } break;
 
     case State::ESTOP:
-      LOG(ERROR, "Estop\n");
+      AOS_LOG(ERROR, "Estop\n");
       disable = true;
       break;
   }
diff --git a/y2017/control_loops/superstructure/shooter/shooter.cc b/y2017/control_loops/superstructure/shooter/shooter.cc
index 5023e6f..2b668ae 100644
--- a/y2017/control_loops/superstructure/shooter/shooter.cc
+++ b/y2017/control_loops/superstructure/shooter/shooter.cc
@@ -145,7 +145,7 @@
   } else if (!status->ready) {
     min_ = ::std::min(min_, wheel_.dt_velocity());
   } else if (!last_ready_ && status->ready) {
-    LOG(INFO, "Shot min was [%f]\n", min_);
+    AOS_LOG(INFO, "Shot min was [%f]\n", min_);
   }
 
   if (output) {
diff --git a/y2017/control_loops/superstructure/superstructure.cc b/y2017/control_loops/superstructure/superstructure.cc
index e7f7ca8..3ad1747 100644
--- a/y2017/control_loops/superstructure/superstructure.cc
+++ b/y2017/control_loops/superstructure/superstructure.cc
@@ -58,7 +58,7 @@
   const ::aos::monotonic_clock::time_point monotonic_now =
       event_loop()->monotonic_now();
   if (WasReset()) {
-    LOG(ERROR, "WPILib reset, restarting\n");
+    AOS_LOG(ERROR, "WPILib reset, restarting\n");
     hood_.Reset();
     intake_.Reset();
     shooter_.Reset();
@@ -96,7 +96,7 @@
 
     if (::std::abs(robot_velocity) > 0.2) {
       if (unsafe_goal->use_vision_for_shots) {
-        LOG(INFO, "Moving too fast, resetting\n");
+        AOS_LOG(INFO, "Moving too fast, resetting\n");
       }
       distance_average_.Reset();
     }
@@ -114,11 +114,12 @@
           in_range = false;
         }
       }
-      LOG(DEBUG, "VisionDistance %f, hood %f shooter %f, indexer %f * M_PI\n",
+      AOS_LOG(
+          DEBUG, "VisionDistance %f, hood %f shooter %f, indexer %f * M_PI\n",
           status->vision_distance, hood_goal.angle,
           shooter_goal.angular_velocity, indexer_goal.angular_velocity / M_PI);
     } else {
-      LOG(DEBUG, "VisionNotValid %f\n", status->vision_distance);
+      AOS_LOG(DEBUG, "VisionNotValid %f\n", status->vision_distance);
       if (unsafe_goal->use_vision_for_shots) {
         in_range = false;
         indexer_goal.angular_velocity = 0.0;
@@ -174,7 +175,7 @@
 
   // Make some noise if someone left this set...
   if (ignore_collisions_) {
-    LOG(ERROR, "Collisions ignored\n");
+    AOS_LOG(ERROR, "Collisions ignored\n");
   }
 
   intake_.Iterate(unsafe_goal != nullptr ? &(unsafe_goal->intake) : nullptr,
diff --git a/y2017/control_loops/superstructure/superstructure_lib_test.cc b/y2017/control_loops/superstructure/superstructure_lib_test.cc
index d1cb15f..1e763b8 100644
--- a/y2017/control_loops/superstructure/superstructure_lib_test.cc
+++ b/y2017/control_loops/superstructure/superstructure_lib_test.cc
@@ -308,18 +308,18 @@
             ? superstructure::intake::Intake::kOperatingVoltage
             : superstructure::intake::Intake::kZeroingVoltage;
 
-    CHECK_LE(::std::abs(superstructure_output_fetcher_->voltage_hood),
-             voltage_check_hood);
+    AOS_CHECK_LE(::std::abs(superstructure_output_fetcher_->voltage_hood),
+                 voltage_check_hood);
 
-    CHECK_LE(::std::abs(superstructure_output_fetcher_->voltage_intake),
-             voltage_check_intake);
+    AOS_CHECK_LE(::std::abs(superstructure_output_fetcher_->voltage_intake),
+                 voltage_check_intake);
 
     EXPECT_LE(::std::abs(superstructure_output_fetcher_->voltage_indexer),
               voltage_check_indexer)
         << ": check voltage " << voltage_check_indexer;
 
-    CHECK_LE(::std::abs(superstructure_output_fetcher_->voltage_turret),
-             voltage_check_turret);
+    AOS_CHECK_LE(::std::abs(superstructure_output_fetcher_->voltage_turret),
+                 voltage_check_turret);
 
     ::Eigen::Matrix<double, 1, 1> hood_U;
     hood_U << superstructure_output_fetcher_->voltage_hood +
@@ -375,15 +375,15 @@
     // The hood is special.  We don't want to fault when we hit the hard stop.
     // We want to freeze the hood at the hard stop.
     if (angle_hood > constants::Values::kHoodRange.upper_hard) {
-      LOG(INFO, "At the hood upper hard stop of %f\n",
-          constants::Values::kHoodRange.upper_hard);
+      AOS_LOG(INFO, "At the hood upper hard stop of %f\n",
+              constants::Values::kHoodRange.upper_hard);
       angle_hood = constants::Values::kHoodRange.upper_hard;
       hood_plant_->mutable_X(0, 0) = angle_hood;
       hood_plant_->mutable_X(1, 0) = 0.0;
       hood_plant_->UpdateY(hood_U);
     } else if (angle_hood < constants::Values::kHoodRange.lower_hard) {
-      LOG(INFO, "At the hood lower hard stop of %f\n",
-          constants::Values::kHoodRange.lower_hard);
+      AOS_LOG(INFO, "At the hood lower hard stop of %f\n",
+              constants::Values::kHoodRange.lower_hard);
       angle_hood = constants::Values::kHoodRange.lower_hard;
       hood_plant_->mutable_X(0, 0) = angle_hood;
       hood_plant_->mutable_X(1, 0) = 0.0;
@@ -397,16 +397,16 @@
     // The expected zeroing procedure involves yanking on the wires for the
     // turret in some cases.  So, implement the hard stop like the hood.
     if (angle_turret > constants::Values::kTurretRange.upper_hard) {
-      LOG(INFO, "At the turret upper hard stop of %f\n",
-          constants::Values::kTurretRange.upper_hard);
+      AOS_LOG(INFO, "At the turret upper hard stop of %f\n",
+              constants::Values::kTurretRange.upper_hard);
       angle_turret = constants::Values::kTurretRange.upper_hard;
       column_plant_->mutable_X(2, 0) = angle_turret;
       column_plant_->mutable_X(3, 0) = 0.0;
 
       column_plant_->UpdateY(column_U);
     } else if (angle_turret < constants::Values::kTurretRange.lower_hard) {
-      LOG(INFO, "At the turret lower hard stop of %f\n",
-          constants::Values::kTurretRange.lower_hard);
+      AOS_LOG(INFO, "At the turret lower hard stop of %f\n",
+              constants::Values::kTurretRange.lower_hard);
       angle_turret = constants::Values::kTurretRange.lower_hard;
       column_plant_->mutable_X(2, 0) = angle_turret;
       column_plant_->mutable_X(3, 0) = 0.0;
@@ -1190,9 +1190,9 @@
               chrono::milliseconds(1050));
   EXPECT_TRUE(unstuck_detection_time - unstuck_start_time >
               chrono::milliseconds(400));
-  LOG(INFO, "Unstuck time is %" PRId64 "ms",
-      static_cast<int64_t>(
-          (unstuck_detection_time - unstuck_start_time).count() / 1000000));
+  AOS_LOG(INFO, "Unstuck time is %" PRId64 "ms",
+          static_cast<int64_t>(
+              (unstuck_detection_time - unstuck_start_time).count() / 1000000));
 
   // Now, make sure it transitions to stuck again after a delay.
   const auto restuck_start_time = monotonic_now();
diff --git a/y2017/control_loops/superstructure/vision_time_adjuster.cc b/y2017/control_loops/superstructure/vision_time_adjuster.cc
index 4952f6d..a67c5f2 100644
--- a/y2017/control_loops/superstructure/vision_time_adjuster.cc
+++ b/y2017/control_loops/superstructure/vision_time_adjuster.cc
@@ -140,9 +140,9 @@
         &drivetrain_angle);
 
     if (column_angle_is_valid && drivetrain_angle_is_valid) {
-      LOG(INFO, "Accepting Vision angle of %f, age %f\n",
-          most_recent_vision_angle_,
-          ::aos::time::DurationInSeconds(monotonic_now - last_target_time));
+      AOS_LOG(INFO, "Accepting Vision angle of %f, age %f\n",
+              most_recent_vision_angle_,
+              ::aos::time::DurationInSeconds(monotonic_now - last_target_time));
       most_recent_vision_reading_ = vision_status->angle;
       most_recent_vision_angle_ =
           vision_status->angle + column_angle + drivetrain_angle;
@@ -151,8 +151,8 @@
   }
 
   goal_ = most_recent_vision_angle_ - most_recent_drivetrain_angle_;
-  LOG(DEBUG, "Vision angle %f drivetrain %f\n", most_recent_vision_angle_,
-      most_recent_drivetrain_angle_);
+  AOS_LOG(DEBUG, "Vision angle %f drivetrain %f\n", most_recent_vision_angle_,
+          most_recent_drivetrain_angle_);
 
   // Now, update the vision valid flag to tell us if we have a valid vision
   // angle within the last seven seconds.
diff --git a/y2017/joystick_reader.cc b/y2017/joystick_reader.cc
index a5470d4..3bbbeb2 100644
--- a/y2017/joystick_reader.cc
+++ b/y2017/joystick_reader.cc
@@ -72,7 +72,7 @@
 
     superstructure_status_fetcher_.Fetch();
     if (!superstructure_status_fetcher_.get()) {
-      LOG(ERROR, "Got no superstructure status packet.\n");
+      AOS_LOG(ERROR, "Got no superstructure status packet.\n");
       return;
     }
 
@@ -243,9 +243,9 @@
       new_superstructure_goal->indexer.angular_velocity = 0.0;
     }
 
-    LOG_STRUCT(DEBUG, "sending goal", *new_superstructure_goal);
+    AOS_LOG_STRUCT(DEBUG, "sending goal", *new_superstructure_goal);
     if (!new_superstructure_goal.Send()) {
-      LOG(ERROR, "Sending superstructure goal failed.\n");
+      AOS_LOG(ERROR, "Sending superstructure goal failed.\n");
     }
   }
 
diff --git a/y2017/vision/target_receiver.cc b/y2017/vision/target_receiver.cc
index 163e1f1..6b86972 100644
--- a/y2017/vision/target_receiver.cc
+++ b/y2017/vision/target_receiver.cc
@@ -56,9 +56,9 @@
           &new_vision_status->distance, &new_vision_status->angle);
     }
 
-    LOG_STRUCT(DEBUG, "vision", *new_vision_status);
+    AOS_LOG_STRUCT(DEBUG, "vision", *new_vision_status);
     if (!new_vision_status.Send()) {
-      LOG(ERROR, "Failed to send vision information\n");
+      AOS_LOG(ERROR, "Failed to send vision information\n");
     }
   }
 }
diff --git a/y2017/wpilib_interface.cc b/y2017/wpilib_interface.cc
index 4fac858..e55e350 100644
--- a/y2017/wpilib_interface.cc
+++ b/y2017/wpilib_interface.cc
@@ -260,7 +260,7 @@
           auto_mode_message->mode |= 1 << i;
         }
       }
-      LOG_STRUCT(DEBUG, "auto mode", *auto_mode_message);
+      AOS_LOG_STRUCT(DEBUG, "auto mode", *auto_mode_message);
       auto_mode_message.Send();
     }
   }
@@ -315,13 +315,13 @@
 
   void Loop(const int iterations) {
     if (iterations != 1) {
-      LOG(DEBUG, "Solenoids skipped %d iterations\n", iterations - 1);
+      AOS_LOG(DEBUG, "Solenoids skipped %d iterations\n", iterations - 1);
     }
 
     {
       superstructure_output_fetcher_.Fetch();
       if (superstructure_output_fetcher_.get()) {
-        LOG_STRUCT(DEBUG, "solenoids", *superstructure_output_fetcher_);
+        AOS_LOG_STRUCT(DEBUG, "solenoids", *superstructure_output_fetcher_);
         lights_->Set(superstructure_output_fetcher_->lights_on);
         rgb_lights_->Set(superstructure_output_fetcher_->red_light_on |
                          superstructure_output_fetcher_->green_light_on |
@@ -387,7 +387,7 @@
 
  private:
   virtual void Write(const SuperstructureQueue::Output &output) override {
-    LOG_STRUCT(DEBUG, "will output", output);
+    AOS_LOG_STRUCT(DEBUG, "will output", output);
     intake_victor_->SetSpeed(::aos::Clip(output.voltage_intake,
                                          -kMaxBringupPower, kMaxBringupPower) /
                              12.0);
@@ -410,7 +410,7 @@
   }
 
   virtual void Stop() override {
-    LOG(WARNING, "Superstructure output too old.\n");
+    AOS_LOG(WARNING, "Superstructure output too old.\n");
     intake_victor_->SetDisabled();
     intake_rollers_victor_->SetDisabled();
     indexer_victor_->SetDisabled();
diff --git a/y2018/actors/autonomous_actor.cc b/y2018/actors/autonomous_actor.cc
index 18b6789..dd94083 100644
--- a/y2018/actors/autonomous_actor.cc
+++ b/y2018/actors/autonomous_actor.cc
@@ -60,7 +60,8 @@
 bool AutonomousActor::RunAction(
     const ::frc971::autonomous::AutonomousActionParams &params) {
   const monotonic_clock::time_point start_time = monotonic_now();
-  LOG(INFO, "Starting autonomous action with mode %" PRId32 "\n", params.mode);
+  AOS_LOG(INFO, "Starting autonomous action with mode %" PRId32 "\n",
+          params.mode);
   Reset();
 
   // Switch
@@ -111,8 +112,8 @@
   }
   */
 
-  LOG(INFO, "Done %f\n",
-      ::aos::time::DurationInSeconds(monotonic_now() - start_time));
+  AOS_LOG(INFO, "Done %f\n",
+          ::aos::time::DurationInSeconds(monotonic_now() - start_time));
 
   ::aos::time::PhasedLoop phased_loop(::std::chrono::milliseconds(5),
                                       event_loop()->monotonic_now(),
@@ -121,7 +122,7 @@
   while (!ShouldCancel()) {
     phased_loop.SleepUntilNext();
   }
-  LOG(DEBUG, "Done running\n");
+  AOS_LOG(DEBUG, "Done running\n");
 
   return true;
 }
@@ -169,8 +170,8 @@
     StartDrive(0.00, 0.0, kFinalSwitchDrive, kTurn);
 
     if (!WaitForArmTrajectoryClose(0.001)) return true;
-    LOG(INFO, "Arm close at %f\n",
-        ::aos::time::DurationInSeconds(monotonic_now() - start_time));
+    AOS_LOG(INFO, "Arm close at %f\n",
+            ::aos::time::DurationInSeconds(monotonic_now() - start_time));
 
     ::std::this_thread::sleep_for(chrono::milliseconds(1000));
 
@@ -256,22 +257,22 @@
   StartDrive(0.0, 0.0, kFarScaleFinalTurnDrive, kTurn);
   if (!WaitForDriveProfileNear(kFullDriveLength - (kSecondTurnDistance)))
     return true;
-  LOG(INFO, "Final turn at %f\n",
-      ::aos::time::DurationInSeconds(monotonic_now() - start_time));
+  AOS_LOG(INFO, "Final turn at %f\n",
+          ::aos::time::DurationInSeconds(monotonic_now() - start_time));
 
   StartDrive(0.0, M_PI / 2.0, kFarScaleFinalTurnDrive, kFarScaleSweepingTurn);
   if (!WaitForDriveProfileNear(0.15)) return true;
 
   StartDrive(0.0, 0.3, kFarScaleFinalTurnDrive, kFarScaleSweepingTurn);
 
-  LOG(INFO, "Dropping at %f\n",
-      ::aos::time::DurationInSeconds(monotonic_now() - start_time));
+  AOS_LOG(INFO, "Dropping at %f\n",
+          ::aos::time::DurationInSeconds(monotonic_now() - start_time));
   set_open_claw(true);
   SendSuperstructureGoal();
 
   ::std::this_thread::sleep_for(chrono::milliseconds(1000));
-  LOG(INFO, "Backing up at %f\n",
-      ::aos::time::DurationInSeconds(monotonic_now() - start_time));
+  AOS_LOG(INFO, "Backing up at %f\n",
+          ::aos::time::DurationInSeconds(monotonic_now() - start_time));
 
   StartDrive(1.5, -0.55, kFarScaleFinalTurnDrive, kFarScaleSweepingTurn);
 
@@ -312,8 +313,8 @@
   if (!WaitForTurnProfileDone()) return true;
   ::std::this_thread::sleep_for(chrono::milliseconds(500));
 
-  LOG(INFO, "Dropping second box at %f\n",
-      ::aos::time::DurationInSeconds(monotonic_now() - start_time));
+  AOS_LOG(INFO, "Dropping second box at %f\n",
+          ::aos::time::DurationInSeconds(monotonic_now() - start_time));
   set_open_claw(true);
   SendSuperstructureGoal();
 
@@ -345,8 +346,8 @@
   StartDrive(0.0, -M_PI / 2.0, kFarSwitchTurnDrive, kSweepingTurn);
   set_arm_goal_position(arm::UpIndex());
   SendSuperstructureGoal();
-  LOG(INFO, "Lifting arm at %f\n",
-      ::aos::time::DurationInSeconds(monotonic_now() - start_time));
+  AOS_LOG(INFO, "Lifting arm at %f\n",
+          ::aos::time::DurationInSeconds(monotonic_now() - start_time));
   if (!WaitForTurnProfileDone()) return true;
 
   StartDrive(0.0, 0.0, kDrive, kTurn);
@@ -378,8 +379,8 @@
   StartDrive(0.0, turn_scalar * (-M_PI / 4.0 - 0.2), kSlowDrive, kSweepingTurn);
   if (!WaitForDriveNear(0.2, 0.2)) return true;
   set_max_drivetrain_voltage(6.0);
-  LOG(INFO, "Lowered drivetrain voltage %f\n",
-      ::aos::time::DurationInSeconds(monotonic_now() - start_time));
+  AOS_LOG(INFO, "Lowered drivetrain voltage %f\n",
+          ::aos::time::DurationInSeconds(monotonic_now() - start_time));
   ::std::this_thread::sleep_for(chrono::milliseconds(300));
 
   set_open_claw(true);
@@ -430,16 +431,16 @@
   set_open_claw(true);
   SendSuperstructureGoal();
   set_intake_angle(-0.60);
-  LOG(INFO, "Dropped first box %f\n",
-      ::aos::time::DurationInSeconds(monotonic_now() - start_time));
+  AOS_LOG(INFO, "Dropped first box %f\n",
+          ::aos::time::DurationInSeconds(monotonic_now() - start_time));
 
   ::std::this_thread::sleep_for(chrono::milliseconds(700));
 
   set_grab_box(true);
   SendSuperstructureGoal();
 
-  LOG(INFO, "Starting second box drive %f\n",
-      ::aos::time::DurationInSeconds(monotonic_now() - start_time));
+  AOS_LOG(INFO, "Starting second box drive %f\n",
+          ::aos::time::DurationInSeconds(monotonic_now() - start_time));
   constexpr double kSecondBoxSwerveAngle = 0.35;
   constexpr double kSecondBoxDrive = 1.38;
   StartDrive(kSecondBoxDrive, 0.0, kDrive, kFastTurn);
@@ -465,16 +466,16 @@
   set_roller_voltage(10.0);
   SendSuperstructureGoal();
 
-  LOG(INFO, "Grabbing second box %f\n",
-      ::aos::time::DurationInSeconds(monotonic_now() - start_time));
+  AOS_LOG(INFO, "Grabbing second box %f\n",
+          ::aos::time::DurationInSeconds(monotonic_now() - start_time));
   ::std::this_thread::sleep_for(chrono::milliseconds(200));
   StartDrive(-0.04, 0.0, kThirdBoxSlowBackup, kThirdBoxSlowTurn);
 
   if (!WaitForBoxGrabed()) return true;
   set_max_drivetrain_voltage(12.0);
 
-  LOG(INFO, "Got second box %f\n",
-      ::aos::time::DurationInSeconds(monotonic_now() - start_time));
+  AOS_LOG(INFO, "Got second box %f\n",
+          ::aos::time::DurationInSeconds(monotonic_now() - start_time));
   ::std::this_thread::sleep_for(chrono::milliseconds(500));
 
   set_grab_box(false);
@@ -483,8 +484,8 @@
   set_roller_voltage(0.0);
   set_disable_box_correct(false);
   SendSuperstructureGoal();
-  LOG(INFO, "Driving to place second box %f\n",
-      ::aos::time::DurationInSeconds(monotonic_now() - start_time));
+  AOS_LOG(INFO, "Driving to place second box %f\n",
+          ::aos::time::DurationInSeconds(monotonic_now() - start_time));
 
   StartDrive(-kSecondBoxDrive + 0.16, kSecondBoxSwerveAngle, kDrive, kFastTurn);
   if (!WaitForDriveNear(0.4, M_PI / 2.0)) return true;
@@ -493,8 +494,8 @@
   StartDrive(0.0, -kSecondBoxSwerveAngle - kSecondBoxEndExtraAngle, kDrive,
              kFastTurn);
 
-  LOG(INFO, "Starting throw %f\n",
-      ::aos::time::DurationInSeconds(monotonic_now() - start_time));
+  AOS_LOG(INFO, "Starting throw %f\n",
+          ::aos::time::DurationInSeconds(monotonic_now() - start_time));
   if (!WaitForDriveNear(0.4, M_PI / 2.0)) return true;
   if (!WaitForArmTrajectoryClose(0.25)) return true;
   SendSuperstructureGoal();
@@ -505,16 +506,16 @@
 
   set_open_claw(true);
   set_intake_angle(-M_PI / 4.0);
-  LOG(INFO, "Releasing second box %f\n",
-      ::aos::time::DurationInSeconds(monotonic_now() - start_time));
+  AOS_LOG(INFO, "Releasing second box %f\n",
+          ::aos::time::DurationInSeconds(monotonic_now() - start_time));
   SendSuperstructureGoal();
 
   ::std::this_thread::sleep_for(chrono::milliseconds(700));
   set_open_claw(false);
   SendSuperstructureGoal();
 
-  LOG(INFO, "Driving to third box %f\n",
-      ::aos::time::DurationInSeconds(monotonic_now() - start_time));
+  AOS_LOG(INFO, "Driving to third box %f\n",
+          ::aos::time::DurationInSeconds(monotonic_now() - start_time));
   StartDrive(kThirdCubeDrive, kSecondBoxEndExtraAngle, kThirdBoxDrive,
              kFastTurn);
   if (!WaitForDriveNear(kThirdCubeDrive - 0.1, M_PI / 4.0)) return true;
@@ -534,16 +535,16 @@
              kThirdBoxSlowTurn);
   if (!WaitForDriveProfileDone()) return true;
 
-  LOG(INFO, "Waiting for third box %f\n",
-      ::aos::time::DurationInSeconds(monotonic_now() - start_time));
+  AOS_LOG(INFO, "Waiting for third box %f\n",
+          ::aos::time::DurationInSeconds(monotonic_now() - start_time));
   if (!WaitForBoxGrabed()) return true;
-  LOG(INFO, "Third box grabbed %f\n",
-      ::aos::time::DurationInSeconds(monotonic_now() - start_time));
+  AOS_LOG(INFO, "Third box grabbed %f\n",
+          ::aos::time::DurationInSeconds(monotonic_now() - start_time));
   const bool too_late =
       monotonic_now() > start_time + chrono::milliseconds(12500);
   if (too_late) {
-    LOG(INFO, "Third box too long, going up. %f\n",
-        ::aos::time::DurationInSeconds(monotonic_now() - start_time));
+    AOS_LOG(INFO, "Third box too long, going up. %f\n",
+            ::aos::time::DurationInSeconds(monotonic_now() - start_time));
     set_grab_box(false);
     set_arm_goal_position(arm::UpIndex());
     set_roller_voltage(0.0);
@@ -572,8 +573,8 @@
     set_roller_voltage(0.0);
     SendSuperstructureGoal();
 
-    LOG(INFO, "Final open %f\n",
-        ::aos::time::DurationInSeconds(monotonic_now() - start_time));
+    AOS_LOG(INFO, "Final open %f\n",
+            ::aos::time::DurationInSeconds(monotonic_now() - start_time));
   }
 
   if (!WaitForDriveProfileDone()) return true;
diff --git a/y2018/actors/autonomous_actor.h b/y2018/actors/autonomous_actor.h
index 4cedff3..3ef7677 100644
--- a/y2018/actors/autonomous_actor.h
+++ b/y2018/actors/autonomous_actor.h
@@ -95,7 +95,7 @@
     new_superstructure_goal->trajectory_override = false;
 
     if (!new_superstructure_goal.Send()) {
-      LOG(ERROR, "Sending superstructure goal failed.\n");
+      AOS_LOG(ERROR, "Sending superstructure goal failed.\n");
     }
   }
 
@@ -151,9 +151,9 @@
                 arm_goal_position_ &&
             superstructure_status_fetcher_->arm.path_distance_to_go <
                 arm_threshold) {
-          LOG(INFO, "Arm finished first: %f, drivetrain %f distance\n",
-              superstructure_status_fetcher_->arm.path_distance_to_go,
-              ::std::abs(distance_to_go));
+          AOS_LOG(INFO, "Arm finished first: %f, drivetrain %f distance\n",
+                  superstructure_status_fetcher_->arm.path_distance_to_go,
+                  ::std::abs(distance_to_go));
           return true;
         }
 
@@ -161,10 +161,10 @@
         if (::std::abs(profile_distance_to_go) <
                 drive_threshold + kProfileTolerance &&
             ::std::abs(distance_to_go) < drive_threshold + kPositionTolerance) {
-          LOG(INFO,
-              "Drivetrain finished first: arm %f, drivetrain %f distance\n",
-              superstructure_status_fetcher_->arm.path_distance_to_go,
-              ::std::abs(distance_to_go));
+          AOS_LOG(INFO,
+                  "Drivetrain finished first: arm %f, drivetrain %f distance\n",
+                  superstructure_status_fetcher_->arm.path_distance_to_go,
+                  ::std::abs(distance_to_go));
           return true;
         }
       }
diff --git a/y2018/constants.cc b/y2018/constants.cc
index 5fb7161..97a62a1 100644
--- a/y2018/constants.cc
+++ b/y2018/constants.cc
@@ -128,7 +128,7 @@
       break;
 
     default:
-      LOG(FATAL, "unknown team #%" PRIu16 "\n", team);
+      AOS_LOG(FATAL, "unknown team #%" PRIu16 "\n", team);
   }
 
   return r;
@@ -136,7 +136,7 @@
 
 const Values &DoGetValues() {
   const uint16_t team = ::aos::network::GetTeamNumber();
-  LOG(INFO, "creating a Constants for team %" PRIu16 "\n", team);
+  AOS_LOG(INFO, "creating a Constants for team %" PRIu16 "\n", team);
   return GetValuesForTeam(team);
 }
 
diff --git a/y2018/control_loops/superstructure/arm/arm.cc b/y2018/control_loops/superstructure/arm/arm.cc
index d3cb262..2ae1996 100644
--- a/y2018/control_loops/superstructure/arm/arm.cc
+++ b/y2018/control_loops/superstructure/arm/arm.cc
@@ -36,8 +36,8 @@
       points_(PointList()) {
   int i = 0;
   for (const auto &trajectory : trajectories_) {
-    LOG(INFO, "trajectory length for edge node %d: %f\n", i,
-        trajectory.trajectory.path().length());
+    AOS_LOG(INFO, "trajectory length for edge node %d: %f\n", i,
+            trajectory.trajectory.path().length());
     ++i;
   }
 }
@@ -113,7 +113,7 @@
   switch (state_) {
     case State::UNINITIALIZED:
       // Wait in the uninitialized state until the intake is initialized.
-      LOG(DEBUG, "Uninitialized, waiting for intake\n");
+      AOS_LOG(DEBUG, "Uninitialized, waiting for intake\n");
       state_ = State::ZEROING;
       proximal_zeroing_estimator_.Reset();
       distal_zeroing_estimator_.Reset();
@@ -188,7 +188,7 @@
       // TODO(austin): Pick some sane limits.
       if (proximal_zeroing_estimator_.error() ||
           distal_zeroing_estimator_.error()) {
-        LOG(ERROR, "Zeroing error ESTOP\n");
+        AOS_LOG(ERROR, "Zeroing error ESTOP\n");
         state_ = State::ESTOP;
       } else if (outputs_disabled && brownout_count_ > kMaxBrownoutCount) {
         state_ = State::DISABLED;
@@ -213,7 +213,7 @@
       break;
 
     case State::ESTOP:
-      LOG(ERROR, "Estop\n");
+      AOS_LOG(ERROR, "Estop\n");
       break;
   }
 
@@ -338,9 +338,9 @@
 
   if (state_ == State::RUNNING && unsafe_goal != nullptr) {
     if (current_node_ != filtered_goal) {
-      LOG(INFO, "Goal is different\n");
+      AOS_LOG(INFO, "Goal is different\n");
       if (filtered_goal >= search_graph_.num_vertexes()) {
-        LOG(ERROR, "goal node out of range ESTOP\n");
+        AOS_LOG(ERROR, "goal node out of range ESTOP\n");
         state_ = State::ESTOP;
       } else if (follower_.path_distance_to_go() > 1e-3) {
         // Still on the old path segment.  Can't change yet.
@@ -360,9 +360,9 @@
         // Ok, now we know which edge we are on.  Figure out the path and
         // trajectory.
         const SearchGraph::Edge &next_edge = search_graph_.edges()[min_edge];
-        LOG(INFO, "Switching from node %d to %d along edge %d\n",
-            static_cast<int>(current_node_), static_cast<int>(next_edge.end),
-            static_cast<int>(min_edge));
+        AOS_LOG(INFO, "Switching from node %d to %d along edge %d\n",
+                static_cast<int>(current_node_),
+                static_cast<int>(next_edge.end), static_cast<int>(min_edge));
         vmax_ = trajectories_[min_edge].vmax;
         follower_.SwitchTrajectory(&trajectories_[min_edge].trajectory);
         current_node_ = next_edge.end;
@@ -376,7 +376,7 @@
           : (state_ == State::GOTO_PATH ? kGotoPathVMax() : kPathlessVMax());
   follower_.Update(arm_ekf_.X_hat(), disable, kDt(), vmax_,
                    max_operating_voltage);
-  LOG(INFO, "Max voltage: %f\n", max_operating_voltage);
+  AOS_LOG(INFO, "Max voltage: %f\n", max_operating_voltage);
   status->goal_theta0 = follower_.theta(0);
   status->goal_theta1 = follower_.theta(1);
   status->goal_omega0 = follower_.omega(0);
diff --git a/y2018/control_loops/superstructure/arm/trajectory.cc b/y2018/control_loops/superstructure/arm/trajectory.cc
index 2157ca7..bd67ce3 100644
--- a/y2018/control_loops/superstructure/arm/trajectory.cc
+++ b/y2018/control_loops/superstructure/arm/trajectory.cc
@@ -492,7 +492,6 @@
       U_ff_.setZero();
       U_.setZero();
       U_unsaturated_.setZero();
-      LOG(INFO, "Disabled\n");
     } else {
       const ::Eigen::Matrix<double, 6, 1> R =
           trajectory_->R(theta_, ::Eigen::Matrix<double, 2, 1>::Zero());
diff --git a/y2018/control_loops/superstructure/intake/intake.cc b/y2018/control_loops/superstructure/intake/intake.cc
index 6707356..6c07a49 100644
--- a/y2018/control_loops/superstructure/intake/intake.cc
+++ b/y2018/control_loops/superstructure/intake/intake.cc
@@ -107,7 +107,7 @@
   switch (state_) {
     case State::UNINITIALIZED:
       // Wait in the uninitialized state until the intake is initialized.
-      LOG(DEBUG, "Uninitialized, waiting for intake\n");
+      AOS_LOG(DEBUG, "Uninitialized, waiting for intake\n");
       zeroing_estimator_.Reset();
       controller_.Reset();
       state_ = State::ZEROING;
@@ -116,7 +116,7 @@
     case State::ZEROING:
       // Zero by not moving.
       if (zeroing_estimator_.zeroed()) {
-        LOG(INFO, "Now zeroed\n");
+        AOS_LOG(INFO, "Now zeroed\n");
         controller_.UpdateOffset(zeroing_estimator_.offset());
         state_ = State::RUNNING;
       }
@@ -124,23 +124,23 @@
 
     case State::RUNNING:
       if (!(zeroing_estimator_.zeroed())) {
-        LOG(ERROR, "Zeroing estimator is no longer zeroed\n");
+        AOS_LOG(ERROR, "Zeroing estimator is no longer zeroed\n");
         state_ = State::UNINITIALIZED;
       }
       if (zeroing_estimator_.error()) {
-        LOG(ERROR, "Zeroing estimator error\n");
+        AOS_LOG(ERROR, "Zeroing estimator error\n");
         state_ = State::UNINITIALIZED;
       }
       // ESTOP if we hit the hard limits.
       if ((status->motor_position) > controller_.intake_range_.upper ||
           (status->motor_position) < controller_.intake_range_.lower) {
-        LOG(ERROR, "Hit hard limits\n");
+        AOS_LOG(ERROR, "Hit hard limits\n");
         state_ = State::ESTOP;
       }
       break;
 
     case State::ESTOP:
-      LOG(ERROR, "Estop\n");
+      AOS_LOG(ERROR, "Estop\n");
       break;
   }
 
diff --git a/y2018/control_loops/superstructure/superstructure.cc b/y2018/control_loops/superstructure/superstructure.cc
index 572a7b0..a2dcaf6 100644
--- a/y2018/control_loops/superstructure/superstructure.cc
+++ b/y2018/control_loops/superstructure/superstructure.cc
@@ -48,7 +48,7 @@
   const monotonic_clock::time_point monotonic_now =
       event_loop()->monotonic_now();
   if (WasReset()) {
-    LOG(ERROR, "WPILib reset, restarting\n");
+    AOS_LOG(ERROR, "WPILib reset, restarting\n");
     intake_left_.Reset();
     intake_right_.Reset();
     arm_.Reset();
@@ -299,7 +299,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");
   }
 }
 
diff --git a/y2018/control_loops/superstructure/superstructure_lib_test.cc b/y2018/control_loops/superstructure/superstructure_lib_test.cc
index 1d4cf5d..162db33 100644
--- a/y2018/control_loops/superstructure/superstructure_lib_test.cc
+++ b/y2018/control_loops/superstructure/superstructure_lib_test.cc
@@ -89,7 +89,7 @@
     const double voltage_check =
         superstructure::intake::IntakeSide::kOperatingVoltage();
 
-    CHECK_LE(::std::abs(intake_voltage.voltage_elastic), voltage_check);
+    AOS_CHECK_LE(::std::abs(intake_voltage.voltage_elastic), voltage_check);
 
     ::Eigen::Matrix<double, 1, 1> U;
     U << intake_voltage.voltage_elastic + plant_.voltage_offset();
@@ -155,8 +155,8 @@
     constexpr double voltage_check =
         superstructure::arm::Arm::kOperatingVoltage();
 
-    CHECK_LE(::std::abs(U(0)), voltage_check);
-    CHECK_LE(::std::abs(U(1)), voltage_check);
+    AOS_CHECK_LE(::std::abs(U(0)), voltage_check);
+    AOS_CHECK_LE(::std::abs(U(1)), voltage_check);
 
     if (release_arm_brake) {
       X_ = arm::Dynamics::UnboundedDiscreteDynamics(X_, U, 0.00505);
@@ -240,7 +240,7 @@
     left_intake_.GetSensorValues(&position->left_intake);
     right_intake_.GetSensorValues(&position->right_intake);
     arm_.GetSensorValues(&position->arm);
-    LOG_STRUCT(INFO, "sim position", *position);
+    AOS_LOG_STRUCT(INFO, "sim position", *position);
     position.Send();
   }
 
diff --git a/y2018/joystick_reader.cc b/y2018/joystick_reader.cc
index b4c4efa..54c5f8d 100644
--- a/y2018/joystick_reader.cc
+++ b/y2018/joystick_reader.cc
@@ -116,7 +116,7 @@
     superstructure_status_fetcher_.Fetch();
     if (!superstructure_status_fetcher_.get() ||
         !superstructure_position_fetcher_.get()) {
-      LOG(ERROR, "Got no superstructure status packet.\n");
+      AOS_LOG(ERROR, "Got no superstructure status packet.\n");
       return;
     }
 
@@ -307,7 +307,7 @@
     }
 
     if (data.IsPressed(kWinch)) {
-      LOG(INFO, "Winching\n");
+      AOS_LOG(INFO, "Winching\n");
       new_superstructure_goal->voltage_winch = 12.0;
     } else {
       new_superstructure_goal->voltage_winch = 0.0;
@@ -333,9 +333,9 @@
 
     new_superstructure_goal->grab_box = grab_box;
 
-    LOG_STRUCT(DEBUG, "sending goal", *new_superstructure_goal);
+    AOS_LOG_STRUCT(DEBUG, "sending goal", *new_superstructure_goal);
     if (!new_superstructure_goal.Send()) {
-      LOG(ERROR, "Sending superstructure goal failed.\n");
+      AOS_LOG(ERROR, "Sending superstructure goal failed.\n");
     }
 
     video_tx_->Send(vision_control_);
diff --git a/y2018/vision/image_streamer.cc b/y2018/vision/image_streamer.cc
index c4320f2..4050260 100644
--- a/y2018/vision/image_streamer.cc
+++ b/y2018/vision/image_streamer.cc
@@ -87,7 +87,7 @@
   }
 
   size_t Recv(void *data, int size) {
-    return PCHECK(recv(fd(), static_cast<char *>(data), size, 0));
+    return AOS_PCHECK(recv(fd(), static_cast<char *>(data), size, 0));
   }
 };
 
@@ -312,7 +312,7 @@
       params0, "/dev/video0", &tcp_server_, true,
       [&camera0, &camera1, &status_socket, &vision_status]() {
         vision_status.set_low_frame_count(vision_status.low_frame_count() + 1);
-        LOG(INFO, "Got a frame cam0\n");
+        AOS_LOG(INFO, "Got a frame cam0\n");
         if (camera0->active()) {
           status_socket.Send(vision_status);
         }
@@ -325,7 +325,7 @@
         [&camera0, &camera1, &status_socket, &vision_status]() {
           vision_status.set_high_frame_count(vision_status.high_frame_count() +
                                              1);
-          LOG(INFO, "Got a frame cam1\n");
+          AOS_LOG(INFO, "Got a frame cam1\n");
           if (camera1->active()) {
             status_socket.Send(vision_status);
           }
@@ -343,7 +343,8 @@
           cam0_active = true;
           camera0->set_active(true);
         }
-        LOG(INFO, "Got control packet, cam%d active\n", cam0_active ? 0 : 1);
+        AOS_LOG(INFO, "Got control packet, cam%d active\n",
+                cam0_active ? 0 : 1);
       });
 
   // Default to camera0
diff --git a/y2018/vision/vision_status.cc b/y2018/vision/vision_status.cc
index 3d3faf5..2f358c5 100644
--- a/y2018/vision/vision_status.cc
+++ b/y2018/vision/vision_status.cc
@@ -30,9 +30,9 @@
       auto new_vision_status = vision_status_sender_.MakeMessage();
       new_vision_status->high_frame_count = status.high_frame_count();
       new_vision_status->low_frame_count = status.low_frame_count();
-      LOG_STRUCT(DEBUG, "vision", *new_vision_status);
+      AOS_LOG_STRUCT(DEBUG, "vision", *new_vision_status);
       if (!new_vision_status.Send()) {
-        LOG(ERROR, "Failed to send vision information\n");
+        AOS_LOG(ERROR, "Failed to send vision information\n");
       }
     }
   }
diff --git a/y2018/wpilib_interface.cc b/y2018/wpilib_interface.cc
index 903301e..b93d2b0 100644
--- a/y2018/wpilib_interface.cc
+++ b/y2018/wpilib_interface.cc
@@ -395,13 +395,13 @@
     int32_t status = 0;
     HAL_CompressorHandle compressor_ = HAL_InitializeCompressor(0, &status);
     if (status != 0) {
-      LOG(ERROR, "Compressor status is nonzero, %d\n",
-          static_cast<int>(status));
+      AOS_LOG(ERROR, "Compressor status is nonzero, %d\n",
+              static_cast<int>(status));
     }
     HAL_SetCompressorClosedLoopControl(compressor_, true, &status);
     if (status != 0) {
-      LOG(ERROR, "Compressor status is nonzero, %d\n",
-          static_cast<int>(status));
+      AOS_LOG(ERROR, "Compressor status is nonzero, %d\n",
+              static_cast<int>(status));
     }
 
     event_loop_->AddPhasedLoop([this](int iterations) { Loop(iterations); },
@@ -443,13 +443,13 @@
 
   void Loop(const int iterations) {
     if (iterations != 1) {
-      LOG(DEBUG, "Solenoids skipped %d iterations\n", iterations - 1);
+      AOS_LOG(DEBUG, "Solenoids skipped %d iterations\n", iterations - 1);
     }
 
     {
       drivetrain_fetcher_.Fetch();
       if (drivetrain_fetcher_.get()) {
-        LOG_STRUCT(DEBUG, "solenoids", *drivetrain_fetcher_);
+        AOS_LOG_STRUCT(DEBUG, "solenoids", *drivetrain_fetcher_);
         left_drivetrain_shifter_->Set(!drivetrain_fetcher_->left_high);
         right_drivetrain_shifter_->Set(!drivetrain_fetcher_->right_high);
       }
@@ -458,7 +458,7 @@
     {
       superstructure_fetcher_.Fetch();
       if (superstructure_fetcher_.get()) {
-        LOG_STRUCT(DEBUG, "solenoids", *superstructure_fetcher_);
+        AOS_LOG_STRUCT(DEBUG, "solenoids", *superstructure_fetcher_);
 
         claw_->Set(!superstructure_fetcher_->claw_grabbed);
         arm_brakes_->Set(superstructure_fetcher_->release_arm_brake);
@@ -472,7 +472,7 @@
 
       pcm_->Flush();
       to_log.read_solenoids = pcm_->GetAll();
-      LOG_STRUCT(DEBUG, "pneumatics info", to_log);
+      AOS_LOG_STRUCT(DEBUG, "pneumatics info", to_log);
     }
 
     monotonic_clock::time_point monotonic_now = event_loop_->monotonic_now();
@@ -502,10 +502,10 @@
         light_flash_ = 0;
       }
 
-      LOG_STRUCT(DEBUG, "color", color);
+      AOS_LOG_STRUCT(DEBUG, "color", color);
       SetColor(color);
     } else {
-      LOG_STRUCT(DEBUG, "color", *status_light_fetcher_);
+      AOS_LOG_STRUCT(DEBUG, "color", *status_light_fetcher_);
       SetColor(*status_light_fetcher_);
     }
   }
@@ -601,7 +601,7 @@
 
  private:
   virtual void Write(const SuperstructureQueue::Output &output) override {
-    LOG_STRUCT(DEBUG, "will output", output);
+    AOS_LOG_STRUCT(DEBUG, "will output", output);
 
     left_intake_elastic_victor_->SetSpeed(
         ::aos::Clip(-output.left_intake.voltage_elastic, -kMaxBringupPower,
@@ -637,7 +637,7 @@
   }
 
   virtual void Stop() override {
-    LOG(WARNING, "Superstructure output too old.\n");
+    AOS_LOG(WARNING, "Superstructure output too old.\n");
 
     left_intake_rollers_victor_->SetDisabled();
     right_intake_rollers_victor_->SetDisabled();
diff --git a/y2019/actors/autonomous_actor.cc b/y2019/actors/autonomous_actor.cc
index 8408789..a5a71aa 100644
--- a/y2019/actors/autonomous_actor.cc
+++ b/y2019/actors/autonomous_actor.cc
@@ -35,7 +35,7 @@
           ".y2019.control_loops.superstructure.superstructure_queue.status")) {}
 
 bool AutonomousActor::WaitForDriveXGreater(double x) {
-  LOG(INFO, "Waiting until x > %f\n", x);
+  AOS_LOG(INFO, "Waiting until x > %f\n", x);
   ::aos::time::PhasedLoop phased_loop(::std::chrono::milliseconds(5),
                                       event_loop()->monotonic_now(),
                                       ::std::chrono::milliseconds(5) / 2);
@@ -47,14 +47,14 @@
     phased_loop.SleepUntilNext();
     drivetrain_status_fetcher_.Fetch();
     if (drivetrain_status_fetcher_->x > x) {
-      LOG(INFO, "X at %f\n", drivetrain_status_fetcher_->x);
+      AOS_LOG(INFO, "X at %f\n", drivetrain_status_fetcher_->x);
       return true;
     }
   }
 }
 
 bool AutonomousActor::WaitForDriveYCloseToZero(double y) {
-  LOG(INFO, "Waiting until |y| < %f\n", y);
+  AOS_LOG(INFO, "Waiting until |y| < %f\n", y);
   ::aos::time::PhasedLoop phased_loop(::std::chrono::milliseconds(5),
                                       event_loop()->monotonic_now(),
                                       ::std::chrono::milliseconds(5) / 2);
@@ -66,7 +66,7 @@
     phased_loop.SleepUntilNext();
     drivetrain_status_fetcher_.Fetch();
     if (::std::abs(drivetrain_status_fetcher_->y) < y) {
-      LOG(INFO, "Y at %f\n", drivetrain_status_fetcher_->y);
+      AOS_LOG(INFO, "Y at %f\n", drivetrain_status_fetcher_->y);
       return true;
     }
   }
@@ -97,18 +97,20 @@
     localizer_resetter->theta = M_PI;
     localizer_resetter->theta_uncertainty = 0.00001;
     if (!localizer_resetter.Send()) {
-      LOG(ERROR, "Failed to reset localizer.\n");
+      AOS_LOG(ERROR, "Failed to reset localizer.\n");
     }
   }
 
   // Wait for the drivetrain to run so it has time to reset the heading.
   // Otherwise our drivetrain reset will do a 180 right at the start.
   WaitUntil([this]() { return drivetrain_status_fetcher_.Fetch(); });
-  LOG(INFO, "Heading is %f\n", drivetrain_status_fetcher_->estimated_heading);
+  AOS_LOG(INFO, "Heading is %f\n",
+          drivetrain_status_fetcher_->estimated_heading);
   InitializeEncoders();
   ResetDrivetrain();
   WaitUntil([this]() { return drivetrain_status_fetcher_.Fetch(); });
-  LOG(INFO, "Heading is %f\n", drivetrain_status_fetcher_->estimated_heading);
+  AOS_LOG(INFO, "Heading is %f\n",
+          drivetrain_status_fetcher_->estimated_heading);
 
   ResetDrivetrain();
   InitializeEncoders();
@@ -134,8 +136,8 @@
   const bool is_left = params.mode == 0;
 
   {
-    LOG(INFO, "Starting autonomous action with mode %" PRId32 " %s\n",
-        params.mode, is_left ? "left" : "right");
+    AOS_LOG(INFO, "Starting autonomous action with mode %" PRId32 " %s\n",
+            params.mode, is_left ? "left" : "right");
   }
 
   const double turn_scalar = is_left ? 1.0 : -1.0;
@@ -157,12 +159,12 @@
 
     // if planned start the spline and plan the next
     if (!spline1.WaitForPlan()) return true;
-    LOG(INFO, "Planned\n");
+    AOS_LOG(INFO, "Planned\n");
     spline1.Start();
 
     // If suction, move the superstructure to score
     if (!WaitForGamePiece()) return true;
-    LOG(INFO, "Has game piece\n");
+    AOS_LOG(INFO, "Has game piece\n");
     if (!spline1.WaitForSplineDistanceRemaining(3.5)) return true;
     set_elevator_wrist_goal(kPanelBackwardMiddlePos);
     SendSuperstructureGoal();
@@ -186,7 +188,7 @@
 
     if (!WaitForMilliseconds(::std::chrono::milliseconds(150))) return true;
     if (!spline2.WaitForPlan()) return true;
-    LOG(INFO, "Planned\n");
+    AOS_LOG(INFO, "Planned\n");
     // Drive back to hp and set the superstructure accordingly
     spline2.Start();
     if (!WaitForMilliseconds(::std::chrono::milliseconds(500))) return true;
@@ -207,7 +209,7 @@
     if (!WaitForDriveXGreater(0.50)) return true;
     if (!spline3.WaitForPlan()) return true;
     spline3.Start();
-    LOG(INFO, "Has game piece\n");
+    AOS_LOG(INFO, "Has game piece\n");
     if (!WaitForMilliseconds(::std::chrono::milliseconds(1000))) return true;
     set_elevator_wrist_goal(kPanelBackwardMiddlePos);
     SendSuperstructureGoal();
@@ -235,12 +237,12 @@
 
     // if planned start the spline and plan the next
     if (!spline1.WaitForPlan()) return true;
-    LOG(INFO, "Planned\n");
+    AOS_LOG(INFO, "Planned\n");
     spline1.Start();
 
     // If suction, move the superstructure to score
     if (!WaitForGamePiece()) return true;
-    LOG(INFO, "Has game piece\n");
+    AOS_LOG(INFO, "Has game piece\n");
     // unstick the hatch panel
     if (!WaitForMilliseconds(::std::chrono::milliseconds(500))) return true;
     set_elevator_goal(0.5);
@@ -257,8 +259,8 @@
 
     set_suction_goal(false, 1);
     SendSuperstructureGoal();
-    LOG(INFO, "Dropping disc 1 %f\n",
-        ::aos::time::DurationInSeconds(monotonic_now() - start_time));
+    AOS_LOG(INFO, "Dropping disc 1 %f\n",
+            ::aos::time::DurationInSeconds(monotonic_now() - start_time));
 
     if (!WaitForDriveYCloseToZero(1.13)) return true;
     if (!WaitForMilliseconds(::std::chrono::milliseconds(300))) return true;
@@ -269,7 +271,7 @@
                    SplineDirection::kForward);
     if (!WaitForMilliseconds(::std::chrono::milliseconds(400))) return true;
     if (!spline2.WaitForPlan()) return true;
-    LOG(INFO, "Planned\n");
+    AOS_LOG(INFO, "Planned\n");
     // Drive back to hp and set the superstructure accordingly
     spline2.Start();
     if (!WaitForMilliseconds(::std::chrono::milliseconds(200))) return true;
@@ -283,8 +285,8 @@
     LineFollowAtVelocity(1.5);
     // As soon as we pick up Panel 2 go score on the rocket
     if (!WaitForGamePiece()) return true;
-    LOG(INFO, "Got gamepiece %f\n",
-        ::aos::time::DurationInSeconds(monotonic_now() - start_time));
+    AOS_LOG(INFO, "Got gamepiece %f\n",
+            ::aos::time::DurationInSeconds(monotonic_now() - start_time));
     LineFollowAtVelocity(-4.0);
     SplineHandle spline3 =
         PlanSpline(AutonomousSplines::HPToThirdCargoShipBay(is_left),
@@ -300,19 +302,19 @@
     if (!spline3.WaitForSplineDistanceRemaining(0.7)) return true;
     // Line follow in to the second disc.
     LineFollowAtVelocity(-0.7, 3);
-    LOG(INFO, "Drawing in disc 2 %f\n",
-        ::aos::time::DurationInSeconds(monotonic_now() - start_time));
+    AOS_LOG(INFO, "Drawing in disc 2 %f\n",
+            ::aos::time::DurationInSeconds(monotonic_now() - start_time));
     if (!WaitForDriveYCloseToZero(1.2)) return true;
 
     set_suction_goal(false, 1);
     SendSuperstructureGoal();
-    LOG(INFO, "Dropping disc 2 %f\n",
-        ::aos::time::DurationInSeconds(monotonic_now() - start_time));
+    AOS_LOG(INFO, "Dropping disc 2 %f\n",
+            ::aos::time::DurationInSeconds(monotonic_now() - start_time));
 
     if (!WaitForDriveYCloseToZero(1.13)) return true;
     if (!WaitForMilliseconds(::std::chrono::milliseconds(200))) return true;
-    LOG(INFO, "Backing up %f\n",
-        ::aos::time::DurationInSeconds(monotonic_now() - start_time));
+    AOS_LOG(INFO, "Backing up %f\n",
+            ::aos::time::DurationInSeconds(monotonic_now() - start_time));
     LineFollowAtVelocity(0.9, 3);
     if (!WaitForMilliseconds(::std::chrono::milliseconds(400))) return true;
   } else {
@@ -324,37 +326,37 @@
     SendSuperstructureGoal();
 
     if (!WaitForGamePiece()) return true;
-    LOG(INFO, "Has game piece\n");
+    AOS_LOG(INFO, "Has game piece\n");
 
     StartDrive(-4.0, 0.0, kJumpDrive, kTurn);
     if (!WaitForDriveNear(3.3, 10.0)) return true;
-    LOG(INFO, "Lifting\n");
+    AOS_LOG(INFO, "Lifting\n");
     set_elevator_goal(0.30);
     SendSuperstructureGoal();
 
     if (!WaitForDriveNear(2.8, 10.0)) return true;
-    LOG(INFO, "Off the platform\n");
+    AOS_LOG(INFO, "Off the platform\n");
 
     StartDrive(0.0, 1.00 * turn_scalar, kDrive, kTurn);
-    LOG(INFO, "Turn started\n");
+    AOS_LOG(INFO, "Turn started\n");
     if (!WaitForSuperstructureDone()) return true;
-    LOG(INFO, "Superstructure done\n");
+    AOS_LOG(INFO, "Superstructure done\n");
 
     if (!WaitForDriveNear(0.7, 10.0)) return true;
     StartDrive(0.0, -0.35 * turn_scalar, kDrive, kTurn);
 
-    LOG(INFO, "Elevator up\n");
+    AOS_LOG(INFO, "Elevator up\n");
     set_elevator_goal(0.78);
     SendSuperstructureGoal();
 
     if (!WaitForDriveDone()) return true;
-    LOG(INFO, "Done driving\n");
+    AOS_LOG(INFO, "Done driving\n");
 
     if (!WaitForSuperstructureDone()) return true;
   }
 
-  LOG(INFO, "Done %f\n",
-        ::aos::time::DurationInSeconds(monotonic_now() - start_time));
+  AOS_LOG(INFO, "Done %f\n",
+          ::aos::time::DurationInSeconds(monotonic_now() - start_time));
 
   return true;
 }
diff --git a/y2019/actors/autonomous_actor.h b/y2019/actors/autonomous_actor.h
index edb2272..8c61596 100644
--- a/y2019/actors/autonomous_actor.h
+++ b/y2019/actors/autonomous_actor.h
@@ -94,7 +94,7 @@
         wrist_max_acceleration_;
 
     if (!new_superstructure_goal.Send()) {
-      LOG(ERROR, "Sending superstructure goal failed.\n");
+      AOS_LOG(ERROR, "Sending superstructure goal failed.\n");
     }
   }
 
diff --git a/y2019/constants.cc b/y2019/constants.cc
index f9811a4..043624d 100644
--- a/y2019/constants.cc
+++ b/y2019/constants.cc
@@ -224,7 +224,7 @@
       break;
 
     default:
-      LOG(FATAL, "unknown team #%" PRIu16 "\n", team);
+      AOS_LOG(FATAL, "unknown team #%" PRIu16 "\n", team);
   }
 
   return r;
@@ -232,7 +232,7 @@
 
 const Values *DoGetValues() {
   uint16_t team = ::aos::network::GetTeamNumber();
-  LOG(INFO, "creating a Constants for team %" PRIu16 "\n", team);
+  AOS_LOG(INFO, "creating a Constants for team %" PRIu16 "\n", team);
   return DoGetValuesForTeam(team);
 }
 
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");
   }
 }
 
diff --git a/y2019/image_streamer/image_streamer.cc b/y2019/image_streamer/image_streamer.cc
index ebcd0b2..30bea8f 100644
--- a/y2019/image_streamer/image_streamer.cc
+++ b/y2019/image_streamer/image_streamer.cc
@@ -92,7 +92,7 @@
   }
 
   size_t Recv(void *data, int size) {
-    return PCHECK(recv(fd(), static_cast<char *>(data), size, 0));
+    return AOS_PCHECK(recv(fd(), static_cast<char *>(data), size, 0));
   }
 };
 
@@ -197,7 +197,7 @@
       fprintf(stderr, "wrong sized buffer\n");
       exit(-1);
     }
-    LOG(INFO, "Frame size in bytes: data.size() = %zu\n", data.size());
+    AOS_LOG(INFO, "Frame size in bytes: data.size() = %zu\n", data.size());
     output_buffer_.push_back(aos::vision::DataRef(data_header_tmp_, n_written));
     output_buffer_.push_back(data);
     output_buffer_.push_back("\r\n\r\n");
@@ -322,11 +322,11 @@
   params1.set_exposure(FLAGS_camera1_exposure);
 
   ::y2019::VisionStatus vision_status;
-  LOG(INFO,
-      "The UDP socket should be on port 5001 to 10.9.71.2 for "
-      "the competition robot.\n");
-  LOG(INFO, "Starting UDP socket on port 5001 to %s\n",
-      FLAGS_roborio_ip.c_str());
+  AOS_LOG(INFO,
+          "The UDP socket should be on port 5001 to 10.9.71.2 for "
+          "the competition robot.\n");
+  AOS_LOG(INFO, "Starting UDP socket on port 5001 to %s\n",
+          FLAGS_roborio_ip.c_str());
   ::aos::events::ProtoTXUdpSocket<::y2019::VisionStatus> status_socket(
       FLAGS_roborio_ip.c_str(), 5001);
 
@@ -335,7 +335,7 @@
       params0, "/dev/video0", &tcp_server_, !FLAGS_log.empty(),
       [&camera0, &status_socket, &vision_status]() {
         vision_status.set_low_frame_count(vision_status.low_frame_count() + 1);
-        LOG(INFO, "Got a frame cam0\n");
+        AOS_LOG(INFO, "Got a frame cam0\n");
         if (camera0->active()) {
           status_socket.Send(vision_status);
         }
@@ -346,7 +346,7 @@
         [&camera1, &status_socket, &vision_status]() {
           vision_status.set_high_frame_count(vision_status.high_frame_count() +
                                              1);
-          LOG(INFO, "Got a frame cam1\n");
+          AOS_LOG(INFO, "Got a frame cam1\n");
           if (camera1->active()) {
             status_socket.Send(vision_status);
           }
@@ -366,7 +366,8 @@
           cam0_active = true;
           camera0->set_active(true);
         }
-        LOG(INFO, "Got control packet, cam%d active\n", cam0_active ? 0 : 1);
+        AOS_LOG(INFO, "Got control packet, cam%d active\n",
+                cam0_active ? 0 : 1);
       });
 
   // Default to camera0
diff --git a/y2019/jevois/camera/image_stream.cc b/y2019/jevois/camera/image_stream.cc
index 29a1513..44fd8e5 100644
--- a/y2019/jevois/camera/image_stream.cc
+++ b/y2019/jevois/camera/image_stream.cc
@@ -8,7 +8,7 @@
 void ImageStreamEvent::ProcessHelper(
     aos::vision::DataRef data, aos::monotonic_clock::time_point timestamp) {
   if (data.size() < 300) {
-    LOG(INFO, "got bad img of size(%d)\n", static_cast<int>(data.size()));
+    AOS_LOG(INFO, "got bad img of size(%d)\n", static_cast<int>(data.size()));
     return;
   }
   ProcessImage(data, timestamp);
diff --git a/y2019/jevois/serial.cc b/y2019/jevois/serial.cc
index 7c49b4f..5febbb4 100644
--- a/y2019/jevois/serial.cc
+++ b/y2019/jevois/serial.cc
@@ -14,11 +14,12 @@
 int open_via_terminos(const char *tty_name) {
   int itsDev = ::open(tty_name, O_RDWR | O_NOCTTY | O_NONBLOCK);
   if (itsDev == -1) {
-    LOG(FATAL, "problem opening: %s\n", tty_name);
+    AOS_LOG(FATAL, "problem opening: %s\n", tty_name);
   }
 
   termios options = {};
-  if (tcgetattr(itsDev, &options) == -1) LOG(FATAL, "Failed to get options");
+  if (tcgetattr(itsDev, &options) == -1)
+    AOS_LOG(FATAL, "Failed to get options");
 
   // get raw input from the port
   options.c_cflag |= (CLOCAL     // ignore modem control lines
@@ -70,7 +71,7 @@
   // options.c_cflag |= CRTSCTS;
 
   if (tcsetattr(itsDev, TCSANOW, &options) == -1)
-    LOG(FATAL, "Failed to set port options");
+    AOS_LOG(FATAL, "Failed to set port options");
   return itsDev;
 }
 
diff --git a/y2019/jevois/spi.cc b/y2019/jevois/spi.cc
index c695c89..b6a281e 100644
--- a/y2019/jevois/spi.cc
+++ b/y2019/jevois/spi.cc
@@ -5,8 +5,8 @@
 #ifdef __linux__
 #include "aos/logging/logging.h"
 #else
-#define CHECK(...)
-#define CHECK_GE(...)
+#define AOS_CHECK(...)
+#define AOS_CHECK_GE(...)
 #endif
 
 // SPI transfer format (6x 8 bit frames):
@@ -175,11 +175,11 @@
     crc = jevois_crc_update(crc, transfer.data(),
                             transfer.size() - remaining_space.size());
     crc = jevois_crc_finalize(crc);
-    CHECK_GE(static_cast<size_t>(remaining_space.size()), sizeof(crc));
+    AOS_CHECK_GE(static_cast<size_t>(remaining_space.size()), sizeof(crc));
     memcpy(&remaining_space[0], &crc, sizeof(crc));
     remaining_space = remaining_space.subspan(sizeof(crc));
   }
-  CHECK(remaining_space.empty());
+  AOS_CHECK(remaining_space.empty());
   return transfer;
 }
 
@@ -226,10 +226,11 @@
                           transfer.size() - remaining_input.size());
     calculated_crc = jevois_crc_finalize(calculated_crc);
     uint16_t received_crc;
-    CHECK_GE(static_cast<size_t>(remaining_input.size()), sizeof(received_crc));
+    AOS_CHECK_GE(static_cast<size_t>(remaining_input.size()),
+                 sizeof(received_crc));
     memcpy(&received_crc, &remaining_input[0], sizeof(received_crc));
     remaining_input = remaining_input.subspan(sizeof(received_crc));
-    CHECK(remaining_input.empty());
+    AOS_CHECK(remaining_input.empty());
     if (calculated_crc != received_crc) {
       return tl::nullopt;
     }
@@ -259,7 +260,7 @@
     crc = jevois_crc_update(crc, transfer.data(),
                             transfer.size() - remaining_space.size());
     crc = jevois_crc_finalize(crc);
-    CHECK_GE(static_cast<size_t>(remaining_space.size()), sizeof(crc));
+    AOS_CHECK_GE(static_cast<size_t>(remaining_space.size()), sizeof(crc));
     memcpy(&remaining_space[0], &crc, sizeof(crc));
     remaining_space = remaining_space.subspan(sizeof(crc));
   }
@@ -292,7 +293,8 @@
                           transfer.size() - remaining_input.size());
     calculated_crc = jevois_crc_finalize(calculated_crc);
     uint16_t received_crc;
-    CHECK_GE(static_cast<size_t>(remaining_input.size()), sizeof(received_crc));
+    AOS_CHECK_GE(static_cast<size_t>(remaining_input.size()),
+                 sizeof(received_crc));
     memcpy(&received_crc, &remaining_input[0], sizeof(received_crc));
     remaining_input = remaining_input.subspan(sizeof(received_crc));
     if (calculated_crc != received_crc) {
diff --git a/y2019/jevois/uart.cc b/y2019/jevois/uart.cc
index 63138a8..6ebfe30 100644
--- a/y2019/jevois/uart.cc
+++ b/y2019/jevois/uart.cc
@@ -8,8 +8,8 @@
 #ifdef __linux__
 #include "aos/logging/logging.h"
 #else
-#define CHECK(...)
-#define CHECK_GE(...)
+#define AOS_CHECK(...)
+#define AOS_CHECK_GE(...)
 #endif
 
 namespace frc971 {
@@ -43,11 +43,11 @@
     crc = jevois_crc_update(crc, buffer.data(),
                             buffer.size() - remaining_space.size());
     crc = jevois_crc_finalize(crc);
-    CHECK_GE(static_cast<size_t>(remaining_space.size()), sizeof(crc));
+    AOS_CHECK_GE(static_cast<size_t>(remaining_space.size()), sizeof(crc));
     memcpy(&remaining_space[0], &crc, sizeof(crc));
     remaining_space = remaining_space.subspan(sizeof(crc));
   }
-  CHECK(remaining_space.empty());
+  AOS_CHECK(remaining_space.empty());
   UartToTeensyBuffer result;
   result.set_size(
       CobsEncode<uart_to_teensy_size()>(buffer, result.mutable_backing_array())
@@ -91,10 +91,11 @@
                                        buffer.size() - remaining_input.size());
     calculated_crc = jevois_crc_finalize(calculated_crc);
     uint16_t received_crc;
-    CHECK_GE(static_cast<size_t>(remaining_input.size()), sizeof(received_crc));
+    AOS_CHECK_GE(static_cast<size_t>(remaining_input.size()),
+                 sizeof(received_crc));
     memcpy(&received_crc, &remaining_input[0], sizeof(received_crc));
     remaining_input = remaining_input.subspan(sizeof(received_crc));
-    CHECK(remaining_input.empty());
+    AOS_CHECK(remaining_input.empty());
     if (calculated_crc != received_crc) {
       return tl::nullopt;
     }
@@ -129,11 +130,11 @@
     crc = jevois_crc_update(crc, buffer.data(),
                             buffer.size() - remaining_space.size());
     crc = jevois_crc_finalize(crc);
-    CHECK_GE(static_cast<size_t>(remaining_space.size()), sizeof(crc));
+    AOS_CHECK_GE(static_cast<size_t>(remaining_space.size()), sizeof(crc));
     memcpy(&remaining_space[0], &crc, sizeof(crc));
     remaining_space = remaining_space.subspan(sizeof(crc));
   }
-  CHECK(remaining_space.empty());
+  AOS_CHECK(remaining_space.empty());
   UartToCameraBuffer result;
   result.set_size(
       CobsEncode<uart_to_camera_size()>(buffer, result.mutable_backing_array())
@@ -180,10 +181,11 @@
                                        buffer.size() - remaining_input.size());
     calculated_crc = jevois_crc_finalize(calculated_crc);
     uint16_t received_crc;
-    CHECK_GE(static_cast<size_t>(remaining_input.size()), sizeof(received_crc));
+    AOS_CHECK_GE(static_cast<size_t>(remaining_input.size()),
+                 sizeof(received_crc));
     memcpy(&received_crc, &remaining_input[0], sizeof(received_crc));
     remaining_input = remaining_input.subspan(sizeof(received_crc));
-    CHECK(remaining_input.empty());
+    AOS_CHECK(remaining_input.empty());
     if (calculated_crc != received_crc) {
       return tl::nullopt;
     }
diff --git a/y2019/joystick_reader.cc b/y2019/joystick_reader.cc
index 5f5f06c..9450b13 100644
--- a/y2019/joystick_reader.cc
+++ b/y2019/joystick_reader.cc
@@ -179,7 +179,7 @@
   }
 
   void AutoEnded() override {
-    LOG(INFO, "Auto ended, assuming disc and have piece\n");
+    AOS_LOG(INFO, "Auto ended, assuming disc and have piece\n");
     grab_piece_ = true;
     switch_ball_ = false;
   }
@@ -191,7 +191,7 @@
     superstructure_status_fetcher_.Fetch();
     if (!superstructure_status_fetcher_.get() ||
         !superstructure_position_fetcher_.get()) {
-      LOG(ERROR, "Got no superstructure status or position packet.\n");
+      AOS_LOG(ERROR, "Got no superstructure status or position packet.\n");
       return;
     }
 
@@ -223,7 +223,7 @@
         }
       }
       if (!target_hint.Send()) {
-        LOG(ERROR, "Failed to send target selector hint.\n");
+        AOS_LOG(ERROR, "Failed to send target selector hint.\n");
       }
     }
 
@@ -235,7 +235,7 @@
       localizer_resetter->keep_current_theta = true;
 
       if (!localizer_resetter.Send()) {
-        LOG(ERROR, "Failed to reset localizer.\n");
+        AOS_LOG(ERROR, "Failed to reset localizer.\n");
       }
     }
 
@@ -247,7 +247,7 @@
       localizer_resetter->keep_current_theta = true;
 
       if (!localizer_resetter.Send()) {
-        LOG(ERROR, "Failed to reset localizer.\n");
+        AOS_LOG(ERROR, "Failed to reset localizer.\n");
       }
     }
 
@@ -259,7 +259,7 @@
       localizer_resetter->theta = 0.0;
 
       if (!localizer_resetter.Send()) {
-        LOG(ERROR, "Failed to reset localizer.\n");
+        AOS_LOG(ERROR, "Failed to reset localizer.\n");
       }
     }
 
@@ -271,7 +271,7 @@
       localizer_resetter->theta = M_PI;
 
       if (!localizer_resetter.Send()) {
-        LOG(ERROR, "Failed to reset localizer.\n");
+        AOS_LOG(ERROR, "Failed to reset localizer.\n");
       }
     }
 
@@ -283,7 +283,7 @@
       localizer_resetter->theta = 0.0;
 
       if (!localizer_resetter.Send()) {
-        LOG(ERROR, "Failed to reset localizer.\n");
+        AOS_LOG(ERROR, "Failed to reset localizer.\n");
       }
     }
 
@@ -295,7 +295,7 @@
       localizer_resetter->theta = M_PI;
 
       if (!localizer_resetter.Send()) {
-        LOG(ERROR, "Failed to reset localizer.\n");
+        AOS_LOG(ERROR, "Failed to reset localizer.\n");
       }
     }
 
@@ -313,7 +313,7 @@
       last_release_button_press_ = monotonic_now;
     }
 
-    LOG(INFO, "has_piece: %d\n", superstructure_status_fetcher_->has_piece);
+    AOS_LOG(INFO, "has_piece: %d\n", superstructure_status_fetcher_->has_piece);
     if (data.IsPressed(kSuctionBall)) {
       grab_piece_ = true;
     } else if (data.IsPressed(kSuctionHatch)) {
@@ -323,7 +323,7 @@
                data.IsPressed(kReleaseButtonBoard) ||
                !superstructure_status_fetcher_->has_piece) {
       grab_piece_ = false;
-      LOG(INFO, "releasing due to other thing\n");
+      AOS_LOG(INFO, "releasing due to other thing\n");
     }
 
     if (data.IsPressed(kRocketBackwardUnpressed)) {
@@ -477,7 +477,7 @@
          data.IsPressed(kRelease)) ||
         data.IsPressed(kReleaseButtonBoard)) {
       grab_piece_ = false;
-      LOG(INFO, "Releasing due to button\n");
+      AOS_LOG(INFO, "Releasing due to button\n");
     }
 
     if (switch_ball_) {
@@ -494,9 +494,9 @@
         elevator_wrist_pos_.elevator;
     new_superstructure_goal->wrist.unsafe_goal = elevator_wrist_pos_.wrist;
 
-    LOG_STRUCT(DEBUG, "sending goal", *new_superstructure_goal);
+    AOS_LOG_STRUCT(DEBUG, "sending goal", *new_superstructure_goal);
     if (!new_superstructure_goal.Send()) {
-      LOG(ERROR, "Sending superstructure goal failed.\n");
+      AOS_LOG(ERROR, "Sending superstructure goal failed.\n");
     }
 
     if (monotonic_now >
@@ -508,7 +508,7 @@
     {
       auto camera_log_message = camera_log_sender_.MakeMessage();
       camera_log_message->log = data.IsPressed(kCameraLog);
-      LOG_STRUCT(DEBUG, "camera_log", *camera_log_message);
+      AOS_LOG_STRUCT(DEBUG, "camera_log", *camera_log_message);
       camera_log_message.Send();
     }
   }
diff --git a/y2019/vision/server/server.cc b/y2019/vision/server/server.cc
index baab2c2..e66a70b 100644
--- a/y2019/vision/server/server.cc
+++ b/y2019/vision/server/server.cc
@@ -46,19 +46,19 @@
 
 void WebsocketHandler::onConnect(seasocks::WebSocket *connection) {
   connections_.insert(connection);
-  LOG(INFO, "Connected: %s : %s\n", connection->getRequestUri().c_str(),
-      seasocks::formatAddress(connection->getRemoteAddress()).c_str());
+  AOS_LOG(INFO, "Connected: %s : %s\n", connection->getRequestUri().c_str(),
+          seasocks::formatAddress(connection->getRemoteAddress()).c_str());
 }
 
 void WebsocketHandler::onData(seasocks::WebSocket * /*connection*/,
                               const char *data) {
-  LOG(INFO, "Got data: %s\n", data);
+  AOS_LOG(INFO, "Got data: %s\n", data);
 }
 
 void WebsocketHandler::onDisconnect(seasocks::WebSocket *connection) {
   connections_.erase(connection);
-  LOG(INFO, "Disconnected: %s : %s\n", connection->getRequestUri().c_str(),
-      seasocks::formatAddress(connection->getRemoteAddress()).c_str());
+  AOS_LOG(INFO, "Disconnected: %s : %s\n", connection->getRequestUri().c_str(),
+          seasocks::formatAddress(connection->getRemoteAddress()).c_str());
 }
 
 void WebsocketHandler::SendData(const std::string &data) {
diff --git a/y2019/wpilib_interface.cc b/y2019/wpilib_interface.cc
index 9ca37d8..4f09da1 100644
--- a/y2019/wpilib_interface.cc
+++ b/y2019/wpilib_interface.cc
@@ -297,7 +297,7 @@
           auto_mode_message->mode |= 1 << i;
         }
       }
-      LOG_STRUCT(DEBUG, "auto mode", *auto_mode_message);
+      AOS_LOG_STRUCT(DEBUG, "auto mode", *auto_mode_message);
       auto_mode_message.Send();
     }
   }
@@ -384,7 +384,7 @@
     const auto unpacked = SpiUnpackToRoborio(
         gsl::make_span(to_receive).last(spi_transfer_size()));
     if (!unpacked) {
-      LOG(INFO, "Decoding SPI data failed\n");
+      AOS_LOG(INFO, "Decoding SPI data failed\n");
       return;
     }
 
@@ -405,7 +405,7 @@
         to_send->targets[i].skew = received.targets[i].skew;
       }
       to_send->camera = received.camera_index;
-      LOG_STRUCT(DEBUG, "camera_frames", *to_send);
+      AOS_LOG_STRUCT(DEBUG, "camera_frames", *to_send);
       to_send.Send();
     }
 
@@ -416,7 +416,7 @@
   }
 
   void DoTransaction(gsl::span<char> to_send, gsl::span<char> to_receive) {
-    CHECK_EQ(to_send.size(), to_receive.size());
+    AOS_CHECK_EQ(to_send.size(), to_receive.size());
     const auto result = spi_->Transaction(
         reinterpret_cast<uint8_t *>(to_send.data()),
         reinterpret_cast<uint8_t *>(to_receive.data()), to_send.size());
@@ -424,10 +424,10 @@
       return;
     }
     if (result == -1) {
-      LOG(INFO, "SPI::Transaction of %zd bytes failed\n", to_send.size());
+      AOS_LOG(INFO, "SPI::Transaction of %zd bytes failed\n", to_send.size());
       return;
     }
-    LOG(FATAL, "SPI::Transaction returned something weird\n");
+    AOS_LOG(FATAL, "SPI::Transaction returned something weird\n");
   }
 
   void SetDummySPI(frc::SPI::Port port) {
@@ -489,7 +489,7 @@
 
  private:
   void Write(const SuperstructureQueue::Output &output) override {
-    LOG_STRUCT(DEBUG, "will output", output);
+    AOS_LOG_STRUCT(DEBUG, "will output", output);
     elevator_victor_->SetSpeed(::aos::Clip(output.elevator_voltage,
                                            -kMaxBringupPower,
                                            kMaxBringupPower) /
@@ -522,7 +522,7 @@
   }
 
   void Stop() override {
-    LOG(WARNING, "Superstructure output too old.\n");
+    AOS_LOG(WARNING, "Superstructure output too old.\n");
 
     elevator_victor_->SetDisabled();
     intake_victor_->SetDisabled();
@@ -574,13 +574,13 @@
 
   void Loop(const int iterations) {
     if (iterations != 1) {
-      LOG(DEBUG, "Solenoids skipped %d iterations\n", iterations - 1);
+      AOS_LOG(DEBUG, "Solenoids skipped %d iterations\n", iterations - 1);
     }
 
     {
       superstructure_fetcher_.Fetch();
       if (superstructure_fetcher_.get()) {
-        LOG_STRUCT(DEBUG, "solenoids", *superstructure_fetcher_);
+        AOS_LOG_STRUCT(DEBUG, "solenoids", *superstructure_fetcher_);
 
         big_suction_cup0_->Set(!superstructure_fetcher_->intake_suction_bottom);
         big_suction_cup1_->Set(!superstructure_fetcher_->intake_suction_bottom);
@@ -600,7 +600,7 @@
 
       pcm_.Flush();
       to_log.read_solenoids = pcm_.GetAll();
-      LOG_STRUCT(DEBUG, "pneumatics info", to_log);
+      AOS_LOG_STRUCT(DEBUG, "pneumatics info", to_log);
     }
 
     status_light_fetcher_.Fetch();
@@ -623,10 +623,10 @@
         light_flash_ = 0;
       }
 
-      LOG_STRUCT(DEBUG, "color", color);
+      AOS_LOG_STRUCT(DEBUG, "color", color);
       SetColor(color);
     } else {
-      LOG_STRUCT(DEBUG, "color", *status_light_fetcher_.get());
+      AOS_LOG_STRUCT(DEBUG, "color", *status_light_fetcher_.get());
       SetColor(*status_light_fetcher_.get());
     }
   }