Skip to content

Commit

Permalink
logging
Browse files Browse the repository at this point in the history
  • Loading branch information
gcontini committed May 19, 2021
1 parent 6ce2a58 commit 6bd24f7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 15 deletions.
20 changes: 7 additions & 13 deletions src/library/os/linux/network.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ FUNCTION_RETURN getAdapterInfos(vector<OsAdapterInfo> &adapterInfos) {
FUNCTION_RETURN f_return = FUNC_RET_OK;
struct ifaddrs *ifaddr, *ifa;
int family, n = 0;
unsigned int if_num, if_max;
unsigned int if_num;

if (getifaddrs(&ifaddr) == -1) {
LOG_WARN("getifaddrs failed == -1");
Expand All @@ -75,12 +75,10 @@ FUNCTION_RETURN getAdapterInfos(vector<OsAdapterInfo> &adapterInfos) {
family = ifa->ifa_addr->sa_family;
/* Display interface name and family (including symbolic
form of the latter for the common families) */
#ifndef NDEBUG
printf("%-8s %s (%d)\n", ifa->ifa_name,
(family == AF_PACKET) ? "AF_PACKET"
: (family == AF_INET) ? "AF_INET" : (family == AF_INET6) ? "AF_INET6" : "???",
family);
#endif
LOG_DEBUG("%-8s %s (%d)\n", ifa->ifa_name,
(family == AF_PACKET) ? "AF_PACKET"
: (family == AF_INET) ? "AF_INET" : (family == AF_INET6) ? "AF_INET6" : "???",
family);
/* For an AF_INET* interface address, display the address
* || family == AF_INET6*/
if (family == AF_INET) {
Expand All @@ -96,13 +94,9 @@ FUNCTION_RETURN getAdapterInfos(vector<OsAdapterInfo> &adapterInfos) {
int i;
for (i = 0; i < 6; i++) {
currentAdapter->mac_address[i] = s1->sll_addr[i];
#ifndef NDEBUG
printf("%02x:", s1->sll_addr[i]);
#endif
LOG_DEBUG("%02x:", s1->sll_addr[i]);
}
#ifndef NDEBUG
printf("\t %s\n", ifa->ifa_name);
#endif
LOG_DEBUG("\t %s\n", ifa->ifa_name);
}
}
freeifaddrs(ifaddr);
Expand Down
4 changes: 2 additions & 2 deletions src/library/os/windows/os_win.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ FUNCTION_RETURN getDiskInfos(std::vector<DiskInfo>& diskInfos) {
const DWORD dwSize = MAX_PATH;
char szLogicalDrives[MAX_PATH] = {0};

FUNCTION_RETURN return_value = FUNC_RET_NOT_AVAIL;
FUNCTION_RETURN return_value;
const DWORD dwResult = GetLogicalDriveStrings(dwSize, szLogicalDrives);

if (dwResult > 0) {
Expand Down Expand Up @@ -75,7 +75,7 @@ FUNCTION_RETURN getDiskInfos(std::vector<DiskInfo>& diskInfos) {
return_value = FUNC_RET_OK;
} else {
return_value = FUNC_RET_NOT_AVAIL;
LOG_INFO("No fixed drive were detected");
LOG_DEBUG("No fixed drive were detected");
}

return return_value;
Expand Down

0 comments on commit 6bd24f7

Please sign in to comment.