diff options
author | Christopher Wiley <wiley@google.com> | 2016-07-29 17:31:09 -0700 |
---|---|---|
committer | Christopher Wiley <wiley@google.com> | 2016-08-01 16:51:49 -0700 |
commit | 04d8e4e828b70f0178f90e5816f4dfbadbb7d988 (patch) | |
tree | 53157ef57cca1a40b69df0dc14f3b29a1230f686 /libwifi_system | |
parent | d88b136ca46bd117f9098d487ec726807ecad0a3 (diff) | |
download | android_frameworks_opt_net_wifi-04d8e4e828b70f0178f90e5816f4dfbadbb7d988.tar.gz android_frameworks_opt_net_wifi-04d8e4e828b70f0178f90e5816f4dfbadbb7d988.tar.bz2 android_frameworks_opt_net_wifi-04d8e4e828b70f0178f90e5816f4dfbadbb7d988.zip |
Use android-base/logging.h in libwifi-system
This allows log messages to properly inherit the log tag of the logging
process.
Change-Id: Ib40b991842ea741cce33f20db2253723d3fdbef1
Diffstat (limited to 'libwifi_system')
-rw-r--r-- | libwifi_system/hal_tool.cpp | 6 | ||||
-rw-r--r-- | libwifi_system/interface_tool.cpp | 13 |
2 files changed, 11 insertions, 8 deletions
diff --git a/libwifi_system/hal_tool.cpp b/libwifi_system/hal_tool.cpp index 4c7401d49..98afbfc2e 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 init_wifi_stub_hal_func_table(wifi_hal_fn* hal_fn) { 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 ed0b9f756..264ab7066 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 @@ const char kWlan0InterfaceName[] = "wlan0"; 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 @@ bool InterfaceTool::SetUpState(const char* if_name, bool request_up) { 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 @@ bool InterfaceTool::SetUpState(const char* if_name, bool request_up) { } 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; } |