Skip to content

Commit

Permalink
Use short log macros.
Browse files Browse the repository at this point in the history
  • Loading branch information
abeltrano committed Feb 22, 2024
1 parent ca5b1c8 commit a85c335
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/common/tools/cli/NetRemoteCli.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ NetRemoteCli::NetRemoteCli(std::shared_ptr<NetRemoteCliData> cliData, std::share

/* static */
std::shared_ptr<NetRemoteCli>
NetRemoteCli::Create(std::shared_ptr<NetRemoteCliData> cliData, std::shared_ptr<NetRemoteCliHandler> cliHandler)
NetRemoteCli::Create(std::shared_ptr<NetRemoteCliData> cliData, const std::shared_ptr<NetRemoteCliHandler>& cliHandler)
{
auto instance = std::make_shared<notstd::enable_make_protected<NetRemoteCli>>(std::move(cliData), cliHandler);
cliHandler->SetParent(instance->weak_from_this());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ struct NetRemoteCli :
* @return std::shared_ptr<NetRemoteClie>
*/
static std::shared_ptr<NetRemoteCli>
Create(std::shared_ptr<NetRemoteCliData> cliData, std::shared_ptr<NetRemoteCliHandler> cliHandler);
Create(std::shared_ptr<NetRemoteCliData> cliData, const std::shared_ptr<NetRemoteCliHandler>& cliHandler);

/**
* @brief Get a reference to the parser. The parser will be configured with all common command-line interface
Expand Down
2 changes: 1 addition & 1 deletion src/linux/libnl-helpers/Netlink80211Interface.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ Nl80211Interface::Parse(struct nl_msg *nl80211Message) noexcept
std::array<struct nlattr *, NL80211_ATTR_MAX + 1> newInterfaceMessageAttributes{};
int ret = nla_parse(std::data(newInterfaceMessageAttributes), std::size(newInterfaceMessageAttributes), genlmsg_attrdata(genl80211MessageHeader, 0), genlmsg_attrlen(genl80211MessageHeader, 0), nullptr);
if (ret < 0) {
LOG_ERROR << std::format("Failed to parse netlink message attributes with error {} ({})", ret, strerror(-ret));
LOGE << std::format("Failed to parse netlink message attributes with error {} ({})", ret, strerror(-ret));
return std::nullopt;
}

Expand Down
6 changes: 3 additions & 3 deletions src/linux/libnl-helpers/Netlink80211ProtocolState.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,22 @@ Nl80211ProtocolState::Nl80211ProtocolState()
int ret = genl_connect(netlinkSocket);
if (ret < 0) {
const auto err = errno;
LOG_ERROR << std::format("Failed to connect netlink socket for nl control with error {} ({})", err, strerror(err));
LOGE << std::format("Failed to connect netlink socket for nl control with error {} ({})", err, strerror(err));
throw err;
}

// Look up the nl80211 driver id.
DriverId = genl_ctrl_resolve(netlinkSocket, NL80211_GENL_NAME);
if (DriverId < 0) {
LOG_ERROR << std::format("Failed to resolve nl80211 netlink id with error {} ({})", DriverId, nl_geterror(DriverId));
LOGE << std::format("Failed to resolve nl80211 netlink id with error {} ({})", DriverId, nl_geterror(DriverId));
throw DriverId;
}

// Lookup the ids for the nl80211 multicast groups.
for (const auto& [multicastGroup, multicastGroupName] : Nl80211MulticastGroupNames) {
int multicastGroupId = genl_ctrl_resolve_grp(netlinkSocket, NL80211_GENL_NAME, std::data(multicastGroupName));
if (multicastGroupId < 0) {
LOG_ERROR << std::format("Failed to resolve nl80211 {} multicast group id with error {} ({})", multicastGroupName, multicastGroupId, nl_geterror(multicastGroupId));
LOGE << std::format("Failed to resolve nl80211 {} multicast group id with error {} ({})", multicastGroupName, multicastGroupId, nl_geterror(multicastGroupId));
throw multicastGroupId;
}
MulticastGroupId[multicastGroup] = multicastGroupId;
Expand Down
2 changes: 1 addition & 1 deletion src/linux/libnl-helpers/Netlink80211Wiphy.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ Nl80211Wiphy::Parse(struct nl_msg *nl80211Message) noexcept
std::array<struct nlattr *, NL80211_ATTR_MAX + 1> wiphyAttributes{};
int ret = nla_parse(std::data(wiphyAttributes), std::size(wiphyAttributes), genlmsg_attrdata(genl80211MessageHeader, 0), genlmsg_attrlen(genl80211MessageHeader, 0), nullptr);
if (ret < 0) {
LOG_ERROR << std::format("Failed to parse netlink message attributes with error {} ({})", ret, strerror(-ret));
LOGE << std::format("Failed to parse netlink message attributes with error {} ({})", ret, strerror(-ret));
return std::nullopt;
}

Expand Down
4 changes: 2 additions & 2 deletions src/linux/tools/apmonitor/Main.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ main([[maybe_unused]] int argc, [[maybe_unused]] char* argv[])
LOGI << std::format("{} -> {}", accessPointChanged->GetInterfaceName(), magic_enum::enum_name(presence));
});

LOG_INFO << "starting access point discovery agent";
LOGI << "starting access point discovery agent";
accessPointDiscoveryAgent->Start();

// Mask SIGTERM and SIGINT so they can be explicitly waited on from the main thread.
Expand All @@ -44,7 +44,7 @@ main([[maybe_unused]] int argc, [[maybe_unused]] char* argv[])
sigaddset(&mask, SIGINT);

if (sigprocmask(SIG_BLOCK, &mask, nullptr) < 0) {
LOG_ERROR << "failed to block terminate signals";
LOGE << "failed to block terminate signals";
return -1;
}

Expand Down

0 comments on commit a85c335

Please sign in to comment.