1 #include <CLI/CLI.hpp> 2 #include <phosphor-logging/commit.hpp> 3 #include <xyz/openbmc_project/Logging/Entry/common.hpp> 4 5 #include <iostream> 6 #include <string> 7 8 using Interface = sdbusplus::common::xyz::openbmc_project::logging::Entry; 9 10 int main(int argc, char** argv) 11 { 12 CLI::App app{"log-resolve"}; 13 14 size_t id = 0; 15 std::string path{}; 16 auto logIdGroup = app.add_option_group("Log Identifier"); 17 auto idOpt = logIdGroup->add_option("-i,--id", id, "Log Entry index"); 18 auto pathOpt = 19 logIdGroup->add_option("-p,--path", path, "DBus path of the log entry"); 20 logIdGroup->require_option(1); 21 22 CLI11_PARSE(app, argc, argv); 23 24 try 25 { 26 if (*idOpt) 27 { 28 path = std::string(Interface::namespace_path::value) + "/" + 29 std::string(Interface::namespace_path::entry) + "/" + 30 std::to_string(id); 31 lg2::resolve(path); 32 } 33 else if (*pathOpt) 34 { 35 lg2::resolve(path); 36 } 37 } 38 catch (std::exception& e) 39 { 40 std::cerr << "Unable to resolve: " << e.what() << std::endl; 41 return 1; 42 } 43 return 0; 44 } 45