mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-10 14:08:40 +01:00
Merge bitcoin/bitcoin#30255: log: use error level for critical log messages
fae3a1f006log: use error level for critical log messages (MarcoFalke) Pull request description: This picks up the first commit from https://github.com/bitcoin/bitcoin/pull/29231, but extends it to also cover cases that were missed in it. As per https://github.com/bitcoin/bitcoin/blob/master/doc/developer-notes.md#logging, LogError should be used for severe problems that require the node to shut down. ACKs for top commit: stickies-v: re-ACKfae3a1f006, I'm ~0 on the latest force push as `user_error` was already logged at the right level through `GetNotifications().fatalError(user_error);` so I'd be in favour of deduplicating/cleaning up this logging logic but can be done in follow-up. kevkevinpal: ACK [fae3a1f](fae3a1f006) achow101: ACKfae3a1f006Tree-SHA512: 3f99fd25d5a204d570a42d8fb2b450439aad7685692f9594cc813d97253c4df172a6ff3cf818959bfcf25dfcf8ee9a9c9ccc6028fcfcecdb47591e18c77ef246
This commit is contained in:
16
src/init.cpp
16
src/init.cpp
@@ -409,7 +409,7 @@ static void HandleSIGHUP(int)
|
||||
static BOOL WINAPI consoleCtrlHandler(DWORD dwCtrlType)
|
||||
{
|
||||
if (!(*Assert(g_shutdown))()) {
|
||||
LogPrintf("Error: failed to send shutdown signal on Ctrl-C\n");
|
||||
LogError("Failed to send shutdown signal on Ctrl-C\n");
|
||||
return false;
|
||||
}
|
||||
Sleep(INFINITE);
|
||||
@@ -840,7 +840,7 @@ std::set<BlockFilterType> g_enabled_filter_types;
|
||||
// Since LogPrintf may itself allocate memory, set the handler directly
|
||||
// to terminate first.
|
||||
std::set_new_handler(std::terminate);
|
||||
LogPrintf("Error: Out of memory. Terminating.\n");
|
||||
LogError("Out of memory. Terminating.\n");
|
||||
|
||||
// The log was successful, terminate now.
|
||||
std::terminate();
|
||||
@@ -1175,9 +1175,9 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
|
||||
scheduler.scheduleEvery([&args, &node]{
|
||||
constexpr uint64_t min_disk_space = 50 << 20; // 50 MB
|
||||
if (!CheckDiskSpace(args.GetBlocksDirPath(), min_disk_space)) {
|
||||
LogPrintf("Shutting down due to lack of disk space!\n");
|
||||
LogError("Shutting down due to lack of disk space!\n");
|
||||
if (!(*Assert(node.shutdown))()) {
|
||||
LogPrintf("Error: failed to send shutdown signal after disk space check\n");
|
||||
LogError("Failed to send shutdown signal after disk space check\n");
|
||||
}
|
||||
}
|
||||
}, std::chrono::minutes{5});
|
||||
@@ -1582,7 +1582,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
|
||||
try {
|
||||
return f();
|
||||
} catch (const std::exception& e) {
|
||||
LogPrintf("%s\n", e.what());
|
||||
LogError("%s\n", e.what());
|
||||
return std::make_tuple(node::ChainstateLoadStatus::FAILURE, _("Error opening block database"));
|
||||
}
|
||||
};
|
||||
@@ -1614,10 +1614,10 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
|
||||
if (fRet) {
|
||||
do_reindex = true;
|
||||
if (!Assert(node.shutdown)->reset()) {
|
||||
LogPrintf("Internal error: failed to reset shutdown signal.\n");
|
||||
LogError("Internal error: failed to reset shutdown signal.\n");
|
||||
}
|
||||
} else {
|
||||
LogPrintf("Aborted block database rebuild. Exiting.\n");
|
||||
LogError("Aborted block database rebuild. Exiting.\n");
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
@@ -1752,7 +1752,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
|
||||
if (args.GetBoolArg("-stopafterblockimport", DEFAULT_STOPAFTERBLOCKIMPORT)) {
|
||||
LogPrintf("Stopping after block import\n");
|
||||
if (!(*Assert(node.shutdown))()) {
|
||||
LogPrintf("Error: failed to send shutdown signal after finishing block import\n");
|
||||
LogError("Failed to send shutdown signal after finishing block import\n");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user