Untangle and clean up the logging code

It was a mess before because of a combination of having code split out
for cRIO vs Linux and cruft.

Change-Id: Id282e1a7f7988be0441c669a573a5d022ed41fb9
diff --git a/aos/common/logging/matrix_logging.cc b/aos/common/logging/matrix_logging.cc
index 6173074..7c90632 100644
--- a/aos/common/logging/matrix_logging.cc
+++ b/aos/common/logging/matrix_logging.cc
@@ -1,18 +1,21 @@
 #include "aos/common/logging/matrix_logging.h"
 
 #include "aos/common/queue_types.h"
+#include "aos/common/logging/sizes.h"
 
 namespace aos {
 namespace logging {
+namespace internal {
 
-void LogImplementation::DoLogMatrix(log_level level,
-                                    const ::std::string &message,
-                                    uint32_t type_id, int rows, int cols,
-                                    const void *data, int levels) {
-  internal::RunWithCurrentImplementation(
-      levels, [&](LogImplementation * implementation) {
-    implementation->LogMatrix(level, message, type_id, rows, cols, data);
-  });
+void DoLogMatrix(log_level level, const ::std::string &message,
+                 uint32_t type_id, int rows, int cols, const void *data,
+                 int levels) {
+  {
+    auto fn = [&](LogImplementation *implementation) {
+      implementation->LogMatrix(level, message, type_id, rows, cols, data);
+    };
+    RunWithCurrentImplementation(levels, ::std::ref(fn));
+  }
 
   if (level == FATAL) {
     char serialized[1024];
@@ -31,5 +34,6 @@
   }
 }
 
+}  // namespace internal
 }  // namespace logging
 }  // namespace aos