logging: Drop BCLog::Level::None

Now that Info-level logging is always logged, there is no further
need for the "None" level, so remove it.
This commit is contained in:
Anthony Towns
2023-08-22 14:38:38 +10:00
parent ab34dc6012
commit 667ce3e329
3 changed files with 12 additions and 27 deletions

View File

@@ -77,7 +77,6 @@ namespace BCLog {
Info, // Default
Warning,
Error,
None, // Internal use only
};
constexpr auto DEFAULT_LOG_LEVEL{Level::Debug};
@@ -236,22 +235,14 @@ static inline void LogPrintf_(const std::string& logging_function, const std::st
#define LogPrintLevel_(category, level, ...) LogPrintf_(__func__, __FILE__, __LINE__, category, level, __VA_ARGS__)
// Log unconditionally.
#define LogPrintf(...) LogPrintLevel_(BCLog::LogFlags::NONE, BCLog::Level::None, __VA_ARGS__)
#define LogPrintf(...) LogPrintLevel_(BCLog::LogFlags::NONE, BCLog::Level::Info, __VA_ARGS__)
// Log unconditionally, prefixing the output with the passed category name.
#define LogPrintfCategory(category, ...) LogPrintLevel_(category, BCLog::Level::None, __VA_ARGS__)
#define LogPrintfCategory(category, ...) LogPrintLevel_(category, BCLog::Level::Info, __VA_ARGS__)
// Use a macro instead of a function for conditional logging to prevent
// evaluating arguments when logging for the category is not enabled.
// Log conditionally, prefixing the output with the passed category name.
#define LogPrint(category, ...) \
do { \
if (LogAcceptCategory((category), BCLog::Level::Debug)) { \
LogPrintLevel_(category, BCLog::Level::None, __VA_ARGS__); \
} \
} while (0)
// Log conditionally, prefixing the output with the passed category name and severity level.
#define LogPrintLevel(category, level, ...) \
do { \
@@ -260,6 +251,9 @@ static inline void LogPrintf_(const std::string& logging_function, const std::st
} \
} while (0)
// Log conditionally, prefixing the output with the passed category name.
#define LogPrint(category, ...) LogPrintLevel(category, BCLog::Level::Debug, __VA_ARGS__)
template <typename... Args>
bool error(const char* fmt, const Args&... args)
{