log: Use Join() helper when listing log categories

This commit is contained in:
MarcoFalke
2020-04-16 11:12:14 -04:00
parent 79b0459648
commit faec063887
4 changed files with 17 additions and 31 deletions

View File

@@ -182,30 +182,15 @@ bool GetLogCategory(BCLog::LogFlags& flag, const std::string& str)
return false;
}
std::string ListLogCategories()
std::vector<LogCategory> BCLog::Logger::LogCategoriesList()
{
std::string ret;
int outcount = 0;
std::vector<LogCategory> ret;
for (const CLogCategoryDesc& category_desc : LogCategories) {
// Omit the special cases.
if (category_desc.flag != BCLog::NONE && category_desc.flag != BCLog::ALL) {
if (outcount != 0) ret += ", ";
ret += category_desc.category;
outcount++;
}
}
return ret;
}
std::vector<CLogCategoryActive> ListActiveLogCategories()
{
std::vector<CLogCategoryActive> ret;
for (const CLogCategoryDesc& category_desc : LogCategories) {
// Omit the special cases.
if (category_desc.flag != BCLog::NONE && category_desc.flag != BCLog::ALL) {
CLogCategoryActive catActive;
LogCategory catActive;
catActive.category = category_desc.category;
catActive.active = LogAcceptCategory(category_desc.flag);
catActive.active = WillLogCategory(category_desc.flag);
ret.push_back(catActive);
}
}