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-extensions/openpower-dumps/dump_manager_system.cpp b/dump-extensions/openpower-dumps/dump_manager_system.cpp
index 4652261..0288788 100644
--- a/dump-extensions/openpower-dumps/dump_manager_system.cpp
+++ b/dump-extensions/openpower-dumps/dump_manager_system.cpp
@@ -6,6 +6,8 @@
#include "system_dump_entry.hpp"
#include "xyz/openbmc_project/Common/error.hpp"
+#include <fmt/core.h>
+
#include <phosphor-logging/elog-errors.hpp>
#include <phosphor-logging/elog.hpp>
@@ -56,11 +58,12 @@
}
catch (const std::invalid_argument& e)
{
- log<level::ERR>(e.what());
- log<level::ERR>("Error in creating system dump entry",
- entry("OBJECTPATH=%s", objPath.c_str()),
- entry("ID=%d", id), entry("TIMESTAMP=%ull", timeStamp),
- entry("SIZE=%d", size), entry("SOURCEID=%d", dumpId));
+ log<level::ERR>(
+ fmt::format(
+ "Error in creating system dump entry, errormsg({}), "
+ "OBJECTPATH({}), ID({}), TIMESTAMP({}),SIZE({}), SOURCEID({})",
+ e.what(), objPath, id, timeStamp, size, dumpId)
+ .c_str());
report<InternalFailure>();
return;
}
@@ -114,10 +117,11 @@
}
catch (const std::invalid_argument& e)
{
- log<level::ERR>(e.what());
- log<level::ERR>("Error in creating system dump entry",
- entry("OBJECTPATH=%s", objPath.c_str()),
- entry("ID=%d", id));
+ log<level::ERR>(
+ fmt::format("Error in creating system dump entry, errormsg({}), "
+ "OBJECTPATH({}), ID({})",
+ e.what(), objPath, id)
+ .c_str());
elog<InternalFailure>();
return std::string();
}