debugging: debug options can be turned off internally again

This commit is contained in:
Moritz Bunkus 2013-12-08 14:52:58 +01:00
parent 605bae5bf5
commit 10a746d8b1
2 changed files with 5 additions and 2 deletions

View File

@ -42,7 +42,8 @@ debugging_requested(const std::string &option,
}
void
request_debugging(const std::string &options) {
request_debugging(const std::string &options,
bool enable) {
std::vector<std::string> all_options = split(options);
for (auto &one_option : all_options) {
@ -51,6 +52,8 @@ request_debugging(const std::string &options) {
continue;
if (parts[0] == "!")
s_debugging_options.clear();
else if (!enable)
s_debugging_options.erase(parts[0]);
else
s_debugging_options[parts[0]] = 1 == parts.size() ? std::string("") : parts[1];
}

View File

@ -18,7 +18,7 @@
bool debugging_requested(const char *option, std::string *arg = nullptr);
bool debugging_requested(const std::string &option, std::string *arg = nullptr);
void request_debugging(const std::string &options);
void request_debugging(const std::string &options, bool enable = true);
void init_debugging();
int parse_debug_interval_arg(const std::string &option, int default_value = 1000, int invalid_value = -1);