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_resource.cpp b/dump-extensions/openpower-dumps/dump_manager_resource.cpp
index 50c7f59..d3abdbe 100644
--- a/dump-extensions/openpower-dumps/dump_manager_resource.cpp
+++ b/dump-extensions/openpower-dumps/dump_manager_resource.cpp
@@ -6,6 +6,8 @@
#include "resource_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>
@@ -58,11 +60,12 @@
}
catch (const std::invalid_argument& e)
{
- log<level::ERR>(e.what());
- log<level::ERR>("Error in creating resource 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 resource dump entry, "
+ "errormsg({}),OBJECTPATH({}),ID({}),"
+ "TIMESTAMP({}),SIZE({}),SOURCEID({})",
+ e.what(), objPath, id, timeStamp, size,
+ dumpId)
+ .c_str());
report<InternalFailure>();
return;
}
@@ -109,11 +112,12 @@
}
catch (const std::invalid_argument& e)
{
- log<level::ERR>(e.what());
- log<level::ERR>("Error in creating resource dump entry",
- entry("OBJECTPATH=%s", objPath.c_str()),
- entry("VSPSTRING=%s", vspString.c_str()),
- entry("ID=%d", id));
+ log<level::ERR>(
+ fmt::format(
+ "Error in creating resource dump "
+ "entry,errormsg({}),OBJECTPATH({}), VSPSTRING({}), ID({})",
+ e.what(), objPath, vspString, id)
+ .c_str());
elog<InternalFailure>();
return std::string();
}