scripted-diff: logging: Drop LogAcceptCategory

-BEGIN VERIFY SCRIPT-
sed -i 's/LogAcceptCategory(\(.*\), [a-zA-Z:]*::Level::Debug)/util::log::ShouldDebugLog(\1)/g' $(git grep -l LogAcceptCategory -- '*.cpp')
sed -i 's/LogAcceptCategory(\(.*\), [a-zA-Z:]*::Level::Trace)/util::log::ShouldTraceLog(\1)/g' $(git grep -l LogAcceptCategory -- '*.cpp')
sed -i '/Return true if log accepts specified category/,/^$/d' src/logging.h
-END VERIFY SCRIPT-
This commit is contained in:
Anthony Towns
2026-02-11 09:42:45 +10:00
parent 34332dba2f
commit 611878b46f
7 changed files with 8 additions and 14 deletions

View File

@@ -59,7 +59,7 @@ public:
// This code is adapted from posix_logger.h, which is why it is using vsprintf.
// Please do not do this in normal code
void Logv(const char * format, va_list ap) override {
if (!LogAcceptCategory(BCLog::LEVELDB, util::log::Level::Debug)) {
if (!util::log::ShouldDebugLog(BCLog::LEVELDB)) {
return;
}
char buffer[500];
@@ -278,7 +278,7 @@ CDBWrapper::~CDBWrapper()
void CDBWrapper::WriteBatch(CDBBatch& batch, bool fSync)
{
const bool log_memory = LogAcceptCategory(BCLog::LEVELDB, util::log::Level::Debug);
const bool log_memory = util::log::ShouldDebugLog(BCLog::LEVELDB);
double mem_before = 0;
if (log_memory) {
mem_before = DynamicMemoryUsage() / double(1_MiB);