Update occ-control to use lg2 for all logging
Convert existing log<level>() trace statements to lg2::level()
Testing: Verified on Rainier - captured journal traces before and after
commit during boots, mode, pcap and ips changes.
Change-Id: I318fa7bf3902c641b0c28b09190db4b61d0a2fa9
Signed-off-by: Chris Cain <cjcain@us.ibm.com>
diff --git a/occ_device.cpp b/occ_device.cpp
index ded5db9..98eeab7 100644
--- a/occ_device.cpp
+++ b/occ_device.cpp
@@ -3,7 +3,7 @@
#include "occ_manager.hpp"
#include "occ_status.hpp"
-#include <phosphor-logging/log.hpp>
+#include <phosphor-logging/lg2.hpp>
#include <filesystem>
#include <iostream>
@@ -13,8 +13,6 @@
namespace occ
{
-using namespace phosphor::logging;
-
void Device::setActive(bool active)
{
std::string data = active ? "1" : "0";
@@ -25,9 +23,8 @@
}
catch (const std::exception& e)
{
- log<level::ERR>(std::format("Failed to set {} active: {}",
- devPath.c_str(), e.what())
- .c_str());
+ lg2::error("Failed to set {DEVICE} active: {ERROR}", "DEVICE", devPath,
+ "ERROR", e.what());
}
}
@@ -151,10 +148,8 @@
}
catch (const fs::filesystem_error& e)
{
- log<level::ERR>(
- std::format("getFilenameByRegex: Failed to get filename: {}",
- e.what())
- .c_str());
+ lg2::error("getFilenameByRegex: Failed to get filename: {ERROR}",
+ "ERROR", e.what());
}
// Return empty path