MCPcopy Create free account
hub / github.com/AimRT/AimRT / GetModuleLogLevel

Method GetModuleLogLevel

src/plugins/log_control_plugin/service.cc:10–40  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8namespace aimrt::plugins::log_control_plugin {
9
10aimrt::co::Task<aimrt::rpc::Status> LogControlServiceImpl::GetModuleLogLevel(
11 aimrt::rpc::ContextRef ctx_ref,
12 const ::aimrt::protocols::log_control_plugin::GetModuleLogLevelReq& req,
13 ::aimrt::protocols::log_control_plugin::GetModuleLogLevelRsp& rsp) {
14 const auto& log_lvl_map = logger_manager_ptr_->GetAllLoggerLevels();
15
16 // if empty, then get all module
17 if (req.module_names().empty()) {
18 for (const auto& itr : log_lvl_map) {
19 rsp.mutable_module_log_level_map()->emplace(
20 itr.first,
21 std::string(aimrt::runtime::core::logger::LogLevelTool::GetLogLevelName(itr.second)));
22 }
23
24 co_return aimrt::rpc::Status();
25 }
26
27 for (const auto& module_name : req.module_names()) {
28 auto finditr = log_lvl_map.find(module_name);
29 if (finditr == log_lvl_map.end()) {
30 SetErrorCode(ErrorCode::kInvalidModuleName, rsp);
31 co_return aimrt::rpc::Status();
32 }
33
34 rsp.mutable_module_log_level_map()->emplace(
35 finditr->first,
36 std::string(aimrt::runtime::core::logger::LogLevelTool::GetLogLevelName(finditr->second)));
37 }
38
39 co_return aimrt::rpc::Status();
40}
41
42aimrt::co::Task<aimrt::rpc::Status> LogControlServiceImpl::SetModuleLogLevel(
43 aimrt::rpc::ContextRef ctx_ref,

Callers

nothing calls this directly

Calls 2

StatusClass · 0.85
GetAllLoggerLevelsMethod · 0.80

Tested by

no test coverage detected