diff options
-rw-r--r-- | Makefile.am | 6 | ||||
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | log.hpp | 10 |
3 files changed, 13 insertions, 5 deletions
diff --git a/Makefile.am b/Makefile.am index ea96862..49c54f0 100644 --- a/Makefile.am +++ b/Makefile.am @@ -20,8 +20,10 @@ BUILT_SOURCES = elog-gen.hpp CLEANFILES=elog-gen.hpp # systemd required for journal interfaces -logging_test_LDFLAGS = $(SYSTEMD_LIBS) -phosphor_log_manager_LDFLAGS = $(SYSTEMD_LIBS) +logging_test_LDFLAGS = $(SYSTEMD_LIBS) $(SDBUSPLUS_LIBS) +logging_test_CXXFLAGS = $(SYSTEMD_CFLAGS) $(SDBUSPLUS_CFLAGS) +phosphor_log_manager_LDFLAGS = $(SYSTEMD_LIBS) $(SDBUSPLUS_LIBS) +phosphor_log_manager_CXXFLAGS = $(SYSTEMD_CFLAGS) $(SDBUSPLUS_CFLAGS) ELOG_MAKO ?= elog-gen-template.mako.hpp ELOG_YAML_DIR ?= tools/example/xyz/openbmc_project/Example/ diff --git a/configure.ac b/configure.ac index 82f77a2..4d47f3b 100644 --- a/configure.ac +++ b/configure.ac @@ -17,6 +17,8 @@ AC_PROG_MAKE_SET LT_INIT PKG_CHECK_MODULES([SYSTEMD], [libsystemd >= 221]) +PKG_CHECK_MODULES([SDBUSPLUS], [sdbusplus],, + AC_MSG_ERROR(["Requires sdbusplus package."])) AC_CHECK_HEADER(systemd/sd-journal.h, ,[AC_MSG_ERROR([Could not find \ systemd/sd-journal.h...systemd developement package required])]) @@ -18,6 +18,7 @@ #include <tuple> #include <systemd/sd-journal.h> +#include <sdbusplus/server/transaction.hpp> namespace phosphor { @@ -115,7 +116,7 @@ void log(T&& e) } // 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 @@ void log(Msg msg, Entry... entry) 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 @@ constexpr auto entry(Arg&& arg, Args&&... args) } // namespace logging } // namespace phosphor - |