Add flag to print configured channels using log_cat
This is helpful when you're trying to look for specific information in a
log but unsure of what channel(s) to filter through.
Change-Id: I22d9cc971dc71ff72e8ca6cb01508cd513b020aa
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 5c69f07..342a491 100644
--- a/aos/events/logging/log_cat.cc
+++ b/aos/events/logging/log_cat.cc
@@ -39,6 +39,8 @@
"confirming they can be parsed.");
DEFINE_bool(print_parts_only, false,
"If true, only print out the results of logfile sorting.");
+DEFINE_bool(channels, false,
+ "If true, print out all the configured channels for this log.");
// 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
@@ -227,6 +229,15 @@
aos::logger::LogReader reader(logfiles);
+ if (FLAGS_channels) {
+ const aos::Configuration *config = reader.configuration();
+ for (const aos::Channel *channel : *config->channels()) {
+ std::cout << channel->name()->c_str() << " " << channel->type()->c_str()
+ << '\n';
+ }
+ return 0;
+ }
+
aos::FastStringBuilder builder;
aos::SimulatedEventLoopFactory event_loop_factory(reader.configuration());