Add logger and log_dumper binaries
This enables actually logging data on the roborio and subsequently
actually doing basic viewing of the data in the logfiles.
Tested manually on my local machine.
This also makes an //aos/events/logging folder (this is distinct from
the //aos/logging folder which contains older logging information).
Change-Id: I41f3216d6c56e8330667e8dd6050b1a0dd5b19c9
diff --git a/aos/events/logging/logger_main.cc b/aos/events/logging/logger_main.cc
new file mode 100644
index 0000000..6049f41
--- /dev/null
+++ b/aos/events/logging/logger_main.cc
@@ -0,0 +1,35 @@
+#include "aos/configuration.h"
+#include "aos/events/logging/logger.h"
+#include "aos/events/shm_event_loop.h"
+#include "aos/init.h"
+#include "gflags/gflags.h"
+#include "glog/logging.h"
+
+// TODO(james): Write code for managing logfile names.
+DEFINE_string(logfile, "/media/sda1/logfile.bfbs",
+ "Name of the logfile to write to.");
+
+DEFINE_string(config, "config.json", "Config file to use.");
+
+int main(int argc, char *argv[]) {
+ gflags::SetUsageMessage(
+ "This program provides a simple logger binary that logs all SHMEM data "
+ "directly to a file specified at the command line. It does not manage "
+ "filenames, so it will just crash if you attempt to overwrite an "
+ "existing file, and the user must specify the logfile manually at the "
+ "command line.");
+ aos::InitGoogle(&argc, &argv);
+
+ aos::FlatbufferDetachedBuffer<aos::Configuration> config =
+ aos::configuration::ReadConfig(FLAGS_config);
+
+ aos::ShmEventLoop event_loop(&config.message());
+
+ aos::logger::DetachedBufferWriter writer(FLAGS_logfile);
+ aos::logger::Logger logger(&writer, &event_loop);
+
+ event_loop.Run();
+
+ aos::Cleanup();
+ return 0;
+}