Print out logger_instance_uuid

This UUID is unique per logger instance and printing it helps us better
understand what happened in our logs.

Change-Id: I4417d5fc9547e47381f3ef12a096b0c44d041115
Signed-off-by: Austin Schuh <austin.schuh@bluerivertech.com>
diff --git a/aos/events/logging/logfile_sorting.cc b/aos/events/logging/logfile_sorting.cc
index 81bf18c..c2134ad 100644
--- a/aos/events/logging/logfile_sorting.cc
+++ b/aos/events/logging/logfile_sorting.cc
@@ -140,6 +140,9 @@
 
   // The boot UUID of the node which generated this data.
   std::string source_boot_uuid;
+  // The logger instance UUID, all parts generated by a single Logger instance
+  // will have the same value here.
+  std::string logger_instance_uuid;
 
   // Pairs of the filename and the part index for sorting.
   std::vector<std::pair<std::string, int>> parts;
@@ -152,6 +155,9 @@
   std::string logger_node;
   // The boot UUID of the node this log file was created on.
   std::string logger_boot_uuid;
+  // The logger instance UUID, all parts generated by a single Logger instance
+  // will have the same value here.
+  std::string logger_instance_uuid;
 
   aos::monotonic_clock::time_point monotonic_start_time =
       aos::monotonic_clock::min_time;
@@ -328,6 +334,11 @@
             ? log_header->message().source_node_boot_uuid()->string_view()
             : "";
 
+    const std::string_view logger_instance_uuid =
+        log_header->message().has_logger_instance_uuid()
+            ? log_header->message().logger_instance_uuid()->string_view()
+            : "";
+
     std::string configuration_sha256 =
         log_header->message().has_configuration_sha256()
             ? log_header->message().configuration_sha256()->str()
@@ -478,6 +489,7 @@
       it->second.logger_realtime_start_time = logger_realtime_start_time;
       it->second.node = std::string(node);
       it->second.source_boot_uuid = source_boot_uuid;
+      it->second.logger_instance_uuid = logger_instance_uuid;
       it->second.config_sha256 = configuration_sha256;
     } else {
       CHECK_EQ(it->second.config_sha256, configuration_sha256);
@@ -1145,6 +1157,7 @@
       new_parts.log_event_uuid = logs.first;
       new_parts.source_boot_uuid = parts.second.source_boot_uuid;
       new_parts.parts_uuid = parts.first.first;
+      new_parts.logger_instance_uuid = parts.second.logger_instance_uuid;
       new_parts.node = std::move(parts.second.node);
       new_parts.boots = boot_counts;
 
@@ -1309,6 +1322,10 @@
   if (!parts.parts_uuid.empty()) {
     stream << "  \"parts_uuid\": \"" << parts.parts_uuid << "\",\n";
   }
+  if (!parts.logger_instance_uuid.empty()) {
+    stream << "  \"logger_instance_uuid\": \"" << parts.logger_instance_uuid
+           << "\",\n";
+  }
   if (!parts.node.empty()) {
     stream << "  \"node\": \"" << parts.node << "\",\n";
   }
diff --git a/aos/events/logging/logfile_sorting.h b/aos/events/logging/logfile_sorting.h
index 857f351..5de4570 100644
--- a/aos/events/logging/logfile_sorting.h
+++ b/aos/events/logging/logfile_sorting.h
@@ -39,6 +39,7 @@
   // UUIDs if available.
   std::string log_event_uuid;
   std::string parts_uuid;
+  std::string logger_instance_uuid;
 
   // The node this represents, or empty if we are in a single node world.
   std::string node;