Better implementation of --logdomains option.
This commit is contained in:
parent
8b5c43e18f
commit
1a46648018
4 changed files with 17 additions and 6 deletions
|
@ -81,9 +81,7 @@ int main(int argc, char** argv)
|
|||
<< "\n";
|
||||
return 0;
|
||||
} else if(val == "--logdomains") {
|
||||
// domain list is hardcoded here because I don't grok
|
||||
// C++ well enough to add a log class hook to get it.
|
||||
std::cerr << "general, ai, config, display, engine, network, filesystem, audio, paths\n";
|
||||
std::cout << lg::list_logdomains() << "\n";
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1763,9 +1763,7 @@ static int play_game(int argc, char** argv)
|
|||
|
||||
return 0;
|
||||
} else if(val == "--logdomains") {
|
||||
// domain list is hardcoded here because I don't grok
|
||||
// C++ well enough to add a log class hook to get it.
|
||||
std::cerr << "general, ai, config, display, engine, network, filesystem, audio, paths\n";
|
||||
std::cout << lg::list_logdomains() << "\n";
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
14
src/log.cpp
14
src/log.cpp
|
@ -78,6 +78,20 @@ bool set_log_domain_severity(std::string const &name, int severity)
|
|||
return true;
|
||||
}
|
||||
|
||||
std::string list_logdomains()
|
||||
{
|
||||
std::vector< logd >::iterator
|
||||
it_begin = log_domains.begin(),
|
||||
it_end = log_domains.end(),
|
||||
it;
|
||||
std::string domainlist = "";
|
||||
for(it = it_begin; it != it_end; ++it) {
|
||||
if (it != it_begin)
|
||||
domainlist += ", ";
|
||||
domainlist += it->name_;
|
||||
}
|
||||
return domainlist;
|
||||
}
|
||||
|
||||
bool logger::dont_log(log_domain const &domain) const
|
||||
{
|
||||
|
|
|
@ -29,6 +29,7 @@ public:
|
|||
};
|
||||
|
||||
bool set_log_domain_severity(std::string const &name, int severity);
|
||||
std::string list_logdomains();
|
||||
|
||||
class logger {
|
||||
char const *name_;
|
||||
|
|
Loading…
Add table
Reference in a new issue