Add a pretty print flag for aos_dump and log_cat

Change-Id: If4f99fc17a63f155bcaa85b7efcbe08858eac04d
diff --git a/aos/aos_dump.cc b/aos/aos_dump.cc
index 62fb5cb..ac82b95 100644
--- a/aos/aos_dump.cc
+++ b/aos/aos_dump.cc
@@ -12,6 +12,8 @@
              "If positive, vectors longer than this will not be printed");
 DEFINE_bool(fetch, false,
             "If true, fetch the current message on the channel first");
+DEFINE_bool(pretty, false,
+            "If true, pretty print the messages on multiple lines");
 
 namespace {
 
@@ -23,9 +25,9 @@
   // information on stderr.
 
   builder->Reset();
-  aos::FlatbufferToJson(builder, channel->schema(),
-                        static_cast<const uint8_t *>(context.data),
-                        {false, static_cast<size_t>(FLAGS_max_vector_size)});
+  aos::FlatbufferToJson(
+      builder, channel->schema(), static_cast<const uint8_t *>(context.data),
+      {FLAGS_pretty, static_cast<size_t>(FLAGS_max_vector_size)});
 
   if (context.monotonic_remote_time != context.monotonic_event_time) {
     std::cout << context.realtime_remote_time << " ("
diff --git a/aos/events/logging/log_cat.cc b/aos/events/logging/log_cat.cc
index 38bd390..b9d53ff 100644
--- a/aos/events/logging/log_cat.cc
+++ b/aos/events/logging/log_cat.cc
@@ -29,6 +29,8 @@
             "schema to format the data.");
 DEFINE_int32(max_vector_size, 100,
              "If positive, vectors longer than this will not be printed");
+DEFINE_bool(pretty, false,
+            "If true, pretty print the messages on multiple lines");
 
 // 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
@@ -37,9 +39,9 @@
                   const aos::Context &context,
                   aos::FastStringBuilder *builder) {
   builder->Reset();
-  aos::FlatbufferToJson(builder, channel->schema(),
-                        static_cast<const uint8_t *>(context.data),
-                        {false, static_cast<size_t>(FLAGS_max_vector_size)});
+  aos::FlatbufferToJson(
+      builder, channel->schema(), static_cast<const uint8_t *>(context.data),
+      {FLAGS_pretty, static_cast<size_t>(FLAGS_max_vector_size)});
 
   if (context.monotonic_remote_time != context.monotonic_event_time) {
     std::cout << node_name << context.realtime_event_time << " ("
@@ -91,18 +93,20 @@
         std::cout << aos::configuration::StrippedChannelToString(channel) << " "
                   << aos::FlatbufferToJson(
                          message.value(),
-                         {.multi_line = false, .max_vector_size = 4})
+                         {.multi_line = FLAGS_pretty, .max_vector_size = 4})
                   << ": "
                   << aos::FlatbufferToJson(
                          channel->schema(),
                          message.value().message().data()->data(),
-                         {false, static_cast<size_t>(FLAGS_max_vector_size)})
+                         {FLAGS_pretty,
+                          static_cast<size_t>(FLAGS_max_vector_size)})
                   << std::endl;
       } else {
         std::cout << aos::configuration::StrippedChannelToString(channel) << " "
                   << aos::FlatbufferToJson(
                          message.value(),
-                         {false, static_cast<size_t>(FLAGS_max_vector_size)})
+                         {FLAGS_pretty,
+                          static_cast<size_t>(FLAGS_max_vector_size)})
                   << std::endl;
       }
     }
@@ -190,9 +194,8 @@
         }
 
         printer_event_loop->MakeRawWatcher(
-            channel,
-            [channel, node_name, &builder](const aos::Context &context,
-                                               const void * /*message*/) {
+            channel, [channel, node_name, &builder](const aos::Context &context,
+                                                    const void * /*message*/) {
               PrintMessage(node_name, channel, context, &builder);
             });
         found_channel = true;