Cleanup old headers and namespace declarations
Remove the header includes for the old phosphor::logging::log API
as well as unnecessary phosphor::logging namespace declarations.
Fully qualify phosphor::logging namespace where applicable and/or
needed.
Tested:
* Verified commit passed CI unit tests.
* Verified commit built using bitbake.
Change-Id: I2e490e1aa3fd3423f8c52694c2b97bc58b95525a
Signed-off-by: Anwaar Hadi <anwaar.hadi@ibm.com>
diff --git a/control/fan.cpp b/control/fan.cpp
index 98d4979..d6fca54 100644
--- a/control/fan.cpp
+++ b/control/fan.cpp
@@ -26,9 +26,6 @@
namespace control
{
-// For throwing exception
-using namespace phosphor::logging;
-
constexpr auto FAN_SENSOR_PATH = "/xyz/openbmc_project/sensors/fan_tach/";
constexpr auto FAN_TARGET_PROPERTY = "Target";
diff --git a/control/functor.hpp b/control/functor.hpp
index fd6fe6a..d7997c8 100644
--- a/control/functor.hpp
+++ b/control/functor.hpp
@@ -4,8 +4,6 @@
#include "types.hpp"
#include "zone.hpp"
-#include <phosphor-logging/log.hpp>
-
namespace phosphor
{
namespace fan
@@ -16,7 +14,6 @@
using namespace phosphor::fan;
using namespace sdbusplus::bus::match;
-using namespace phosphor::logging;
/**
* @brief Create a zone handler function object
diff --git a/control/json/actions/missing_owner_target.cpp b/control/json/actions/missing_owner_target.cpp
index 40894be..205002a 100644
--- a/control/json/actions/missing_owner_target.cpp
+++ b/control/json/actions/missing_owner_target.cpp
@@ -20,7 +20,6 @@
#include "group.hpp"
#include <nlohmann/json.hpp>
-#include <phosphor-logging/log.hpp>
#include <algorithm>
#include <format>
@@ -29,7 +28,6 @@
{
using json = nlohmann::json;
-using namespace phosphor::logging;
MissingOwnerTarget::MissingOwnerTarget(const json& jsonObj,
const std::vector<Group>& groups) :
diff --git a/control/json/utils/flight_recorder.cpp b/control/json/utils/flight_recorder.cpp
index b26d2d8..4376829 100644
--- a/control/json/utils/flight_recorder.cpp
+++ b/control/json/utils/flight_recorder.cpp
@@ -15,8 +15,6 @@
*/
#include "flight_recorder.hpp"
-#include <phosphor-logging/log.hpp>
-
#include <algorithm>
#include <ctime>
#include <format>
diff --git a/control/manager.cpp b/control/manager.cpp
index abcad6f..31b1408 100644
--- a/control/manager.cpp
+++ b/control/manager.cpp
@@ -25,7 +25,6 @@
#include <phosphor-logging/elog-errors.hpp>
#include <phosphor-logging/elog.hpp>
-#include <phosphor-logging/log.hpp>
#include <sdbusplus/bus.hpp>
#include <xyz/openbmc_project/Common/error.hpp>
@@ -39,7 +38,6 @@
namespace control
{
-using namespace phosphor::logging;
namespace fs = std::filesystem;
constexpr auto SYSTEMD_SERVICE = "org.freedesktop.systemd1";
diff --git a/cooling-type/cooling_type.cpp b/cooling-type/cooling_type.cpp
index 73d4b40..8c0527c 100644
--- a/cooling-type/cooling_type.cpp
+++ b/cooling-type/cooling_type.cpp
@@ -20,8 +20,6 @@
namespace type
{
-// For throwing exception
-using namespace phosphor::logging;
using InternalFailure =
sdbusplus::xyz::openbmc_project::Common::Error::InternalFailure;
@@ -38,7 +36,7 @@
lg2::error(
"Failed to get libevdev from file descriptor {FD}, return code {RC}",
"FD", fd, "RC", rc);
- elog<InternalFailure>();
+ phosphor::logging::elog<InternalFailure>();
return decltype(evdevOpen(0))(nullptr);
}
@@ -54,8 +52,6 @@
void CoolingType::readGpio(const std::string& gpioPath, unsigned int keycode)
{
- using namespace phosphor::logging;
-
gpioFd.open(gpioPath.c_str(), O_RDONLY);
auto gpioDev = evdevOpen(gpioFd());
@@ -67,7 +63,7 @@
{
lg2::error("Device does not support event type keycode {KEYCODE}",
"KEYCODE", keycode);
- elog<InternalFailure>();
+ phosphor::logging::elog<InternalFailure>();
}
// TODO openbmc/phosphor-fan-presence#6
diff --git a/cooling-type/main.cpp b/cooling-type/main.cpp
index 85f5294..863d7cf 100644
--- a/cooling-type/main.cpp
+++ b/cooling-type/main.cpp
@@ -10,7 +10,6 @@
using namespace phosphor::cooling::type;
using namespace phosphor::fan::util;
-using namespace phosphor::logging;
int main(int argc, char* argv[])
{
diff --git a/evdevpp/evdev.hpp b/evdevpp/evdev.hpp
index e68ad7c..4c4441f 100644
--- a/evdevpp/evdev.hpp
+++ b/evdevpp/evdev.hpp
@@ -39,7 +39,6 @@
} // namespace details
-using namespace phosphor::logging;
/** @class EvDev
* @brief Provides C++ bindings to the libevdev C API.
*/
@@ -78,7 +77,7 @@
lg2::error(
"Error in call to libevdev_fetch_event_value, Type={TYPE}, Code={CODE}",
"TYPE", type, "CODE", code);
- elog<InternalFailure>();
+ phosphor::logging::elog<InternalFailure>();
}
return val;
@@ -96,7 +95,7 @@
{
lg2::error("Error in call to libevdev_next_event, RC={RC}",
"RC", rc);
- elog<InternalFailure>();
+ phosphor::logging::elog<InternalFailure>();
}
if (ev.type == EV_SYN && ev.code == SYN_REPORT)
@@ -128,7 +127,7 @@
{
lg2::error("Error in call to libevdev_new_from_fd, RC={RC}, FD={FD}",
"RC", rc, "FD", fd);
- elog<InternalFailure>();
+ phosphor::logging::elog<InternalFailure>();
}
return EvDev(dev);
diff --git a/json_config.hpp b/json_config.hpp
index 87c6d1b..5cf3683 100644
--- a/json_config.hpp
+++ b/json_config.hpp
@@ -31,7 +31,6 @@
namespace fs = std::filesystem;
using json = nlohmann::json;
-using namespace phosphor::logging;
constexpr auto confOverridePath = "/etc/phosphor-fan-presence";
constexpr auto confBasePath = "/usr/share/phosphor-fan-presence";
diff --git a/monitor/conditions.cpp b/monitor/conditions.cpp
index 91d6a54..84f8ec2 100644
--- a/monitor/conditions.cpp
+++ b/monitor/conditions.cpp
@@ -18,7 +18,6 @@
{
using json = nlohmann::json;
-using namespace phosphor::logging;
Condition propertiesMatch(std::vector<PropertyState>&& propStates)
{
diff --git a/monitor/fan.cpp b/monitor/fan.cpp
index ab8d46d..f2f562c 100644
--- a/monitor/fan.cpp
+++ b/monitor/fan.cpp
@@ -32,7 +32,6 @@
namespace monitor
{
-using namespace phosphor::logging;
using namespace sdbusplus::bus::match;
Fan::Fan(Mode mode, sdbusplus::bus_t& bus, const sdeventplus::Event& event,
diff --git a/monitor/json_parser.cpp b/monitor/json_parser.cpp
index f24fd61..57bfdbd 100644
--- a/monitor/json_parser.cpp
+++ b/monitor/json_parser.cpp
@@ -36,7 +36,6 @@
{
using json = nlohmann::json;
-using namespace phosphor::logging;
namespace tClass
{
diff --git a/monitor/system.cpp b/monitor/system.cpp
index ff074c3..9620c09 100644
--- a/monitor/system.cpp
+++ b/monitor/system.cpp
@@ -44,8 +44,6 @@
using json = nlohmann::json;
using Severity = sdbusplus::xyz::openbmc_project::Logging::server::Entry::Level;
-using namespace phosphor::logging;
-
const std::string System::dumpFile = "/tmp/fan_monitor_dump.json";
System::System(Mode mode, sdbusplus::bus_t& bus,
diff --git a/monitor/tach_sensor.cpp b/monitor/tach_sensor.cpp
index 5790bab..cce3139 100644
--- a/monitor/tach_sensor.cpp
+++ b/monitor/tach_sensor.cpp
@@ -343,7 +343,7 @@
// Log an internal error for undefined timer mode
lg2::error("Undefined timer mode: {TIMER_MODE}", "TIMER_MODE",
mode);
- elog<InternalFailure>();
+ phosphor::logging::elog<InternalFailure>();
return duration_cast<microseconds>(seconds(0));
}
}
diff --git a/power_state.hpp b/power_state.hpp
index c5b0f0d..20ae1ba 100644
--- a/power_state.hpp
+++ b/power_state.hpp
@@ -2,7 +2,6 @@
#include "sdbusplus.hpp"
-#include <phosphor-logging/log.hpp>
#include <xyz/openbmc_project/State/Host/server.hpp>
#include <functional>
diff --git a/presence/anyof.cpp b/presence/anyof.cpp
index 635e6a6..07a31eb 100644
--- a/presence/anyof.cpp
+++ b/presence/anyof.cpp
@@ -19,8 +19,6 @@
#include "get_power_state.hpp"
#include "psensor.hpp"
-#include <phosphor-logging/log.hpp>
-
#include <algorithm>
namespace phosphor
diff --git a/presence/error_reporter.cpp b/presence/error_reporter.cpp
index 927ca2f..b57fa81 100644
--- a/presence/error_reporter.cpp
+++ b/presence/error_reporter.cpp
@@ -22,7 +22,6 @@
#include <unistd.h>
-#include <phosphor-logging/log.hpp>
#include <xyz/openbmc_project/Logging/Create/server.hpp>
#include <xyz/openbmc_project/Logging/Entry/server.hpp>
@@ -32,7 +31,6 @@
{
using json = nlohmann::json;
-using namespace phosphor::logging;
using namespace sdbusplus::bus::match;
using namespace std::literals::string_literals;
using namespace std::chrono;
diff --git a/presence/gpio.cpp b/presence/gpio.cpp
index 0bd5b6f..0920b35 100644
--- a/presence/gpio.cpp
+++ b/presence/gpio.cpp
@@ -66,10 +66,10 @@
void Gpio::fail()
{
using namespace sdbusplus::xyz::openbmc_project::Common::Callout::Error;
- using namespace phosphor::logging;
- using namespace xyz::openbmc_project::Common::Callout;
+ using namespace phosphor::logging::xyz::openbmc_project::Common::Callout;
- report<sdbusplus::xyz::openbmc_project::Common::Callout::Error::GPIO>(
+ phosphor::logging::report<
+ sdbusplus::xyz::openbmc_project::Common::Callout::Error::GPIO>(
GPIO::CALLOUT_GPIO_NUM(pin), GPIO::CALLOUT_ERRNO(0),
GPIO::CALLOUT_DEVICE_PATH(phys.c_str()));
}
diff --git a/presence/json_parser.cpp b/presence/json_parser.cpp
index 37c0d3a..00c3b6b 100644
--- a/presence/json_parser.cpp
+++ b/presence/json_parser.cpp
@@ -41,7 +41,6 @@
using json = nlohmann::json;
namespace fs = std::filesystem;
-using namespace phosphor::logging;
policies JsonConfig::_policies;
const std::map<std::string, methodHandler> JsonConfig::_methods = {
diff --git a/presence/tach.cpp b/presence/tach.cpp
index d27c356..b03a927 100644
--- a/presence/tach.cpp
+++ b/presence/tach.cpp
@@ -32,7 +32,6 @@
namespace presence
{
-using namespace phosphor::logging;
using namespace std::literals::string_literals;
static const auto tachNamespace = "/xyz/openbmc_project/sensors/fan_tach/"s;
diff --git a/utility.hpp b/utility.hpp
index a55a52f..c37df98 100644
--- a/utility.hpp
+++ b/utility.hpp
@@ -9,7 +9,6 @@
#include <sdbusplus/bus.hpp>
#include <xyz/openbmc_project/Common/error.hpp>
-using namespace phosphor::logging;
using InternalFailure =
sdbusplus::xyz::openbmc_project::Common::Error::InternalFailure;
@@ -66,7 +65,7 @@
{
lg2::error("Failed to open file device path {PATH}", "PATH",
pathname);
- elog<InternalFailure>();
+ phosphor::logging::elog<InternalFailure>();
}
}