Skip to content

Commit ecff20d

Browse files
committed
logging: use LogPrintfCategory rather than a manual category
Here we update only the log messages that manually print a category. In upcoming commits, LogPrintCategory will likely be used in many other cases, such as to replace `LogPrintf` where it makes sense.
1 parent eb8aab7 commit ecff20d

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

src/httpserver.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ bool InitHTTPServer()
400400

401401
LogPrint(BCLog::HTTP, "Initialized HTTP server\n");
402402
int workQueueDepth = std::max((long)gArgs.GetIntArg("-rpcworkqueue", DEFAULT_HTTP_WORKQUEUE), 1L);
403-
LogPrintf("HTTP: creating work queue of depth %d\n", workQueueDepth);
403+
LogPrintfCategory(BCLog::HTTP, "creating work queue of depth %d\n", workQueueDepth);
404404

405405
g_work_queue = std::make_unique<WorkQueue<HTTPClosure>>(workQueueDepth);
406406
// transfer ownership to eventBase/HTTP via .release()
@@ -424,7 +424,7 @@ void StartHTTPServer()
424424
{
425425
LogPrint(BCLog::HTTP, "Starting HTTP server\n");
426426
int rpcThreads = std::max((long)gArgs.GetIntArg("-rpcthreads", DEFAULT_HTTP_THREADS), 1L);
427-
LogPrintf("HTTP: starting %d worker threads\n", rpcThreads);
427+
LogPrintfCategory(BCLog::HTTP, "starting %d worker threads\n", rpcThreads);
428428
g_thread_http = std::thread(ThreadHTTP, eventBase);
429429

430430
for (int i = 0; i < rpcThreads; i++) {

src/i2p.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -376,8 +376,8 @@ void Session::CreateIfNotCreatedAlready()
376376
m_session_id = session_id;
377377
m_control_sock = std::move(sock);
378378

379-
LogPrintf("I2P: SAM session created: session id=%s, my address=%s\n", m_session_id,
380-
m_my_addr.ToString());
379+
LogPrintfCategory(BCLog::I2P, "SAM session created: session id=%s, my address=%s\n",
380+
m_session_id, m_my_addr.ToString());
381381
}
382382

383383
std::unique_ptr<Sock> Session::StreamAccept()

src/init.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1506,8 +1506,8 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
15061506
uiInterface.InitMessage(_("Verifying blocks…").translated);
15071507
auto check_blocks = args.GetIntArg("-checkblocks", DEFAULT_CHECKBLOCKS);
15081508
if (chainman.m_blockman.m_have_pruned && check_blocks > MIN_BLOCKS_TO_KEEP) {
1509-
LogPrintf("Prune: pruned datadir may not have more than %d blocks; only checking available blocks\n",
1510-
MIN_BLOCKS_TO_KEEP);
1509+
LogPrintfCategory(BCLog::PRUNE, "pruned datadir may not have more than %d blocks; only checking available blocks\n",
1510+
MIN_BLOCKS_TO_KEEP);
15111511
}
15121512
maybe_verify_error = VerifyLoadedChainstate(chainman,
15131513
fReset,

src/torcontrol.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ void TorController::add_onion_cb(TorControlConnection& _conn, const TorControlRe
421421
return;
422422
}
423423
service = LookupNumeric(std::string(service_id+".onion"), Params().GetDefaultPort());
424-
LogPrintf("tor: Got service ID %s, advertising service %s\n", service_id, service.ToString());
424+
LogPrintfCategory(BCLog::TOR, "Got service ID %s, advertising service %s\n", service_id, service.ToString());
425425
if (WriteBinaryFile(GetPrivateKeyFile(), private_key)) {
426426
LogPrint(BCLog::TOR, "Cached service private key to %s\n", fs::PathToString(GetPrivateKeyFile()));
427427
} else {

0 commit comments

Comments
 (0)