Kagome
Polkadot Runtime Engine in C++17
set_log_level.hpp
Go to the documentation of this file.
1 
6 #ifndef KAGOME_API_INTERNAL_REQUEST_SETLOGLEVEL
7 #define KAGOME_API_INTERNAL_REQUEST_SETLOGLEVEL
8 
10 
11 #include "log/logger.hpp"
12 
14 
15  struct SetLogLevel final
16  : details::RequestType<void, std::string, std::optional<std::string>> {
17  SetLogLevel(std::shared_ptr<InternalApi> &api) : api_(api){};
18 
19  outcome::result<Return> execute() override {
20  const auto &group =
21  getParam<1>().has_value() ? getParam<0>() : log::defaultGroupName;
22 
23  const auto &level =
24  getParam<1>().has_value() ? getParam<1>().value() : getParam<0>();
25 
26  return api_->setLogLevel(group, level);
27  }
28 
29  private:
30  std::shared_ptr<InternalApi> api_;
31  };
32 
33 } // namespace kagome::api::internal::request
34 
35 #endif // KAGOME_API_INTERNAL_REQUEST_SETLOGLEVEL
std::shared_ptr< InternalApi > api_
static const std::string defaultGroupName("kagome")
outcome::result< Return > execute() override
SetLogLevel(std::shared_ptr< InternalApi > &api)