This commit is contained in:
parent
44e75c8793
commit
e750d184a6
1 changed files with 7 additions and 5 deletions
|
@ -30,7 +30,7 @@ auto main(int argc, char** argv) -> int {
|
||||||
// Define options
|
// Define options
|
||||||
po::options_description desc("Allowed options");
|
po::options_description desc("Allowed options");
|
||||||
desc.add_options()("help,h", "Print help message")("log_level,l",
|
desc.add_options()("help,h", "Print help message")("log_level,l",
|
||||||
po::value<int>()->default_value(SPDLOG_LEVEL_INFO),
|
po::value<int>()->default_value(SPDLOG_LEVEL_OFF),
|
||||||
"Set log level: 0=TRACE, 1=DEBUG, 2=INFO, 3=WARN, 4=ERROR, 5=CRITICAL, 6=OFF");
|
"Set log level: 0=TRACE, 1=DEBUG, 2=INFO, 3=WARN, 4=ERROR, 5=CRITICAL, 6=OFF");
|
||||||
|
|
||||||
// Parse command-line arguments
|
// Parse command-line arguments
|
||||||
|
@ -54,8 +54,10 @@ auto main(int argc, char** argv) -> int {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cmd options handling
|
// Cmd options handling
|
||||||
spdlog::set_level(static_cast<spdlog::level::level_enum>(vm["log_level"].as<int>()));
|
auto level = static_cast<spdlog::level::level_enum>(vm["log_level"].as<int>());
|
||||||
std::println("\nEnvironment setup:\n\tCurrently set log level: {}\n", ToString(spdlog::get_level()));
|
spdlog::set_level(level);
|
||||||
|
if(level != spdlog::level::level_enum::off) {
|
||||||
|
std::println("\nEnvironment setup:\n\tCurrently set log level: {}\n", ToString(spdlog::get_level()));
|
||||||
|
}
|
||||||
return RUN_ALL_TESTS();
|
return RUN_ALL_TESTS();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue