mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-06-30 10:42:23 +02:00
log, refactor: use guard clause in LogCategoriesList()
and minor formatting fixups
This commit is contained in:
@ -126,8 +126,7 @@ bool BCLog::Logger::DefaultShrinkDebugFile() const
|
|||||||
return m_categories == BCLog::NONE;
|
return m_categories == BCLog::NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct CLogCategoryDesc
|
struct CLogCategoryDesc {
|
||||||
{
|
|
||||||
BCLog::LogFlags flag;
|
BCLog::LogFlags flag;
|
||||||
std::string category;
|
std::string category;
|
||||||
};
|
};
|
||||||
@ -188,13 +187,11 @@ std::vector<LogCategory> BCLog::Logger::LogCategoriesList() const
|
|||||||
|
|
||||||
std::vector<LogCategory> ret;
|
std::vector<LogCategory> ret;
|
||||||
for (const CLogCategoryDesc& category_desc : categories) {
|
for (const CLogCategoryDesc& category_desc : categories) {
|
||||||
// Omit the special cases.
|
if (category_desc.flag == BCLog::NONE || category_desc.flag == BCLog::ALL) continue;
|
||||||
if (category_desc.flag != BCLog::NONE && category_desc.flag != BCLog::ALL) {
|
LogCategory catActive;
|
||||||
LogCategory catActive;
|
catActive.category = category_desc.category;
|
||||||
catActive.category = category_desc.category;
|
catActive.active = WillLogCategory(category_desc.flag);
|
||||||
catActive.active = WillLogCategory(category_desc.flag);
|
ret.push_back(catActive);
|
||||||
ret.push_back(catActive);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -244,7 +241,7 @@ namespace BCLog {
|
|||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
} // namespace BCLog
|
||||||
|
|
||||||
void BCLog::Logger::LogPrintStr(const std::string& str, const std::string& logging_function, const std::string& source_file, const int source_line)
|
void BCLog::Logger::LogPrintStr(const std::string& str, const std::string& logging_function, const std::string& source_file, const int source_line)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user