Removed Common

Change-Id: I01ea8f07220375c2ad9bc0092281d4f27c642303
diff --git a/aos/logging/queue_logging.h b/aos/logging/queue_logging.h
new file mode 100644
index 0000000..a390412
--- /dev/null
+++ b/aos/logging/queue_logging.h
@@ -0,0 +1,43 @@
+#ifndef AOS_LOGGING_QUEUE_LOGGING_H_
+#define AOS_LOGGING_QUEUE_LOGGING_H_
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <functional>
+#include <string>
+
+#include "aos/logging/interface.h"
+#include "aos/die.h"
+
+namespace aos {
+namespace logging {
+
+// 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)                       \
+  do {                                                              \
+    static const ::std::string kAosLoggingMessage(                  \
+        LOG_SOURCENAME ": " STRINGIFY(__LINE__) ": " message);      \
+    ::aos::logging::DoLogStructTemplated(level, kAosLoggingMessage, \
+                                         structure);                \
+    /* so that GCC knows that it won't return */                    \
+    if (level == FATAL) {                                           \
+      ::aos::Die("DoLogStruct(FATAL) fell through!!!!!\n");         \
+    }                                                               \
+  } while (false)
+
+template <class T>
+void DoLogStructTemplated(log_level level, const ::std::string &message,
+                          const T &structure) {
+  auto fn = [&structure](char *buffer)
+                -> size_t { return structure.Serialize(buffer); };
+
+  internal::DoLogStruct(level, message, T::Size(), T::GetType(), ::std::ref(fn),
+                        1);
+}
+
+}  // namespace logging
+}  // namespace aos
+
+#endif  // AOS_LOGGING_QUEUE_LOGGING_H_