Make log_cat only accept files ending with .bfbs or .bfbs.xz

Often, log_cat will be run on folders with other data.  This causes some
pretty terrible errors to be emitted.  Make things a lot simpler by only
accepting files with reasonable extensions.

Change-Id: Idf151f4e1b94a373615bee0f2214cfd017643fff
diff --git a/aos/events/logging/log_cat.cc b/aos/events/logging/log_cat.cc
index caa2b90..7dabc18 100644
--- a/aos/events/logging/log_cat.cc
+++ b/aos/events/logging/log_cat.cc
@@ -33,6 +33,11 @@
 DEFINE_bool(pretty, false,
             "If true, pretty print the messages on multiple lines");
 
+bool EndsWith(std::string_view str, std::string_view ending) {
+  return str.size() >= ending.size() &&
+         str.substr(str.size() - ending.size()) == ending;
+}
+
 // Print the flatbuffer out to stdout, both to remove the unnecessary cruft from
 // glog and to allow the user to readily redirect just the logged output
 // independent of any debugging information on stderr.
@@ -66,7 +71,9 @@
     // its not a directory
     // it could be a file
     // or it could not exist
-    files->emplace_back(filename);
+    if (EndsWith(filename, ".bfbs") || EndsWith(filename, ".bfbs.xz")) {
+      files->emplace_back(filename);
+    }
     return;
   }