MaybeNodeName looks useful to be shared
It included trailing space for printing, but it will be used not only
for printing, so messages are adjusted accordingly.
Change-Id: I39bd50775f59b8055d21ccab8745046c0a654450
Signed-off-by: James Kuszmaul <james.kuszmaul@bluerivertech.com>
diff --git a/aos/events/logging/logfile_utils.h b/aos/events/logging/logfile_utils.h
index 1ee09fa..6337005 100644
--- a/aos/events/logging/logfile_utils.h
+++ b/aos/events/logging/logfile_utils.h
@@ -397,6 +397,7 @@
const LogParts parts_;
size_t next_part_index_ = 1u;
bool done_ = false;
+
MessageReader message_reader_;
// We instantiate the next one early, to allow implementations to prefetch.
// TODO(Brian): To get optimal performance when downloading, this needs more
@@ -898,9 +899,13 @@
std::function<bool(TimestampedMessage &)> replay_channels_callback_;
};
-// Returns the node name with a trailing space, or an empty string if we are on
-// a single node.
-std::string MaybeNodeName(const Node *);
+// Returns the node name, or an empty string if we are a single node.
+inline std::string_view MaybeNodeName(const Node *node) {
+ if (node != nullptr) {
+ return node->name()->string_view();
+ }
+ return "";
+}
// Class to copy a RemoteMessage into the provided buffer.
class RemoteMessageCopier : public DataEncoder::Copier {