Revert "PEL: Use lg2 in peltool.cpp"
Since lg2 prints to the console when the application is called from the
commandline like peltool is, when the -D peltool option is used to
delete all PELs it will print something. This isn't that helpful and
people are complaining about it. So just go back to the original
phosphor-logging API which won't do this.
This reverts commit aaf23ee78584181b7b64450c3eafa8b3c7372b3b.
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: I387f277ca0e57fbf5f52f3e8294572bc702db997
diff --git a/extensions/openpower-pels/tools/peltool.cpp b/extensions/openpower-pels/tools/peltool.cpp
index 643a8a2..063127f 100644
--- a/extensions/openpower-pels/tools/peltool.cpp
+++ b/extensions/openpower-pels/tools/peltool.cpp
@@ -27,7 +27,7 @@
#include <Python.h>
#include <CLI/CLI.hpp>
-#include <phosphor-logging/lg2.hpp>
+#include <phosphor-logging/log.hpp>
#include <bitset>
#include <fstream>
@@ -36,6 +36,7 @@
#include <string>
namespace fs = std::filesystem;
+using namespace phosphor::logging;
using namespace openpower::pels;
namespace message = openpower::pels::message;
namespace pv = openpower::pels::pel_values;
@@ -325,7 +326,8 @@
std::vector<uint8_t> data = getFileData(fileName);
if (data.empty())
{
- lg2::error("Empty PEL file {FILE}", "FILE", fileName);
+ log<level::ERR>("Empty PEL file",
+ entry("FILENAME=%s", fileName.c_str()));
return listStr;
}
PEL pel{data};
@@ -450,8 +452,9 @@
}
catch (const std::exception& e)
{
- lg2::error("Hit exception while reading PEL File {FILE}: {ERROR}",
- "FILE", fileName, "ERROR", e);
+ log<level::ERR>("Hit exception while reading PEL File",
+ entry("FILENAME=%s", fileName.c_str()),
+ entry("ERROR=%s", e.what()));
}
return listStr;
}
@@ -654,7 +657,7 @@
*/
void deleteAllPELs()
{
- lg2::info("peltool deleting all event logs");
+ log<level::INFO>("peltool deleting all event logs");
for (const auto& entry : fs::directory_iterator(pelLogDir()))
{