Add fmtlib for phosphor-debug-collector
Call fmtlib to get additional information from journal.
Tested: built phosphor-debug-collector successfully
and Unit Test passes.
Signed-off-by: George Liu <liuxiwei@inspur.com>
Change-Id: Ibe65637a0b29b76269fb4bc3f498438901c9306a
diff --git a/dump_manager_main.cpp b/dump_manager_main.cpp
index 207de53..1eb5b31 100644
--- a/dump_manager_main.cpp
+++ b/dump_manager_main.cpp
@@ -8,6 +8,8 @@
#include "watch.hpp"
#include "xyz/openbmc_project/Common/error.hpp"
+#include <fmt/core.h>
+
#include <phosphor-logging/elog-errors.hpp>
#include <sdbusplus/bus.hpp>
@@ -25,8 +27,10 @@
auto rc = sd_event_default(&event);
if (rc < 0)
{
- log<level::ERR>("Error occurred during the sd_event_default",
- entry("RC=%d", rc));
+ log<level::ERR>(
+ fmt::format("Error occurred during the sd_event_default, rc({})",
+ rc)
+ .c_str());
report<InternalFailure>();
return rc;
}
@@ -37,22 +41,25 @@
sigset_t mask;
if (sigemptyset(&mask) < 0)
{
- log<level::ERR>("Unable to initialize signal set",
- entry("ERRNO=%d", errno));
+ log<level::ERR>(
+ fmt::format("Unable to initialize signal set, errno({})", errno)
+ .c_str());
return EXIT_FAILURE;
}
if (sigaddset(&mask, SIGCHLD) < 0)
{
- log<level::ERR>("Unable to add signal to signal set",
- entry("ERRNO=%d", errno));
+ log<level::ERR>(
+ fmt::format("Unable to add signal to signal set, errno({})", errno)
+ .c_str());
return EXIT_FAILURE;
}
// Block SIGCHLD first, so that the event loop can handle it
if (sigprocmask(SIG_BLOCK, &mask, nullptr) < 0)
{
- log<level::ERR>("Unable to block signal", entry("ERRNO=%d", errno));
+ log<level::ERR>(
+ fmt::format("Unable to block signal, errno({})", errno).c_str());
return EXIT_FAILURE;
}
@@ -86,8 +93,10 @@
auto rc = sd_event_loop(eventP.get());
if (rc < 0)
{
- log<level::ERR>("Error occurred during the sd_event_loop",
- entry("RC=%d", rc));
+ log<level::ERR>(
+ fmt::format("Error occurred during the sd_event_loop, rc({})",
+ rc)
+ .c_str());
elog<InternalFailure>();
}
}