Renice logger for fewer deaths

It isn't worth putting it on the RT scheduler (it really isn't RT), but
we do want the logger to run at a pretty high priority.  Be the least
nice possible to achieve this.  This lets the OS still swap it out if it
needs to, but prioritizes it.

Change-Id: Icb33b4e8e167749ff6e4310f9cbb33de536d8e9a
diff --git a/aos/events/logging/logger_main.cc b/aos/events/logging/logger_main.cc
index 1bc74f2..f6ec4d6 100644
--- a/aos/events/logging/logger_main.cc
+++ b/aos/events/logging/logger_main.cc
@@ -1,3 +1,6 @@
+#include <sys/resource.h>
+#include <sys/time.h>
+
 #include "aos/configuration.h"
 #include "aos/events/logging/logger.h"
 #include "aos/events/shm_event_loop.h"
@@ -33,8 +36,12 @@
   }
 
   aos::logger::Logger logger(&event_loop);
-  event_loop.OnRun(
-      [&log_namer, &logger]() { logger.StartLogging(std::move(log_namer)); });
+  event_loop.OnRun([&log_namer, &logger]() {
+    errno = 0;
+    setpriority(PRIO_PROCESS, 0, -20);
+    PCHECK(errno == 0) << ": Renicing to -20 failed";
+    logger.StartLogging(std::move(log_namer));
+  });
 
   event_loop.Run();