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

@@ -8,6 +8,7 @@
#include <fs.h>
#include <tinyformat.h>
#include <util/string.h>
#include <atomic>
#include <cstdint>
@@ -24,8 +25,7 @@ extern const char * const DEFAULT_DEBUGLOGFILE;
extern bool fLogIPs;
struct CLogCategoryActive
{
struct LogCategory {
std::string category;
bool active;
};
@@ -132,6 +132,13 @@ namespace BCLog {
bool DisableCategory(const std::string& str);
bool WillLogCategory(LogFlags category) const;
/** Returns a vector of the log categories */
std::vector<LogCategory> LogCategoriesList();
/** Returns a string with the log categories */
std::string LogCategoriesString()
{
return Join(LogCategoriesList(), ", ", [&](const LogCategory& i) { return i.category; });
};
bool DefaultShrinkDebugFile() const;
};
@@ -146,12 +153,6 @@ static inline bool LogAcceptCategory(BCLog::LogFlags category)
return LogInstance().WillLogCategory(category);
}
/** Returns a string with the log categories. */
std::string ListLogCategories();
/** Returns a vector of the active log categories. */
std::vector<CLogCategoryActive> ListActiveLogCategories();
/** Return true if str parses as a log category and set the flag */
bool GetLogCategory(BCLog::LogFlags& flag, const std::string& str);