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
8e10241 does

(cherry picked from commit af18da9)
  • Loading branch information
jostephd committed Oct 15, 2019
1 parent 4025eb5 commit 7e4a8b2
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/wesnoth.cpp
Expand Up @@ -338,6 +338,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 @@ -429,17 +440,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 7e4a8b2

Please sign in to comment.