Removed Common
Change-Id: I01ea8f07220375c2ad9bc0092281d4f27c642303
diff --git a/aos/logging/queue_logging.cc b/aos/logging/queue_logging.cc
new file mode 100644
index 0000000..541ddb1
--- /dev/null
+++ b/aos/logging/queue_logging.cc
@@ -0,0 +1,39 @@
+#include "aos/logging/queue_logging.h"
+
+#include "aos/logging/interface.h"
+#include "aos/logging/sizes.h"
+#include "aos/queue_types.h"
+
+namespace aos {
+namespace logging {
+namespace internal {
+
+void DoLogStruct(log_level level, const ::std::string &message, size_t size,
+ const MessageType *type,
+ const ::std::function<size_t(char *)> &serialize, int levels) {
+ {
+ auto fn = [&](LogImplementation *implementation) {
+ implementation->LogStruct(level, message, size, type, serialize);
+ };
+ RunWithCurrentImplementation(levels, ::std::ref(fn));
+ }
+
+ if (level == FATAL) {
+ char serialized[1024];
+ if (size > sizeof(serialized)) {
+ Die("LOG(FATAL) structure too big to serialize");
+ }
+ size_t used = serialize(serialized);
+ char printed[LOG_MESSAGE_LEN];
+ size_t printed_bytes = sizeof(printed);
+ if (!PrintMessage(printed, &printed_bytes, serialized, &used, *type)) {
+ Die("LOG(FATAL) PrintMessage call failed");
+ }
+ Die("%.*s: %.*s\n", static_cast<int>(message.size()), message.data(),
+ static_cast<int>(printed_bytes), printed);
+ }
+}
+
+} // namespace internal
+} // namespace logging
+} // namespace aos