Log transaction id on each journal entry

For each journal entry, add the transaction id for the process
that called the log interface. This will be used to identify all
the journal entries associated with a dbus message.

Change-Id: Id934253bd77a517315e6cdba01a8ac819ad95b52
Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
diff --git a/log.hpp b/log.hpp
index 1f1031c..a5ba738 100644
--- a/log.hpp
+++ b/log.hpp
@@ -18,6 +18,7 @@
 
 #include <tuple>
 #include <systemd/sd-journal.h>
+#include <sdbusplus/server/transaction.hpp>
 
 namespace phosphor
 {
@@ -115,7 +116,7 @@
 } // namespace details
 
 template <level L, typename Msg, typename ...Entry>
-void log(Msg msg, Entry... entry)
+void log(Msg msg, Entry... e)
 {
     static_assert((std::is_same<const char*, std::decay_t<Msg>>::value ||
                    std::is_same<char*, std::decay_t<Msg>>::value),
@@ -124,9 +125,13 @@
     constexpr const char *msg_str = "MESSAGE=%s";
     const auto msg_tuple = std::make_tuple(msg_str, std::forward<Msg>(msg));
 
+    constexpr auto transactionStr = "TRANSACTION_ID=%lld";
+    auto transactionId = sdbusplus::server::transaction::get_id();
+
     auto log_tuple = std::tuple_cat(details::prio<L>(),
                                     msg_tuple,
-                                    std::forward<Entry>(entry)...);
+                                    entry(transactionStr, transactionId),
+                                    std::forward<Entry>(e)...);
     details::log(log_tuple);
 }
 
@@ -141,4 +146,3 @@
 } // namespace logging
 
 } // namespace phosphor
-