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

@@ -120,7 +120,7 @@ static bool HTTPReq_JSONRPC(const std::any& context, HTTPRequest* req)
jreq.context = context;
jreq.peerAddr = req->GetPeer().ToStringAddrPort();
if (!RPCAuthorized(authHeader.second, jreq.authUser)) {
LogPrintf("ThreadRPCServer incorrect password attempt from %s\n", jreq.peerAddr);
LogWarning("ThreadRPCServer incorrect password attempt from %s", jreq.peerAddr);
/* Deter brute-forcing
If this results in a DoS the user really
@@ -144,7 +144,7 @@ static bool HTTPReq_JSONRPC(const std::any& context, HTTPRequest* req)
UniValue reply;
bool user_has_whitelist = g_rpc_whitelist.count(jreq.authUser);
if (!user_has_whitelist && g_rpc_whitelist_default) {
LogPrintf("RPC User %s not allowed to call any methods\n", jreq.authUser);
LogWarning("RPC User %s not allowed to call any methods", jreq.authUser);
req->WriteReply(HTTP_FORBIDDEN);
return false;
@@ -152,7 +152,7 @@ static bool HTTPReq_JSONRPC(const std::any& context, HTTPRequest* req)
} else if (valRequest.isObject()) {
jreq.parse(valRequest);
if (user_has_whitelist && !g_rpc_whitelist[jreq.authUser].count(jreq.strMethod)) {
LogPrintf("RPC User %s not allowed to call method %s\n", jreq.authUser, jreq.strMethod);
LogWarning("RPC User %s not allowed to call method %s", jreq.authUser, jreq.strMethod);
req->WriteReply(HTTP_FORBIDDEN);
return false;
}
@@ -182,7 +182,7 @@ static bool HTTPReq_JSONRPC(const std::any& context, HTTPRequest* req)
// Parse method
std::string strMethod = request.find_value("method").get_str();
if (!g_rpc_whitelist[jreq.authUser].count(strMethod)) {
LogPrintf("RPC User %s not allowed to call method %s\n", jreq.authUser, strMethod);
LogWarning("RPC User %s not allowed to call method %s", jreq.authUser, strMethod);
req->WriteReply(HTTP_FORBIDDEN);
return false;
}
@@ -297,7 +297,7 @@ static bool InitRPCAuthentication()
fields.insert(fields.end(), salt_hmac.begin(), salt_hmac.end());
g_rpcauth.push_back(fields);
} else {
LogPrintf("Invalid -rpcauth argument.\n");
LogWarning("Invalid -rpcauth argument.");
return false;
}
}