Use config found in SortLogs instead of random log files

This both gives us a single Configuration object to use for all
matching configuration, and also gives us an abstraction to use when we
move the config out of the top of each log file and into a separate
file.

While we are here, expose name from the log file header as well.  This
removes the last user of the raw LogFileHeader from logger.

Change-Id: I0c99d64f9a7222e17100650cdf4b018ae224887a
diff --git a/aos/events/logging/logfile_utils.cc b/aos/events/logging/logfile_utils.cc
index 969f221..f6772e8 100644
--- a/aos/events/logging/logfile_utils.cc
+++ b/aos/events/logging/logfile_utils.cc
@@ -623,8 +623,7 @@
     parts_sorters_.emplace_back(std::move(part));
   }
 
-  node_ = configuration::GetNodeIndex(log_file_header()->configuration(),
-                                      part0_node);
+  node_ = configuration::GetNodeIndex(configuration(), part0_node);
 
   monotonic_start_time_ = monotonic_clock::max_time;
   realtime_start_time_ = realtime_clock::max_time;
@@ -636,6 +635,15 @@
   }
 }
 
+std::vector<const LogParts *> NodeMerger::Parts() const {
+  std::vector<const LogParts *> p;
+  p.reserve(parts_sorters_.size());
+  for (const LogPartsSorter &parts_sorter : parts_sorters_) {
+    p.emplace_back(&parts_sorter.parts());
+  }
+  return p;
+}
+
 Message *NodeMerger::Front() {
   // Return the current Front if we have one, otherwise go compute one.
   if (current_ != nullptr) {
@@ -695,7 +703,14 @@
                .monotonic_remote_time = monotonic_clock::min_time,
                .realtime_remote_time = realtime_clock::min_time,
                .data = SizePrefixedFlatbufferVector<MessageHeader>::Empty()} {
-  const Configuration *config = log_file_header()->configuration();
+  for (const LogParts *part : node_merger_.Parts()) {
+    if (!configuration_) {
+      configuration_ = part->config;
+    } else {
+      CHECK_EQ(configuration_.get(), part->config.get());
+    }
+  }
+  const Configuration *config = configuration_.get();
   // Only fill out nodes_data_ if there are nodes.  Otherwise everything gets
   // pretty simple.
   if (configuration::MultiNode(config)) {
@@ -728,7 +743,7 @@
 }
 
 void TimestampMapper::AddPeer(TimestampMapper *timestamp_mapper) {
-  CHECK(configuration::MultiNode(log_file_header()->configuration()));
+  CHECK(configuration::MultiNode(configuration()));
   CHECK_NE(timestamp_mapper->node(), node());
   CHECK_LT(timestamp_mapper->node(), nodes_data_.size());