feat(服务监控): 添加服务状态自动打印功能
当获取服务列表时,系统现在会自动打印每个服务的状态信息到日志中,包括服务名称、当前状态(ACTIVE/INACTIVE)和保护状态(YES/NO)
This commit is contained in:
@@ -132,7 +132,14 @@ bool CustomRobot::GetServiceList(std::vector<unitree::robot::go2::ServiceState>&
|
||||
LOG_ERROR("Failed to get service list, error code: " + std::to_string(ret));
|
||||
return false;
|
||||
}
|
||||
// LOG_INFO("Successfully retrieved service list with " + std::to_string(serviceList.size()) + " services");
|
||||
|
||||
LOG_INFO("Successfully retrieved service list with " + std::to_string(serviceList.size()) + " services");
|
||||
for (const auto& service : serviceList) {
|
||||
std::string statusStr = (service.status == 1) ? "ACTIVE" : "INACTIVE";
|
||||
LOG_INFO("Service: " + service.name + " | Status: " + statusStr + " | Protect: " +
|
||||
(service.protect ? "YES" : "NO"));
|
||||
}
|
||||
|
||||
return true;
|
||||
} catch (const std::exception& e) {
|
||||
LOG_ERROR("Exception in getServiceList: " + std::string(e.what()));
|
||||
|
||||
Reference in New Issue
Block a user