| 96 | } |
| 97 | |
| 98 | void SetLoggingCategories(const ArgsManager& args) |
| 99 | { |
| 100 | if (args.IsArgSet("-debug")) { |
| 101 | // Special-case: if -debug=0/-nodebug is set, turn off debugging messages |
| 102 | const std::vector<std::string> categories = args.GetArgs("-debug"); |
| 103 | |
| 104 | if (std::none_of(categories.begin(), categories.end(), |
| 105 | [](std::string cat){return cat == "0" || cat == "none";})) { |
| 106 | for (const auto& cat : categories) { |
| 107 | if (!LogInstance().EnableCategory(cat)) { |
| 108 | InitWarning(strprintf(_("Unsupported logging category %s=%s."), "-debug", cat)); |
| 109 | } |
| 110 | } |
| 111 | } |
| 112 | } |
| 113 | |
| 114 | // Now remove the logging categories which were explicitly excluded |
| 115 | for (const std::string& cat : args.GetArgs("-debugexclude")) { |
| 116 | if (!LogInstance().DisableCategory(cat)) { |
| 117 | InitWarning(strprintf(_("Unsupported logging category %s=%s."), "-debugexclude", cat)); |
| 118 | } |
| 119 | } |
| 120 | } |
| 121 | |
| 122 | bool StartLogging(const ArgsManager& args) |
| 123 | { |
no test coverage detected