logging: use util/log.h where possible

Preparation for a future commit where kernel's dependency
on logging.cpp is removed completely.

Replace usage of logging\.h with util/log\.h where it
suffices, and fix wrong includes according to iwyu.
This commit is contained in:
stickies-v
2026-01-26 18:48:08 +00:00
parent bb8e9e7c4c
commit 37cc2a2d95
33 changed files with 57 additions and 54 deletions

View File

@@ -4,21 +4,6 @@
#include <dbwrapper.h>
#include <logging.h>
#include <random.h>
#include <serialize.h>
#include <span.h>
#include <streams.h>
#include <util/fs.h>
#include <util/fs_helpers.h>
#include <util/obfuscation.h>
#include <util/strencodings.h>
#include <algorithm>
#include <cassert>
#include <cstdarg>
#include <cstdint>
#include <cstdio>
#include <leveldb/cache.h>
#include <leveldb/db.h>
#include <leveldb/env.h>
@@ -29,6 +14,22 @@
#include <leveldb/slice.h>
#include <leveldb/status.h>
#include <leveldb/write_batch.h>
#include <logging.h>
#include <random.h>
#include <serialize.h>
#include <span.h>
#include <streams.h>
#include <util/fs.h>
#include <util/fs_helpers.h>
#include <util/log.h>
#include <util/obfuscation.h>
#include <util/strencodings.h>
#include <algorithm>
#include <cassert>
#include <cstdarg>
#include <cstdint>
#include <cstdio>
#include <memory>
#include <optional>
#include <utility>
@@ -57,7 +58,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, BCLog::Level::Debug)) {
if (!LogAcceptCategory(BCLog::LEVELDB, util::log::Level::Debug)) {
return;
}
char buffer[500];
@@ -276,7 +277,7 @@ CDBWrapper::~CDBWrapper()
void CDBWrapper::WriteBatch(CDBBatch& batch, bool fSync)
{
const bool log_memory = LogAcceptCategory(BCLog::LEVELDB, BCLog::Level::Debug);
const bool log_memory = LogAcceptCategory(BCLog::LEVELDB, util::log::Level::Debug);
double mem_before = 0;
if (log_memory) {
mem_before = DynamicMemoryUsage() / 1024.0 / 1024;