Skip to content

Commit aaced56

Browse files
EmpactTheCharlatan
authored andcommitted
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.
1 parent e7333b4 commit aaced56

File tree

12 files changed

+18
-12
lines changed

12 files changed

+18
-12
lines changed

src/addrdb.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include <cstdint>
1212
#include <fs.h>
1313
#include <hash.h>
14+
#include <logging.h>
1415
#include <logging/timer.h>
1516
#include <netbase.h>
1617
#include <netgroup.h>

src/index/base.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include <index/base.h>
77
#include <interfaces/chain.h>
88
#include <kernel/chain.h>
9+
#include <logging.h>
910
#include <node/blockstorage.h>
1011
#include <node/context.h>
1112
#include <node/database_args.h>

src/index/coinstatsindex.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include <crypto/muhash.h>
88
#include <index/coinstatsindex.h>
99
#include <kernel/coinstats.h>
10+
#include <logging.h>
1011
#include <node/blockstorage.h>
1112
#include <serialize.h>
1213
#include <txdb.h>

src/index/txindex.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include <index/txindex.h>
66

77
#include <index/disktxpos.h>
8+
#include <logging.h>
89
#include <node/blockstorage.h>
910
#include <util/system.h>
1011
#include <validation.h>

src/kernel/coinstats.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include <coins.h>
99
#include <crypto/muhash.h>
1010
#include <hash.h>
11+
#include <logging.h>
1112
#include <node/blockstorage.h>
1213
#include <primitives/transaction.h>
1314
#include <script/script.h>
@@ -19,7 +20,6 @@
1920
#include <uint256.h>
2021
#include <util/check.h>
2122
#include <util/overflow.h>
22-
#include <util/system.h>
2323
#include <validation.h>
2424
#include <version.h>
2525

src/logging.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,4 +257,11 @@ static inline void LogPrintf_(const std::string& logging_function, const std::st
257257
} \
258258
} while (0)
259259

260+
template <typename... Args>
261+
bool error(const char* fmt, const Args&... args)
262+
{
263+
LogPrintf("ERROR: %s\n", tfm::format(fmt, args...));
264+
return false;
265+
}
266+
260267
#endif // BITCOIN_LOGGING_H

src/net.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,13 @@
1616
#include <compat/compat.h>
1717
#include <consensus/consensus.h>
1818
#include <crypto/sha256.h>
19-
#include <node/eviction.h>
2019
#include <fs.h>
2120
#include <i2p.h>
21+
#include <logging.h>
2222
#include <net_permissions.h>
2323
#include <netaddress.h>
2424
#include <netbase.h>
25+
#include <node/eviction.h>
2526
#include <node/interface_ui.h>
2627
#include <protocol.h>
2728
#include <random.h>

src/netbase.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
#include <netbase.h>
77

88
#include <compat/compat.h>
9+
#include <logging.h>
910
#include <sync.h>
1011
#include <tinyformat.h>
1112
#include <util/sock.h>
1213
#include <util/strencodings.h>
1314
#include <util/string.h>
14-
#include <util/system.h>
1515
#include <util/time.h>
1616

1717
#include <atomic>

src/node/blockstorage.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include <flatfile.h>
1212
#include <fs.h>
1313
#include <hash.h>
14+
#include <logging.h>
1415
#include <pow.h>
1516
#include <reverse_iterator.h>
1617
#include <shutdown.h>

src/script/signingprovider.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#include <script/signingprovider.h>
88
#include <script/standard.h>
99

10-
#include <util/system.h>
10+
#include <logging.h>
1111

1212
const SigningProvider& DUMMY_SIGNING_PROVIDER = SigningProvider();
1313

0 commit comments

Comments
 (0)