got binary logging actually fully working (!!!)
diff --git a/aos/common/logging/logging_interface.cc b/aos/common/logging/logging_interface.cc
index 68a88a8..b4244fb 100644
--- a/aos/common/logging/logging_interface.cc
+++ b/aos/common/logging/logging_interface.cc
@@ -4,6 +4,8 @@
 #include <stdarg.h>
 #include <string.h>
 
+#include <type_traits>
+
 #include "aos/common/die.h"
 
 // This file only contains the code necessary to link (ie no implementations).
@@ -21,19 +23,21 @@
   cork_data.Reset();
 }
 
-void ExecuteFormat(char *output, size_t output_size,
-                   const char *format, va_list ap) {
-  static const char *continued = "...\n";
+size_t ExecuteFormat(char *output, size_t output_size, const char *format,
+                     va_list ap) {
+  static const char *const continued = "...\n";
   const size_t size = output_size - strlen(continued);
   const int ret = vsnprintf(output, size, format, ap);
+  typedef ::std::common_type<typeof(ret), typeof(size)>::type RetType;
   if (ret < 0) {
     LOG(FATAL, "vsnprintf(%p, %zd, %s, args) failed with %d (%s)\n",
         output, size, format, errno, strerror(errno));
-  } else if (static_cast<uintmax_t>(ret) >= static_cast<uintmax_t>(size)) {
+  } else if (static_cast<RetType>(ret) >= static_cast<RetType>(size)) {
     // Overwrite the '\0' at the end of the existing data and
     // copy in the one on the end of continued.
     memcpy(&output[size - 1], continued, strlen(continued) + 1);
   }
+  return ::std::min<RetType>(ret, size);
 }
 
 void RunWithCurrentImplementation(