Merge "Use android-base/logging.h in libwifi-system"
diff --git a/libwifi_system/hal_tool.cpp b/libwifi_system/hal_tool.cpp
index 4c7401d..98afbfc 100644
--- a/libwifi_system/hal_tool.cpp
+++ b/libwifi_system/hal_tool.cpp
@@ -16,7 +16,7 @@
#include "wifi_system/hal_tool.h"
-#include <log/log.h>
+#include <android-base/logging.h>
namespace android {
namespace wifi_system {
@@ -564,12 +564,12 @@
bool HalTool::InitFunctionTable(wifi_hal_fn* hal_fn) {
if (!init_wifi_stub_hal_func_table(hal_fn)) {
- ALOGE("Can not initialize the basic function pointer table");
+ LOG(ERROR) << "Can not initialize the basic function pointer table";
return false;
}
if (init_wifi_vendor_hal_func_table(hal_fn) != WIFI_SUCCESS) {
- ALOGE("Can not initialize the vendor function pointer table");
+ LOG(ERROR) << "Can not initialize the vendor function pointer table";
return false;
}
diff --git a/libwifi_system/interface_tool.cpp b/libwifi_system/interface_tool.cpp
index ed0b9f7..264ab70 100644
--- a/libwifi_system/interface_tool.cpp
+++ b/libwifi_system/interface_tool.cpp
@@ -22,8 +22,8 @@
struct sockaddr and must be included after sys/socket.h. */
#include <linux/if.h>
+#include <android-base/logging.h>
#include <android-base/unique_fd.h>
-#include <log/log.h>
namespace android {
namespace wifi_system {
@@ -36,7 +36,8 @@
bool InterfaceTool::SetUpState(const char* if_name, bool request_up) {
base::unique_fd sock(socket(PF_INET, SOCK_DGRAM, 0));
if (sock.get() < 0) {
- ALOGE("Bad socket: %d, errno: %d\n", sock.get(), errno);
+ LOG(ERROR) << "Failed to open socket to set up/down state ("
+ << strerror(errno) << ")";
return false;
}
@@ -44,12 +45,13 @@
memset(&ifr, 0, sizeof(ifr));
if (strlcpy(ifr.ifr_name, if_name, sizeof(ifr.ifr_name)) >=
sizeof(ifr.ifr_name)) {
- ALOGE("Interface name is too long: %s\n", if_name);
+ LOG(ERROR) << "Interface name is too long: " << if_name;
return false;
}
if (TEMP_FAILURE_RETRY(ioctl(sock.get(), SIOCGIFFLAGS, &ifr)) != 0) {
- ALOGE("Could not read interface %s errno: %d\n", if_name, errno);
+ LOG(ERROR) << "Could not read interface state for " << if_name
+ << " (" << strerror(errno) << ")";
return false;
}
@@ -65,7 +67,8 @@
}
if (TEMP_FAILURE_RETRY(ioctl(sock.get(), SIOCSIFFLAGS, &ifr)) != 0) {
- ALOGE("Could not set interface %s flags: %d\n", if_name, errno);
+ LOG(ERROR) << "Could not set interface flags for " << if_name
+ << " (" << strerror(errno) << ")";
return false;
}