logging: deprecate libevent category

Creates logic to deprecate logging categories but still
"support" them so the software doesn't quit with unknown category
on startup. Deprecated categories are always false and attempts
to switch them are logged as warnings.
This commit is contained in:
Matthew Zipkin
2026-04-28 13:22:26 -04:00
parent 8c1eea0777
commit 39e9099da5
7 changed files with 31 additions and 16 deletions

View File

@@ -133,6 +133,11 @@ void BCLog::Logger::EnableCategory(BCLog::LogFlags flag)
bool BCLog::Logger::EnableCategory(std::string_view str)
{
if (const auto flag{GetLogCategory(str)}) {
if (*flag & DEPRECATED){
LogWarning("The logging category `%s` is deprecated, can not be enabled, and will be removed in a future version", str);
// Deprecated does not mean unsupported, which may prevent startup
return true;
}
EnableCategory(*flag);
return true;
}
@@ -147,6 +152,11 @@ void BCLog::Logger::DisableCategory(BCLog::LogFlags flag)
bool BCLog::Logger::DisableCategory(std::string_view str)
{
if (const auto flag{GetLogCategory(str)}) {
if (*flag & DEPRECATED){
LogWarning("The logging category `%s` is deprecated and will be removed in a future version", str);
// Deprecated does not mean unsupported, which may prevent startup
return true;
}
DisableCategory(*flag);
return true;
}