aboutsummaryrefslogtreecommitdiff
path: root/src/logging.cpp
diff options
context:
space:
mode:
authorJon Atack <jon@atack.com>2021-07-22 12:01:21 +0200
committerJon Atack <jon@atack.com>2021-07-22 23:09:52 +0200
commit17bbff3b88132c0c95b29b59100456b85e26df75 (patch)
treef3a24bcf1a8c3199d69831ced731fe83c287695c /src/logging.cpp
parent7c57297319bc386afaf06528778384fe58576ef9 (diff)
downloadbitcoin-17bbff3b88132c0c95b29b59100456b85e26df75.tar.xz
log, refactor: use guard clause in LogCategoriesList()
and minor formatting fixups
Diffstat (limited to 'src/logging.cpp')
-rw-r--r--src/logging.cpp17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/logging.cpp b/src/logging.cpp
index fcb46debf7..b456108b61 100644
--- a/src/logging.cpp
+++ b/src/logging.cpp
@@ -126,8 +126,7 @@ bool BCLog::Logger::DefaultShrinkDebugFile() const
return m_categories == BCLog::NONE;
}
-struct CLogCategoryDesc
-{
+struct CLogCategoryDesc {
BCLog::LogFlags flag;
std::string category;
};
@@ -188,13 +187,11 @@ std::vector<LogCategory> BCLog::Logger::LogCategoriesList() const
std::vector<LogCategory> ret;
for (const CLogCategoryDesc& category_desc : categories) {
- // Omit the special cases.
- if (category_desc.flag != BCLog::NONE && category_desc.flag != BCLog::ALL) {
- LogCategory catActive;
- catActive.category = category_desc.category;
- catActive.active = WillLogCategory(category_desc.flag);
- ret.push_back(catActive);
- }
+ if (category_desc.flag == BCLog::NONE || category_desc.flag == BCLog::ALL) continue;
+ LogCategory catActive;
+ catActive.category = category_desc.category;
+ catActive.active = WillLogCategory(category_desc.flag);
+ ret.push_back(catActive);
}
return ret;
}
@@ -244,7 +241,7 @@ namespace BCLog {
}
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)
{