From: Hwankyu Jhun Date: Mon, 13 Jul 2020 00:24:42 +0000 (+0900) Subject: Use defined macros to print logs X-Git-Tag: submit/tizen/20200714.005539~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=dd9d334e6fa0f1139c51a2278f462b42e4e0cdfb;p=platform%2Fcore%2Fappfw%2Frpc-port.git Use defined macros to print logs Change-Id: I449f2d35021890b73a6a5d6554a8968bb5aed57a Signed-off-by: Hwankyu Jhun --- diff --git a/src/ac-internal.cc b/src/ac-internal.cc index 860190a..d6c4037 100644 --- a/src/ac-internal.cc +++ b/src/ac-internal.cc @@ -25,12 +25,7 @@ #include #include "ac-internal.h" - -#ifdef LOG_TAG -#undef LOG_TAG -#endif - -#define LOG_TAG "RPC_PORT" +#include "log-private.hh" namespace rpc_port { namespace internal { @@ -62,16 +57,16 @@ int AccessController::CheckTrusted(const char* sender_appid) { appid_ = appid; } - LOGD("CheckCertificate : %s :: %s", appid_.c_str(), sender_appid); + _D("CheckCertificate : %s :: %s", appid_.c_str(), sender_appid); pkgmgrinfo_cert_compare_result_type_e res; int ret = pkgmgrinfo_pkginfo_compare_usr_app_cert_info(appid_.c_str(), sender_appid, getuid(), &res); if (ret < 0) { - LOGE("CheckCertificate() Failed"); + _E("CheckCertificate() Failed"); return -1; } if (res != PMINFO_CERT_COMPARE_MATCH) { - LOGE("CheckCertificate() Failed : Certificate Not Matched"); + _E("CheckCertificate() Failed : Certificate Not Matched"); return -1; } @@ -111,7 +106,7 @@ AccessController::Cynara::Cynara() cynara* cynara_inst = nullptr; if (cynara_initialize(&cynara_inst, NULL) != CYNARA_API_SUCCESS) { - LOGE("cynara_initialize() is failed"); // LCOV_EXL_LINE + _E("cynara_initialize() is failed"); // LCOV_EXL_LINE } else { cynara_.reset(cynara_inst); } @@ -125,7 +120,7 @@ int AccessController::Cynara::FetchCredsFromDBus(GDBusConnection* connection, int ret = cynara_creds_gdbus_get_user(connection, sender, USER_METHOD_DEFAULT, &user); if (ret != CYNARA_API_SUCCESS) { - LOGE("cynara_creds_gdbus_get_user() is failed : %d", ret); // LCOV_EXCL_LINE + _E("cynara_creds_gdbus_get_user() is failed : %d", ret); // LCOV_EXCL_LINE return -1; // LCOV_EXCL_LINE } user_.reset(user); @@ -134,20 +129,20 @@ int AccessController::Cynara::FetchCredsFromDBus(GDBusConnection* connection, ret = cynara_creds_gdbus_get_client(connection, sender, CLIENT_METHOD_DEFAULT, &client); if (ret != CYNARA_API_SUCCESS) { - LOGE("cynara_creds_gdbus_get_client() is failed : %d", ret); // LCOV_EXCL_LINE + _E("cynara_creds_gdbus_get_client() is failed : %d", ret); // LCOV_EXCL_LINE return -1; // LCOV_EXCL_LINE } client_.reset(client); - LOGD("cred client : %s, cred user : %s", client_.get(), user_.get()); + _D("cred client : %s, cred user : %s", client_.get(), user_.get()); return 0; } int AccessController::Cynara::Check(const std::string& privilege) const { - LOGD("check privilege %s", privilege.c_str()); + _D("check privilege %s", privilege.c_str()); if (cynara_check(cynara_.get(), client_.get(), "", user_.get(), privilege.c_str()) != CYNARA_API_ACCESS_ALLOWED) { - LOGE("cynara_check() is not allowed : %s", privilege.c_str()); + _E("cynara_check() is not allowed : %s", privilege.c_str()); return -1; } diff --git a/src/fdbroker-internal.cc b/src/fdbroker-internal.cc index 5fc79e6..19450e0 100644 --- a/src/fdbroker-internal.cc +++ b/src/fdbroker-internal.cc @@ -28,12 +28,7 @@ #include #include "fdbroker-internal.h" - -#ifdef LOG_TAG -#undef LOG_TAG -#endif - -#define LOG_TAG "RPC_PORT" +#include "log-private.hh" #define EILLEGALACCESS 127 @@ -79,7 +74,7 @@ void FdBroker::DBusConnectionManager::Init() { if (gdbus_conn_ == nullptr) { // LCOV_EXCL_START if (error != nullptr) { - LOGE("Failed to get dbus [%s]", error->message); + _E("Failed to get dbus [%s]", error->message); g_error_free(error); } @@ -167,7 +162,7 @@ int FdBroker::SocketPair::Request(const std::string& target_appid, if (aul_rpc_port_create_socket_pair(target_appid.c_str(), port_name.c_str(), &socks_) != AUL_R_OK) { - LOGE("error create socket pair"); // LCOV_EXCL_LINE + _E("error create socket pair"); // LCOV_EXCL_LINE return -1; // LCOV_EXCL_LINE } @@ -200,7 +195,7 @@ int FdBroker::FdList::Add(int fd) { close(fd); if (err != NULL) { - LOGE("g_unix_fd_list_append [%s]", err->message); // LCOV_EXCL_LINE + _E("g_unix_fd_list_append [%s]", err->message); // LCOV_EXCL_LINE g_error_free(err); // LCOV_EXCL_LINE return -1; // LCOV_EXCL_LINE } @@ -224,7 +219,7 @@ void FdBroker::Cancel() { LOGI("FdBroker::Cancel!"); if (cancellable_) { - LOGW("Cancel the send request"); + _W("Cancel the send request"); g_cancellable_cancel(cancellable_); g_object_unref(cancellable_); cancellable_ = nullptr; @@ -280,7 +275,7 @@ int FdBroker::Send(const std::string& target_appid, if (!mock_ && aul_app_get_appid_bypid(getpid(), sender_appid, sizeof(sender_appid)) < 0) { - LOGE("Can't get appid"); // LCOV_EXCL_LINE + _E("Can't get appid"); // LCOV_EXCL_LINE return -1; // LCOV_EXCL_LINE } @@ -314,7 +309,7 @@ int FdBroker::Send(const std::string& target_appid, RPC_PORT_OBJECT_PATH, interface_name.c_str(), "send_message"); if (!msg) { - LOGE("Can't allocate new method call"); // LCOV_EXCL_LINE + _E("Can't allocate new method call"); // LCOV_EXCL_LINE return -1; // LCOV_EXCL_LINE } @@ -326,7 +321,7 @@ int FdBroker::Send(const std::string& target_appid, cancellable_ = g_cancellable_new(); if (!cancellable_) { - LOGE("Failed to create GCancellable"); // LCOV_EXCL_LINE + _E("Failed to create GCancellable"); // LCOV_EXCL_LINE g_object_unref(msg); // LCOV_EXCL_LINE return -1; // LCOV_EXCL_LINE } @@ -336,7 +331,7 @@ int FdBroker::Send(const std::string& target_appid, res_data_ = CreateWeakPtr(); if (res_data_ == nullptr) { - LOGE("Failed to create weak ptr"); + _E("Failed to create weak ptr"); g_object_unref(msg); return -1; } @@ -363,7 +358,7 @@ int FdBroker::SendSync(const std::string& target_appid, if (!mock_) { ret = aul_app_get_appid_bypid(getpid(), sender_appid, sizeof(sender_appid)); if (ret != AUL_R_OK) { - LOGE("Failed to get application ID. ret(%d)", ret); + _E("Failed to get application ID. ret(%d)", ret); return -1; } } @@ -419,7 +414,7 @@ int FdBroker::SendSync(const std::string& target_appid, GDBusMessage* msg = g_dbus_message_new_method_call(interface_name.c_str(), RPC_PORT_OBJECT_PATH, interface_name.c_str(), "send_message"); if (msg == nullptr) { - LOGE("g_dbus_message_new_method_call() is failed"); + _E("g_dbus_message_new_method_call() is failed"); return -1; } @@ -435,13 +430,13 @@ int FdBroker::SendSync(const std::string& target_appid, break; if (reply == nullptr) { - LOGE("g_dbus_connection_send_message_with_reply_sync() is failed"); + _E("g_dbus_connection_send_message_with_reply_sync() is failed"); if (err) { - LOGE("error(%s)", err->message); + _E("error(%s)", err->message); g_error_free(err); } } else if (g_dbus_message_to_gerror(reply, &err)) { - LOGE("error(%s) was set", err->message); + _E("error(%s) was set", err->message); g_error_free(err); g_object_unref(reply); } @@ -461,29 +456,29 @@ int FdBroker::SendSync(const std::string& target_appid, if (try_sleep_time.tv_nsec > (MAX_SLEEP * BASE_SLEEP)) try_sleep_time.tv_nsec = MAX_SLEEP * BASE_SLEEP; - LOGD("Retry"); + _D("Retry"); } while (max_timeout > 0); if (max_timeout <= 0) { - LOGE("Timed out"); + _E("Timed out"); return -1; } GVariant* reply_body = g_dbus_message_get_body(reply); if (reply_body == nullptr) { - LOGE("g_dbus_message_get_body() is failed"); + _E("g_dbus_message_get_body() is failed"); g_object_unref(reply); return -1; } g_variant_get(reply_body, "(i)", &ret); if (ret != 0) { - LOGE("Access Denied[sender_appid: %s, result: %d]", sender_appid, ret); + _E("Access Denied[sender_appid: %s, result: %d]", sender_appid, ret); g_object_unref(reply); return -EILLEGALACCESS; } - LOGD("[Reply: %d]", ret); + _D("[Reply: %d]", ret); (*fds)[0] = main_sock_pair.Detach(SocketPair::SENDER); (*fds)[1] = delegate_sock_pair.Detach(SocketPair::SENDER); @@ -507,7 +502,7 @@ void FdBroker::ReceiveMessage(const char* sender_appid, returned_fds = g_unix_fd_list_steal_fds(fd_list, &fd_len); if (returned_fds == nullptr || fd_len != 2) { - LOGE("fail to get fds. fd_len(%d)", fd_len); // LCOV_EXCL_LINE + _E("fail to get fds. fd_len(%d)", fd_len); // LCOV_EXCL_LINE return; // LCOV_EXCL_LINE } @@ -523,13 +518,13 @@ void FdBroker::OnReceiveDbusMethod(GDBusConnection *conn, auto* ptr = static_cast*>(user_data); auto broker = ptr->lock(); if (broker == nullptr) { - LOGE("broker is nullptr"); + _E("broker is nullptr"); return; } std::lock_guard lock(broker->GetMutex()); if (broker->registration_id_ == 0) { - LOGE("Invalid context. FdBroker(%p)", broker.get()); + _E("Invalid context. FdBroker(%p)", broker.get()); return; } @@ -572,24 +567,24 @@ int FdBroker::GetOwnerId(const std::string& interface_name) { &error); if (error) { - LOGE("RequestName fail : %s", error->message); // LCOV_EXCL_LINE + _E("RequestName fail : %s", error->message); // LCOV_EXCL_LINE g_error_free(error); // LCOV_EXCL_LINE return -1; // LCOV_EXCL_LINE } if (result == nullptr) { - LOGE("fail to get name NULL"); // LCOV_EXCL_LINE + _E("fail to get name NULL"); // LCOV_EXCL_LINE return -1; // LCOV_EXCL_LINE } g_variant_get(result, "(u)", &owner_id); if (owner_id == 0) { - LOGE("Acquiring the own name is failed"); // LCOV_EXCL_LINE + _E("Acquiring the own name is failed"); // LCOV_EXCL_LINE g_variant_unref(result); // LCOV_EXCL_LINE return -1; // LCOV_EXCL_LINE } - LOGD("Acquiring the own name : %d", owner_id); + _D("Acquiring the own name : %d", owner_id); g_variant_unref(result); return owner_id; @@ -606,7 +601,7 @@ int FdBroker::GetSenderPid(GDBusConnection *connection, const gchar *sender) { "/org/freedesktop/DBus", "org.freedesktop.DBus", "GetConnectionUnixProcessID"); if (!msg) { - LOGE("Can't allocate new method call"); // LCOV_EXCL_LINE + _E("Can't allocate new method call"); // LCOV_EXCL_LINE goto out; // LCOV_EXCL_LINE } @@ -617,7 +612,7 @@ int FdBroker::GetSenderPid(GDBusConnection *connection, const gchar *sender) { if (!reply) { // LCOV_EXCL_START if (err != NULL) { - LOGE("Failed to get pid [%s]", err->message); + _E("Failed to get pid [%s]", err->message); g_error_free(err); } goto out; @@ -665,13 +660,13 @@ int FdBroker::RegisterDbusInterface(const std::string& port_name) { GDBusNodeInfo* introspection_data = g_dbus_node_info_new_for_xml( introspection_xml.c_str(), nullptr); if (!introspection_data) { - LOGE("g_dbus_node_info_new_for_xml() is failed."); + _E("g_dbus_node_info_new_for_xml() is failed."); return -1; } auto broker = CreateWeakPtr(); if (broker == nullptr) { - LOGE("Failed to create weak ptr"); + _E("Failed to create weak ptr"); return -1; } @@ -683,12 +678,12 @@ int FdBroker::RegisterDbusInterface(const std::string& port_name) { g_dbus_node_info_unref(introspection_data); if (registration_id_ == 0) { - LOGE("Failed to g_dbus_connection_register_object"); + _E("Failed to g_dbus_connection_register_object"); return -1; } if (GetOwnerId(interface_name) < 0) { - LOGE("Failed to get owner id"); + _E("Failed to get owner id"); return -1; } @@ -699,12 +694,12 @@ int FdBroker::RegisterDbusInterface(const std::string& port_name) { int FdBroker::Listen(IEventListener* ev, const std::string& port_name) { if (listener_ != nullptr) { - LOGE("listener_ is not NULL"); // LCOV_EXCL_LINE + _E("listener_ is not NULL"); // LCOV_EXCL_LINE return RPC_PORT_ERROR_INVALID_PARAMETER; // LCOV_EXCL_LINE } if (ev == nullptr) { - LOGE("ev is NULL"); // LCOV_EXCL_LINE + _E("ev is NULL"); // LCOV_EXCL_LINE return RPC_PORT_ERROR_INVALID_PARAMETER; // LCOV_EXCL_LINE } @@ -722,7 +717,7 @@ int FdBroker::Listen(IEventListener* ev, const std::string& port_name) { int ret = RegisterDbusInterface(port_name); if (ret != 0) { - LOGE("Failed to register dbus interface"); // LCOV_EXCL_LINE + _E("Failed to register dbus interface"); // LCOV_EXCL_LINE return RPC_PORT_ERROR_IO_ERROR; // LCOV_EXCL_LINE } @@ -741,13 +736,13 @@ void FdBroker::OnNameAppeared(GDBusConnection *connection, auto* ptr = static_cast*>(user_data); auto broker = ptr->lock(); if (broker == nullptr) { - LOGE("broker is nullptr"); + _E("broker is nullptr"); return; } std::lock_guard lock(broker->GetMutex()); if (broker->watcher_id_ == 0) { - LOGE("Invalid context. FdBroker(%p)", broker.get()); + _E("Invalid context. FdBroker(%p)", broker.get()); return; } @@ -757,7 +752,7 @@ void FdBroker::OnNameAppeared(GDBusConnection *connection, if (aul_app_get_appid_bypid(pid, owner_appid, sizeof(owner_appid)) < 0) { // LCOV_EXCL_START - LOGE("aul_app_get_appid_bypid failed %d", pid); + _E("aul_app_get_appid_bypid failed %d", pid); broker->watcher_->OnPortRejected(RPC_PORT_ERROR_IO_ERROR); return; // LCOV_EXCL_STOP @@ -765,7 +760,7 @@ void FdBroker::OnNameAppeared(GDBusConnection *connection, if (broker->watch_appid_ != owner_appid) { // LCOV_EXCL_START - LOGE("invalid appid %s", owner_appid); + _E("invalid appid %s", owner_appid); broker->watcher_->OnPortRejected(RPC_PORT_ERROR_IO_ERROR); return; // LCOV_EXCL_STOP @@ -780,13 +775,13 @@ void FdBroker::OnNameVanished(GDBusConnection *connection, auto* ptr = static_cast*>(user_data); auto broker = ptr->lock(); if (broker == nullptr) { - LOGE("broker is nullptr"); + _E("broker is nullptr"); return; } std::lock_guard lock(broker->GetMutex()); if (broker->watcher_id_ == 0) { - LOGE("Invalid context. FdBroker(%p)", broker.get()); + _E("Invalid context. FdBroker(%p)", broker.get()); return; } @@ -824,14 +819,14 @@ int FdBroker::Watch(IEventWatcher* ev, const std::string& target_appid, if (watcher_id_ > 0) { // LCOV_EXCL_START g_bus_unwatch_name(watcher_id_); - LOGD("Retry to watch name. stub %s:%s", + _D("Retry to watch name. stub %s:%s", target_appid.c_str(), port_name.c_str()); // LCOV_EXCL_STOP } auto broker = CreateWeakPtr(); if (broker == nullptr) { - LOGE("Failed to create weak ptr"); + _E("Failed to create weak ptr"); return -1; } @@ -845,7 +840,7 @@ int FdBroker::Watch(IEventWatcher* ev, const std::string& target_appid, DestroyWeakPtr); if (watcher_id_ == 0) { // LCOV_EXCL_START - LOGE("Failed to watch connection(%s)", interface_name.c_str()); + _E("Failed to watch connection(%s)", interface_name.c_str()); watcher_ = nullptr; return -1; // LCOV_EXCL_STOP @@ -862,7 +857,7 @@ int FdBroker::Prepare(const std::string& target_appid, port_name.c_str()); if (ret != AUL_R_OK) { // LCOV_EXCL_START - LOGE("Failed to prepare stub %s:%s [ret : %d]", + _E("Failed to prepare stub %s:%s [ret : %d]", target_appid.c_str(), port_name.c_str(), ret); if (ret == AUL_R_EILLACC) return -EILLEGALACCESS; @@ -878,7 +873,7 @@ int FdBroker::Prepare(const std::string& target_appid, void FdBroker::OnResultReceived(GObject* source_object, GAsyncResult* res, gpointer user_data) { - LOGW("OnResultReceived()"); + _W("OnResultReceived()"); GDBusConnection* conn = reinterpret_cast(source_object); GError* err = nullptr; GDBusMessage* reply = g_dbus_connection_send_message_with_reply_finish(conn, @@ -886,20 +881,20 @@ void FdBroker::OnResultReceived(GObject* source_object, if (err && err->code == G_IO_ERROR_CANCELLED) { g_error_free(err); - LOGE("IO error cancelled"); + _E("IO error cancelled"); return; } auto* ptr = static_cast*>(user_data); auto broker = ptr->lock(); if (broker == nullptr) { - LOGE("broker is nullptr"); + _E("broker is nullptr"); return; } std::lock_guard lock(broker->GetMutex()); if (broker->cancellable_ == nullptr) { - LOGE("Invalid context. Fdbroker(%p)", broker.get()); + _E("Invalid context. Fdbroker(%p)", broker.get()); return; } @@ -910,7 +905,7 @@ void FdBroker::OnResultReceived(GObject* source_object, watcher->OnPortDisconnected(true); g_error_free(err); if (broker->cancellable_) { - LOGW("Cancel the send request"); + _W("Cancel the send request"); g_cancellable_cancel(broker->cancellable_); g_object_unref(broker->cancellable_); broker->cancellable_ = nullptr; @@ -920,14 +915,14 @@ void FdBroker::OnResultReceived(GObject* source_object, } if (reply == nullptr) { - LOGW("Null reply"); // LCOV_EXCL_LINE + _W("Null reply"); // LCOV_EXCL_LINE return; // LCOV_EXCL_LINE } GVariant* reply_body = g_dbus_message_get_body(reply); if (reply_body == nullptr) { // LCOV_EXCL_START - LOGE("g_dbus_message_get_body() is failed"); + _E("g_dbus_message_get_body() is failed"); watcher->OnPortDisconnected(); g_object_unref(reply); return; @@ -938,26 +933,26 @@ void FdBroker::OnResultReceived(GObject* source_object, g_variant_get(reply_body, "(i)", &ret); g_object_unref(reply); if (ret != 0) { - LOGE("Access Denied[sender_appid : %s]", broker->watch_appid_.c_str()); + _E("Access Denied[sender_appid : %s]", broker->watch_appid_.c_str()); watcher->OnPortRejected(RPC_PORT_ERROR_PERMISSION_DENIED); return; } watcher->OnPortConnected(); - LOGD("[Reply : %d]", ret); + _D("[Reply : %d]", ret); } gboolean FdBroker::OnDbusNameTimeout(gpointer user_data) { auto* ptr = static_cast*>(user_data); auto broker = ptr->lock(); if (broker == nullptr) { - LOGE("broker is nullptr"); + _E("broker is nullptr"); return G_SOURCE_REMOVE; } std::lock_guard lock(broker->GetMutex()); if (broker->conn_data_ == nullptr) { - LOGE("Invalid context. FdBroker(%p)", broker.get()); + _E("Invalid context. FdBroker(%p)", broker.get()); return G_SOURCE_REMOVE; } @@ -986,13 +981,13 @@ void FdBroker::DestroyWeakPtr(gpointer data) { void FdBroker::SetConnTimer() { if (conn_data_) { - LOGW("Already exists"); + _W("Already exists"); return; } conn_data_ = CreateWeakPtr(); if (conn_data_ == nullptr) - LOGE("Out of memory"); + _E("Out of memory"); g_timeout_add(10 * 1000, OnDbusNameTimeout, conn_data_); } diff --git a/src/port-internal.cc b/src/port-internal.cc index 53c6666..8cba7dc 100644 --- a/src/port-internal.cc +++ b/src/port-internal.cc @@ -28,14 +28,9 @@ #include #include -#include "rpc-port.h" +#include "log-private.hh" #include "port-internal.h" - -#ifdef LOG_TAG -#undef LOG_TAG -#endif - -#define LOG_TAG "RPC_PORT" +#include "rpc-port.h" #define MAX_CNT 100 #define MAX_SLEEP 100 @@ -118,14 +113,14 @@ int Port::Read(void* buf, unsigned int size) { std::lock_guard lock(mutex_); if (fd_ < 0 || fd_ >= sysconf(_SC_OPEN_MAX)) { - LOGE("Invalid fd(%d)", fd_); + _E("Invalid fd(%d)", fd_); return RPC_PORT_ERROR_IO_ERROR; } while (left) { nb = read(fd_, buffer, left); if (nb == 0) { - LOGE("read_socket: ...read EOF, socket closed %d: nb %zd\n", fd_, nb); + _E("read_socket: ...read EOF, socket closed %d: nb %zd\n", fd_, nb); return RPC_PORT_ERROR_IO_ERROR; } else if (nb == -1) { if (errno == EINTR || errno == EAGAIN || errno == EWOULDBLOCK) { @@ -133,7 +128,7 @@ int Port::Read(void* buf, unsigned int size) { nanosleep(&TRY_SLEEP_TIME, 0); max_timeout -= (TRY_SLEEP_TIME.tv_nsec / (BASE_SLEEP)); if (max_timeout <= 0) { - LOGE("read_socket: ...timed out fd %d: errno %d", fd_, errno); + _E("read_socket: ...timed out fd %d: errno %d", fd_, errno); return RPC_PORT_ERROR_IO_ERROR; } TRY_SLEEP_TIME.tv_nsec *= 2; @@ -142,7 +137,7 @@ int Port::Read(void* buf, unsigned int size) { continue; } - LOGE("read_socket: ...error fd %d: errno %d\n", fd_, errno); + _E("read_socket: ...error fd %d: errno %d\n", fd_, errno); return RPC_PORT_ERROR_IO_ERROR; } @@ -169,7 +164,7 @@ int Port::Write(const void* buf, unsigned int size) { } if (delayed_message_size_ > QUEUE_SIZE_MAX) { - LOGE("cache fail : delayed_message_size (%d), count(%zu)", + _E("cache fail : delayed_message_size (%d), count(%zu)", delayed_message_size_, queue_.size()); return RPC_PORT_ERROR_IO_ERROR; } @@ -187,7 +182,7 @@ int Port::Write(const void* buf, unsigned int size, int* sent_bytes) { const char* buffer = static_cast(buf); if (fd_ < 0 || fd_ >= sysconf(_SC_OPEN_MAX)) { - LOGE("Invalid fd(%d)", fd_); + _E("Invalid fd(%d)", fd_); return PORT_STATUS_ERROR_IO_ERROR; } @@ -203,7 +198,7 @@ int Port::Write(const void* buf, unsigned int size, int* sent_bytes) { if (errno == EAGAIN || errno == EWOULDBLOCK) return PORT_STATUS_ERROR_RESOURCE_UNAVAILABLE; - LOGE("write_socket: ...error fd %d: errno %d\n", fd_, errno); + _E("write_socket: ...error fd %d: errno %d\n", fd_, errno); return PORT_STATUS_ERROR_IO_ERROR; } @@ -213,7 +208,7 @@ int Port::Write(const void* buf, unsigned int size, int* sent_bytes) { } if (left != 0) { - LOGE("error fd %d: retry_cnt %d", fd_, retry_cnt); + _E("error fd %d: retry_cnt %d", fd_, retry_cnt); return PORT_STATUS_ERROR_IO_ERROR; } @@ -268,7 +263,7 @@ int Port::PopDelayedMessage() { queue_.pop(); } - LOGW("cache : count(%zu), delayed_message_size (%d), ret(%d)", + _W("cache : count(%zu), delayed_message_size (%d), ret(%d)", queue_.size(), delayed_message_size_, ret); return ret; } @@ -277,7 +272,7 @@ int Port::PushDelayedMessage(std::shared_ptr dm) { if (queue_.empty()) { delay_src_id_ = g_unix_fd_add(fd_, G_IO_OUT, OnEventReceived, this); if (delay_src_id_ == 0) { - LOGE("Failed to add watch on socket"); + _E("Failed to add watch on socket"); return RPC_PORT_ERROR_IO_ERROR; } } @@ -285,7 +280,7 @@ int Port::PushDelayedMessage(std::shared_ptr dm) { delayed_message_size_ += dm->GetOriginalSize(); queue_.push(dm); - LOGW("cache : count(%zu), delayed_message_size (%d)", + _W("cache : count(%zu), delayed_message_size (%d)", queue_.size(), delayed_message_size_); return RPC_PORT_ERROR_NONE; }