Skip to content

Commit 17bbff3

Browse files
committed
log, refactor: use guard clause in LogCategoriesList()
and minor formatting fixups
1 parent 7c57297 commit 17bbff3

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

src/logging.cpp

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,7 @@ bool BCLog::Logger::DefaultShrinkDebugFile() const
126126
return m_categories == BCLog::NONE;
127127
}
128128

129-
struct CLogCategoryDesc
130-
{
129+
struct CLogCategoryDesc {
131130
BCLog::LogFlags flag;
132131
std::string category;
133132
};
@@ -188,13 +187,11 @@ std::vector<LogCategory> BCLog::Logger::LogCategoriesList() const
188187

189188
std::vector<LogCategory> ret;
190189
for (const CLogCategoryDesc& category_desc : categories) {
191-
// Omit the special cases.
192-
if (category_desc.flag != BCLog::NONE && category_desc.flag != BCLog::ALL) {
193-
LogCategory catActive;
194-
catActive.category = category_desc.category;
195-
catActive.active = WillLogCategory(category_desc.flag);
196-
ret.push_back(catActive);
197-
}
190+
if (category_desc.flag == BCLog::NONE || category_desc.flag == BCLog::ALL) continue;
191+
LogCategory catActive;
192+
catActive.category = category_desc.category;
193+
catActive.active = WillLogCategory(category_desc.flag);
194+
ret.push_back(catActive);
198195
}
199196
return ret;
200197
}
@@ -244,7 +241,7 @@ namespace BCLog {
244241
}
245242
return ret;
246243
}
247-
}
244+
} // namespace BCLog
248245

249246
void BCLog::Logger::LogPrintStr(const std::string& str, const std::string& logging_function, const std::string& source_file, const int source_line)
250247
{

0 commit comments

Comments
 (0)