refactor: Move error() from util/system.h to logging.h

error is a low-level function with a sole dependency on LogPrintf, which
is defined in logging.h

The background of this commit is an ongoing effort to decouple the
libbitcoinkernel library from the ArgsManager defined in system.h.
Moving the function out of system.h allows including it from a separate
source file without including the ArgsManager definitions from system.h.
This commit is contained in:
Ben Woosley authored and TheCharlatan committed 2023-03-13 17:09:54 +01:00
1 parent e7333b420e
commit aaced5633b
12 files changed
+18 -12

No files matched your search

+1
View File
@@ -11,6 +11,7 @@
#include <cstdint>
#include <fs.h>
#include <hash.h>
#include <logging.h>
#include <logging/timer.h>
#include <netbase.h>
#include <netgroup.h>
+1
View File
@@ -6,6 +6,7 @@
#include <index/base.h>
#include <interfaces/chain.h>
#include <kernel/chain.h>
#include <logging.h>
#include <node/blockstorage.h>
#include <node/context.h>
#include <node/database_args.h>
+1
View File
@@ -7,6 +7,7 @@
#include <crypto/muhash.h>
#include <index/coinstatsindex.h>
#include <kernel/coinstats.h>
#include <logging.h>
#include <node/blockstorage.h>
#include <serialize.h>
#include <txdb.h>
+1
View File
@@ -5,6 +5,7 @@
#include <index/txindex.h>
#include <index/disktxpos.h>
#include <logging.h>
#include <node/blockstorage.h>
#include <util/system.h>
#include <validation.h>
+1 -1
View File
@@ -8,6 +8,7 @@
#include <coins.h>
#include <crypto/muhash.h>
#include <hash.h>
#include <logging.h>
#include <node/blockstorage.h>
#include <primitives/transaction.h>
#include <script/script.h>
@@ -19,7 +20,6 @@
#include <uint256.h>
#include <util/check.h>
#include <util/overflow.h>
#include <util/system.h>
#include <validation.h>
#include <version.h>
+7
View File
@@ -257,4 +257,11 @@ static inline void LogPrintf_(const std::string& logging_function, const std::st
} \
} while (0)
template <typename... Args>
bool error(const char* fmt, const Args&... args)
{
LogPrintf("ERROR: %s\n", tfm::format(fmt, args...));
return false;
}
#endif // BITCOIN_LOGGING_H
+2 -1
View File
@@ -16,12 +16,13 @@
#include <compat/compat.h>
#include <consensus/consensus.h>
#include <crypto/sha256.h>
#include <node/eviction.h>
#include <fs.h>
#include <i2p.h>
#include <logging.h>
#include <net_permissions.h>
#include <netaddress.h>
#include <netbase.h>
#include <node/eviction.h>
#include <node/interface_ui.h>
#include <protocol.h>
#include <random.h>
+1 -1
View File
@@ -6,12 +6,12 @@
#include <netbase.h>
#include <compat/compat.h>
#include <logging.h>
#include <sync.h>
#include <tinyformat.h>
#include <util/sock.h>
#include <util/strencodings.h>
#include <util/string.h>
#include <util/system.h>
#include <util/time.h>
#include <atomic>
+1
View File
@@ -11,6 +11,7 @@
#include <flatfile.h>
#include <fs.h>
#include <hash.h>
#include <logging.h>
#include <pow.h>
#include <reverse_iterator.h>
#include <shutdown.h>
+1 -1
View File
@@ -7,7 +7,7 @@
#include <script/signingprovider.h>
#include <script/standard.h>
#include <util/system.h>
#include <logging.h>
const SigningProvider& DUMMY_SIGNING_PROVIDER = SigningProvider();
+1 -1
View File
@@ -6,11 +6,11 @@
#include <txdb.h>
#include <chain.h>
#include <logging.h>
#include <pow.h>
#include <random.h>
#include <shutdown.h>
#include <uint256.h>
#include <util/system.h>
#include <util/translation.h>
#include <util/vector.h>
-7
View File
@@ -43,13 +43,6 @@ extern const char * const BITCOIN_SETTINGS_FILENAME;
void SetupEnvironment();
bool SetupNetworking();
template<typename... Args>
bool error(const char* fmt, const Args&... args)
{
LogPrintf("ERROR: %s\n", tfm::format(fmt, args...));
return false;
}
/**
* Ensure file contents are fully committed to disk, using a platform-specific
* feature analogous to fsync().