Fix entries used by phosphor-logging
Fixed entires used by phosphor::logging::log function. Now logs
display proper information.
Tested: - Verified if logs contain correct entries
Change-Id: I5254555aa55bbe06c882d7024db911812e6f3f63
Signed-off-by: Wludzik, Jozef <jozef.wludzik@intel.com>
diff --git a/src/persistent_json_storage.cpp b/src/persistent_json_storage.cpp
index 58a2e6c..896c8a9 100644
--- a/src/persistent_json_storage.cpp
+++ b/src/persistent_json_storage.cpp
@@ -18,7 +18,7 @@
std::error_code ec;
phosphor::logging::log<phosphor::logging::level::DEBUG>(
- "Store to file", phosphor::logging::entry("path=%s", path.c_str()));
+ "Store to file", phosphor::logging::entry("PATH=%s", path.c_str()));
std::filesystem::create_directories(path.parent_path(), ec);
if (ec)
@@ -55,8 +55,8 @@
{
phosphor::logging::log<phosphor::logging::level::ERR>(
"Unable to remove file",
- phosphor::logging::entry("path=%s, ec= %lu: %s", path.c_str(),
- ec.value(), ec.message().c_str()));
+ phosphor::logging::entry("PATH=%s", path.c_str()),
+ phosphor::logging::entry("ERROR_CODE=%d", ec.value()));
return false;
}
diff --git a/src/report.cpp b/src/report.cpp
index dc8f37b..59028f4 100644
--- a/src/report.cpp
+++ b/src/report.cpp
@@ -190,7 +190,7 @@
{
phosphor::logging::log<phosphor::logging::level::ERR>(
"Failed to store a report in storage",
- phosphor::logging::entry("msg=", e.what()));
+ phosphor::logging::entry("EXCEPTION_MSG=%s", e.what()));
return false;
}
diff --git a/src/report_manager.cpp b/src/report_manager.cpp
index 13ca6db..951aa5f 100644
--- a/src/report_manager.cpp
+++ b/src/report_manager.cpp
@@ -190,9 +190,9 @@
phosphor::logging::log<phosphor::logging::level::ERR>(
"Failed to load report from storage",
phosphor::logging::entry(
- "filename=",
+ "FILENAME=%s",
static_cast<std::filesystem::path>(path).c_str()),
- phosphor::logging::entry("msg=", e.what()));
+ phosphor::logging::entry("EXCEPTION_MSG=%s", e.what()));
reportStorage->remove(path);
}
}
diff --git a/src/sensor.cpp b/src/sensor.cpp
index 8a6f673..8b4fe01 100644
--- a/src/sensor.cpp
+++ b/src/sensor.cpp
@@ -39,8 +39,8 @@
weakSelf = weak_from_this()](boost::system::error_code ec) {
phosphor::logging::log<phosphor::logging::level::WARNING>(
"DBus 'GetProperty' call failed on Sensor Value",
- phosphor::logging::entry("sensor=%s, ec=%lu", id.str().c_str(),
- ec.value()));
+ phosphor::logging::entry("SENSOR_PATH=%s", id.path.c_str()),
+ phosphor::logging::entry("ERROR_CODE=%d", ec.value()));
},
[lock, weakSelf = weak_from_this()](double newValue) {
if (auto self = weakSelf.lock())
@@ -147,7 +147,7 @@
phosphor::logging::log<phosphor::logging::level::ERR>(
"Failed to receive Value from Sensor "
"PropertiesChanged signal",
- phosphor::logging::entry("sensor=%s",
+ phosphor::logging::entry("SENSOR_PATH=%s",
self->sensorId.path.c_str()));
}
}