Support printing the results of SortParts from log_cat
It is rather handy to be able to inspect a log file and pull out UUIDs,
the structure of the parts, and if it was sorted as expected. log_cat
is a fine place to do that, so let's do it here.
Change-Id: I83f8d97ef7e8783d59cbe30c69290ef272d365b2
Signed-off-by: Austin Schuh <austin.schuh@bluerivertech.com>
diff --git a/aos/events/logging/log_cat.cc b/aos/events/logging/log_cat.cc
index c040f22..c2378ab 100644
--- a/aos/events/logging/log_cat.cc
+++ b/aos/events/logging/log_cat.cc
@@ -36,6 +36,8 @@
DEFINE_bool(print, true,
"If true, actually print the messages. If false, discard them, "
"confirming they can be parsed.");
+DEFINE_bool(print_parts_only, false,
+ "If true, only print out the results of logfile sorting.");
// 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
@@ -171,6 +173,12 @@
for (auto &it : logfiles) {
VLOG(1) << it;
+ if (FLAGS_print_parts_only) {
+ std::cout << it << std::endl;
+ }
+ }
+ if (FLAGS_print_parts_only) {
+ return 0;
}
aos::logger::LogReader reader(logfiles);