log: Use LogWarning for non-critical logs

As per doc/developer-notes#logging, LogWarning should be used for severe
problems that do not warrant shutting down the node
This commit is contained in:
MarcoFalke
2025-11-26 17:13:09 +01:00
parent fa0018d011
commit fa45a1503e
23 changed files with 116 additions and 115 deletions

View File

@@ -198,7 +198,7 @@ static void RemovePidFile(const ArgsManager& args)
const auto pid_path{GetPidFile(args)};
if (std::error_code error; !fs::remove(pid_path, error)) {
std::string msg{error ? error.message() : "File does not exist"};
LogPrintf("Unable to remove PID file (%s): %s\n", fs::PathToString(pid_path), msg);
LogWarning("Unable to remove PID file (%s): %s", fs::PathToString(pid_path), msg);
}
}
@@ -1342,7 +1342,7 @@ static ChainstateLoadResult InitAndLoadChainstate(
index->Interrupt();
index->Stop();
if (!(index->Init() && index->StartBackgroundSync())) {
LogPrintf("[snapshot] WARNING failed to restart index %s on snapshot chain\n", index->GetName());
LogWarning("[snapshot] Failed to restart index %s on snapshot chain", index->GetName());
}
}
};
@@ -1406,11 +1406,11 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
// Warn about relative -datadir path.
if (args.IsArgSet("-datadir") && !args.GetPathArg("-datadir").is_absolute()) {
LogPrintf("Warning: relative datadir option '%s' specified, which will be interpreted relative to the "
"current working directory '%s'. This is fragile, because if bitcoin is started in the future "
"from a different location, it will be unable to locate the current data files. There could "
"also be data loss if bitcoin is started while in a temporary directory.\n",
args.GetArg("-datadir", ""), fs::PathToString(fs::current_path()));
LogWarning("Relative datadir option '%s' specified, which will be interpreted relative to the "
"current working directory '%s'. This is fragile, because if bitcoin is started in the future "
"from a different location, it will be unable to locate the current data files. There could "
"also be data loss if bitcoin is started while in a temporary directory.",
args.GetArg("-datadir", ""), fs::PathToString(fs::current_path()));
}
assert(!node.scheduler);