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/binary_log_writer.cc b/aos/common/logging/binary_log_writer.cc
index d4e6685..56949b5 100644
--- a/aos/common/logging/binary_log_writer.cc
+++ b/aos/common/logging/binary_log_writer.cc
@@ -14,10 +14,11 @@
#include <map>
#include <unordered_set>
-#include "aos/common/logging/linux_logging.h"
+#include "aos/common/logging/implementations.h"
#include "aos/common/logging/binary_log_file.h"
#include "aos/linux_code/init.h"
#include "aos/linux_code/configuration.h"
+#include "aos/linux_code/ipc_lib/queue.h"
#include "aos/common/queue_types.h"
#include "aos/common/die.h"
@@ -198,11 +199,14 @@
}
LogFileWriter writer(fd);
+ RawQueue *queue = GetLoggingQueue();
+
::std::unordered_set<uint32_t> written_type_ids;
off_t clear_type_ids_cookie = 0;
while (true) {
- const LogMessage *const msg = ReadNext();
+ const LogMessage *const msg =
+ static_cast<const LogMessage *>(queue->ReadMessage(RawQueue::kBlock));
if (msg == NULL) continue;
const size_t raw_output_length =
@@ -294,7 +298,7 @@
futex_set(&output->marker);
- logging::linux_code::Free(msg);
+ queue->FreeMessage(msg);
}
Cleanup();