options: Parse --log-*=* first

Needed if parsing any other command line flags logs any warnings, as the commit after next does
This commit is contained in:
josteph 2019-10-11 03:33:45 +00:00 committed by jostephd
parent f9fc82d9b9
commit af18da97e8

View file

@ -362,6 +362,17 @@ static int process_command_args(const commandline_options& cmdline_opts)
{
// Options that don't change behavior based on any others should be checked alphabetically below.
if(cmdline_opts.log) {
for(const auto& log_pair : cmdline_opts.log.get()) {
const std::string log_domain = log_pair.second;
const int severity = log_pair.first;
if(!lg::set_log_domain_severity(log_domain, severity)) {
std::cerr << "unknown log domain: " << log_domain << '\n';
return 2;
}
}
}
if(cmdline_opts.userconfig_dir) {
filesystem::set_user_config_dir(*cmdline_opts.userconfig_dir);
}
@ -453,17 +464,6 @@ static int process_command_args(const commandline_options& cmdline_opts)
return 0;
}
if(cmdline_opts.log) {
for(const auto& log_pair : cmdline_opts.log.get()) {
const std::string log_domain = log_pair.second;
const int severity = log_pair.first;
if(!lg::set_log_domain_severity(log_domain, severity)) {
std::cerr << "unknown log domain: " << log_domain << '\n';
return 2;
}
}
}
if(cmdline_opts.logdomains) {
std::cout << lg::list_logdomains(*cmdline_opts.logdomains);
return 0;