Create C++ -> Python interface for calling LogReader

This provides an interface that allows the user to extract json data
from the logfiles directly into Python.

Change-Id: Iafd1e4ac2301befe1f8939b396d6e40a3133b2a2
diff --git a/aos/BUILD b/aos/BUILD
index 6b3c5bc..e964066 100644
--- a/aos/BUILD
+++ b/aos/BUILD
@@ -1,5 +1,5 @@
 load("//tools:environments.bzl", "mcu_cpus")
-load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library")
+load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library", "flatbuffer_python_library")
 
 filegroup(
     name = "prime_binaries",
@@ -295,6 +295,19 @@
     visibility = ["//visibility:public"],
 )
 
+flatbuffer_python_library(
+    name = "configuration_fbs_python",
+    srcs = ["configuration.fbs"],
+    namespace = "aos",
+    tables = [
+        "Configuration",
+        "Channel",
+        "Map",
+        "Node",
+    ],
+    visibility = ["//visibility:public"],
+)
+
 cc_library(
     name = "configuration",
     srcs = [
diff --git a/aos/events/logging/logger.cc b/aos/events/logging/logger.cc
index e35fe5b..1c2815d 100644
--- a/aos/events/logging/logger.cc
+++ b/aos/events/logging/logger.cc
@@ -269,6 +269,10 @@
   QueueMessages();
 }
 
+LogReader::~LogReader() {
+  CHECK(!event_loop_unique_ptr_) << "Did you remember to call Deregister?";
+}
+
 bool LogReader::ReadBlock() {
   if (end_of_file_) {
     return false;
diff --git a/aos/events/logging/logger.h b/aos/events/logging/logger.h
index 497dabb..b1f6718 100644
--- a/aos/events/logging/logger.h
+++ b/aos/events/logging/logger.h
@@ -93,6 +93,7 @@
 class LogReader {
  public:
   LogReader(absl::string_view filename);
+  ~LogReader();
 
   // Registers the timer and senders used to resend the messages from the log
   // file.