mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-09-13 06:04:42 +02:00
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:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user