Use the event loop name instead of thread name for AOS_LOG
This kills 2 birds with 1 stone.
1) A simulated event loop should print out the name of each event
loop, not the program name.
2) prctl(PR_GET_NAME, thread_name_array) can require higher privileges
sometimes, and is un-necesary for simulations. See 1)
Change-Id: I48731b1cabe34ec66a97f27ee720ba3081da4e94
Signed-off-by: Austin Schuh <austin.linux@gmail.com>
diff --git a/aos/logging/interface.h b/aos/logging/interface.h
index f6fa249..d2663e7 100644
--- a/aos/logging/interface.h
+++ b/aos/logging/interface.h
@@ -4,6 +4,7 @@
#include <cstdarg>
#include <functional>
#include <string>
+#include <string_view>
#include "aos/logging/logging.h"
#include "aos/macros.h"
@@ -29,6 +30,10 @@
virtual ~LogImplementation() {}
+ // Returns the identifying name to be used when logging. This could be the
+ // event loop name or the thread name.
+ virtual std::string_view MyName() = 0;
+
// Actually logs the given message. Implementations should somehow create a
// LogMessage and then call internal::FillInMessage.
__attribute__((format(GOOD_PRINTF_FORMAT_TYPE, 3, 0))) virtual void DoLog(