Migrate off of streaming logging
Bug: 302723053
Test: mma
Change-Id: Idbd42915fb515021b3de5062fa1d1b55d5899583
diff --git a/libs/binder/libbinder_rpc_unstable.cpp b/libs/binder/libbinder_rpc_unstable.cpp
index f51cd9b..118409e 100644
--- a/libs/binder/libbinder_rpc_unstable.cpp
+++ b/libs/binder/libbinder_rpc_unstable.cpp
@@ -16,7 +16,6 @@
#include <binder_rpc_unstable.hpp>
-#include <android-base/logging.h>
#include <android-base/unique_fd.h>
#include <android/binder_libbinder.h>
#include <binder/RpcServer.h>
@@ -85,8 +84,8 @@
}
if (status_t status = server->setupVsockServer(bindCid, port); status != OK) {
- LOG(ERROR) << "Failed to set up vsock server with port " << port
- << " error: " << statusToString(status).c_str();
+ ALOGE("Failed to set up vsock server with port %u error: %s", port,
+ statusToString(status).c_str());
return nullptr;
}
if (cid != VMADDR_CID_ANY) {
@@ -95,7 +94,7 @@
const sockaddr_vm* vaddr = reinterpret_cast<const sockaddr_vm*>(addr);
LOG_ALWAYS_FATAL_IF(vaddr->svm_family != AF_VSOCK, "address is not a vsock");
if (cid != vaddr->svm_cid) {
- LOG(ERROR) << "Rejected vsock connection from CID " << vaddr->svm_cid;
+ ALOGE("Rejected vsock connection from CID %u", vaddr->svm_cid);
return false;
}
return true;
@@ -109,12 +108,12 @@
auto server = RpcServer::make();
auto fd = unique_fd(socketFd);
if (!fd.ok()) {
- LOG(ERROR) << "Invalid socket fd " << socketFd;
+ ALOGE("Invalid socket fd %d", socketFd);
return nullptr;
}
if (status_t status = server->setupRawSocketServer(std::move(fd)); status != OK) {
- LOG(ERROR) << "Failed to set up RPC server with fd " << socketFd
- << " error: " << statusToString(status).c_str();
+ ALOGE("Failed to set up RPC server with fd %d error: %s", socketFd,
+ statusToString(status).c_str());
return nullptr;
}
server->setRootObject(AIBinder_toPlatformBinder(service));
@@ -125,13 +124,13 @@
auto server = RpcServer::make();
auto fd = unique_fd(bootstrapFd);
if (!fd.ok()) {
- LOG(ERROR) << "Invalid bootstrap fd " << bootstrapFd;
+ ALOGE("Invalid bootstrap fd %d", bootstrapFd);
return nullptr;
}
if (status_t status = server->setupUnixDomainSocketBootstrapServer(std::move(fd));
status != OK) {
- LOG(ERROR) << "Failed to set up Unix Domain RPC server with bootstrap fd " << bootstrapFd
- << " error: " << statusToString(status).c_str();
+ ALOGE("Failed to set up Unix Domain RPC server with bootstrap fd %d error: %s", bootstrapFd,
+ statusToString(status).c_str());
return nullptr;
}
server->setRootObject(AIBinder_toPlatformBinder(service));
@@ -141,8 +140,8 @@
ARpcServer* ARpcServer_newInet(AIBinder* service, const char* address, unsigned int port) {
auto server = RpcServer::make();
if (status_t status = server->setupInetServer(address, port, nullptr); status != OK) {
- LOG(ERROR) << "Failed to set up inet RPC server with address " << address << " and port "
- << port << " error: " << statusToString(status).c_str();
+ ALOGE("Failed to set up inet RPC server with address %s and port %u error: %s", address,
+ port, statusToString(status).c_str());
return nullptr;
}
server->setRootObject(AIBinder_toPlatformBinder(service));
@@ -191,8 +190,8 @@
AIBinder* ARpcSession_setupVsockClient(ARpcSession* handle, unsigned int cid, unsigned int port) {
auto session = handleToStrongPointer<RpcSession>(handle);
if (status_t status = session->setupVsockClient(cid, port); status != OK) {
- LOG(ERROR) << "Failed to set up vsock client with CID " << cid << " and port " << port
- << " error: " << statusToString(status).c_str();
+ ALOGE("Failed to set up vsock client with CID %u and port %u error: %s", cid, port,
+ statusToString(status).c_str());
return nullptr;
}
return AIBinder_fromPlatformBinder(session->getRootObject());
@@ -203,8 +202,8 @@
pathname = ANDROID_SOCKET_DIR "/" + pathname;
auto session = handleToStrongPointer<RpcSession>(handle);
if (status_t status = session->setupUnixDomainClient(pathname.c_str()); status != OK) {
- LOG(ERROR) << "Failed to set up Unix Domain RPC client with path: " << pathname
- << " error: " << statusToString(status).c_str();
+ ALOGE("Failed to set up Unix Domain RPC client with path: %s error: %s", pathname.c_str(),
+ statusToString(status).c_str());
return nullptr;
}
return AIBinder_fromPlatformBinder(session->getRootObject());
@@ -214,13 +213,13 @@
auto session = handleToStrongPointer<RpcSession>(handle);
auto fd = unique_fd(dup(bootstrapFd));
if (!fd.ok()) {
- LOG(ERROR) << "Invalid bootstrap fd " << bootstrapFd;
+ ALOGE("Invalid bootstrap fd %d", bootstrapFd);
return nullptr;
}
if (status_t status = session->setupUnixDomainSocketBootstrapClient(std::move(fd));
status != OK) {
- LOG(ERROR) << "Failed to set up Unix Domain RPC client with bootstrap fd: " << bootstrapFd
- << " error: " << statusToString(status).c_str();
+ ALOGE("Failed to set up Unix Domain RPC client with bootstrap fd: %d error: %s",
+ bootstrapFd, statusToString(status).c_str());
return nullptr;
}
return AIBinder_fromPlatformBinder(session->getRootObject());
@@ -229,8 +228,8 @@
AIBinder* ARpcSession_setupInet(ARpcSession* handle, const char* address, unsigned int port) {
auto session = handleToStrongPointer<RpcSession>(handle);
if (status_t status = session->setupInetClient(address, port); status != OK) {
- LOG(ERROR) << "Failed to set up inet RPC client with address " << address << " and port "
- << port << " error: " << statusToString(status).c_str();
+ ALOGE("Failed to set up inet RPC client with address %s and port %u error: %s", address,
+ port, statusToString(status).c_str());
return nullptr;
}
return AIBinder_fromPlatformBinder(session->getRootObject());
@@ -241,7 +240,7 @@
auto session = handleToStrongPointer<RpcSession>(handle);
auto request = [=] { return unique_fd{requestFd(param)}; };
if (status_t status = session->setupPreconnectedClient(unique_fd{}, request); status != OK) {
- LOG(ERROR) << "Failed to set up vsock client. error: " << statusToString(status).c_str();
+ ALOGE("Failed to set up vsock client. error: %s", statusToString(status).c_str());
return nullptr;
}
return AIBinder_fromPlatformBinder(session->getRootObject());