From 975a60002961b1a5fd68dbefc1030e7960f8b4be Mon Sep 17 00:00:00 2001 From: Yifan Hong Date: Tue, 13 Jul 2021 11:22:48 -0700 Subject: [PATCH] health: stop spamming. Though it is useful to log when the client is dead, it is too spammy when the framework is dead. Stop spamming. Test: pass Bug: 191548101 Change-Id: I43bef16b14300c3e435173ef2af9d8dd9dbfedb8 --- health/utils/libhealth2impl/BinderHealth.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/health/utils/libhealth2impl/BinderHealth.cpp b/health/utils/libhealth2impl/BinderHealth.cpp index 625d0e0c40..8ec8962175 100644 --- a/health/utils/libhealth2impl/BinderHealth.cpp +++ b/health/utils/libhealth2impl/BinderHealth.cpp @@ -35,10 +35,9 @@ namespace health { namespace V2_1 { namespace implementation { -bool IsDeadObjectLogged(const Return& ret) { +bool IsDeadObject(const Return& ret) { if (ret.isOk()) return false; if (ret.isDeadObject()) return true; - LOG(ERROR) << "Cannot call healthInfoChanged* on callback: " << ret.description(); return false; } @@ -77,7 +76,7 @@ Return BinderHealth::registerCallback(const spNotify(health_info); - if (IsDeadObjectLogged(ret)) { + if (IsDeadObject(ret)) { // Remove callback reference. std::lock_guard lock(callbacks_lock_); auto it = std::find_if(callbacks_.begin(), callbacks_.end(), @@ -133,7 +132,7 @@ void BinderHealth::OnHealthInfoChanged(const HealthInfo& health_info) { std::unique_lock lock(callbacks_lock_); for (auto it = callbacks_.begin(); it != callbacks_.end();) { auto ret = (*it)->Notify(health_info); - if (IsDeadObjectLogged(ret)) { + if (IsDeadObject(ret)) { it = callbacks_.erase(it); } else { ++it;