Support printing just the configuration with log_cat --raw
If someone passes in just the configuration with log_cat --raw, we
can pretty accurately deduce that they want to print out just the
configuration. Don't require a log file too.
Change-Id: I52078a234e7f52da741582571f847ef7f32ed888
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 1f166e4..f925651 100644
--- a/aos/events/logging/log_cat.cc
+++ b/aos/events/logging/log_cat.cc
@@ -66,7 +66,17 @@
// Prints out raw log parts to stdout.
int PrintRaw(int argc, char **argv) {
- if (argc != 2) {
+ if (argc == 1) {
+ CHECK(!FLAGS_raw_header.empty());
+ aos::logger::MessageReader raw_header_reader(FLAGS_raw_header);
+ std::cout << aos::FlatbufferToJson(raw_header_reader.raw_log_file_header(),
+ {.multi_line = FLAGS_pretty,
+ .max_vector_size = static_cast<size_t>(
+ FLAGS_max_vector_size)})
+ << std::endl;
+ return 0;
+ }
+ if (argc != 2 && argc != 1) {
LOG(FATAL) << "Expected 1 logfile as an argument.";
}
aos::logger::SpanReader reader(argv[1]);