Skip to content

Commit

Permalink
options: Parse --log-*=* first
Browse files Browse the repository at this point in the history
Needed if parsing any other command line flags logs any warnings, as the commit after next does
  • Loading branch information
jostephd committed Oct 15, 2019
1 parent f9fc82d commit af18da9
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/wesnoth.cpp
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit af18da9

Please sign in to comment.