Skip to content

Commit d40550d

Browse files
committed
scripted-diff: remove duplicate categories from LogPrint output
-BEGIN VERIFY SCRIPT- s() { git grep -l "$1" src | xargs sed -i "s/$1/$2/g"; } s 'BCLog::TOR, "tor: ' 'BCLog::TOR, "' s 'BCLog::I2P, "I2P: ' 'BCLog::I2P, "' s 'BCLog::NET, "net: ' 'BCLog::NET, "' s 'BCLog::ZMQ, "zmq: ' 'BCLog::ZMQ, "' s 'BCLog::PRUNE, "Prune: ' 'BCLog::PRUNE, "' -END VERIFY SCRIPT-
1 parent 1b2e1d1 commit d40550d

File tree

7 files changed

+41
-41
lines changed

7 files changed

+41
-41
lines changed

src/i2p.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ std::string Session::Reply::Get(const std::string& key) const
242242
template <typename... Args>
243243
void Session::Log(const std::string& fmt, const Args&... args) const
244244
{
245-
LogPrint(BCLog::I2P, "I2P: %s\n", tfm::format(fmt, args...));
245+
LogPrint(BCLog::I2P, "%s\n", tfm::format(fmt, args...));
246246
}
247247

248248
Session::Reply Session::SendRequestAndGetReply(const Sock& sock,

src/net.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1873,12 +1873,12 @@ bool CConnman::GetTryNewOutboundPeer() const
18731873
void CConnman::SetTryNewOutboundPeer(bool flag)
18741874
{
18751875
m_try_another_outbound_peer = flag;
1876-
LogPrint(BCLog::NET, "net: setting try another outbound peer=%s\n", flag ? "true" : "false");
1876+
LogPrint(BCLog::NET, "setting try another outbound peer=%s\n", flag ? "true" : "false");
18771877
}
18781878

18791879
void CConnman::StartExtraBlockRelayPeers()
18801880
{
1881-
LogPrint(BCLog::NET, "net: enabling extra block-relay-only peers\n");
1881+
LogPrint(BCLog::NET, "enabling extra block-relay-only peers\n");
18821882
m_start_extra_block_relay_peers = true;
18831883
}
18841884

src/node/blockstorage.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ void BlockManager::FindFilesToPrune(std::set<int>& setFilesToPrune, uint64_t nPr
226226
}
227227
}
228228

229-
LogPrint(BCLog::PRUNE, "Prune: target=%dMiB actual=%dMiB diff=%dMiB max_prune_height=%d removed %d blk/rev pairs\n",
229+
LogPrint(BCLog::PRUNE, "target=%dMiB actual=%dMiB diff=%dMiB max_prune_height=%d removed %d blk/rev pairs\n",
230230
nPruneTarget/1024/1024, nCurrentUsage/1024/1024,
231231
((int64_t)nPruneTarget - (int64_t)nCurrentUsage)/1024/1024,
232232
nLastBlockWeCanPrune, count);

src/torcontrol.cpp

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ void TorControlConnection::readcb(struct bufferevent *bev, void *ctx)
9494
self->reply_handlers.front()(*self, self->message);
9595
self->reply_handlers.pop_front();
9696
} else {
97-
LogPrint(BCLog::TOR, "tor: Received unexpected sync reply %i\n", self->message.code);
97+
LogPrint(BCLog::TOR, "Received unexpected sync reply %i\n", self->message.code);
9898
}
9999
}
100100
self->message.Clear();
@@ -113,13 +113,13 @@ void TorControlConnection::eventcb(struct bufferevent *bev, short what, void *ct
113113
{
114114
TorControlConnection *self = static_cast<TorControlConnection*>(ctx);
115115
if (what & BEV_EVENT_CONNECTED) {
116-
LogPrint(BCLog::TOR, "tor: Successfully connected!\n");
116+
LogPrint(BCLog::TOR, "Successfully connected!\n");
117117
self->connected(*self);
118118
} else if (what & (BEV_EVENT_EOF|BEV_EVENT_ERROR)) {
119119
if (what & BEV_EVENT_ERROR) {
120-
LogPrint(BCLog::TOR, "tor: Error connecting to Tor control socket\n");
120+
LogPrint(BCLog::TOR, "Error connecting to Tor control socket\n");
121121
} else {
122-
LogPrint(BCLog::TOR, "tor: End of stream\n");
122+
LogPrint(BCLog::TOR, "End of stream\n");
123123
}
124124
self->Disconnect();
125125
self->disconnected(*self);
@@ -318,7 +318,7 @@ TorController::TorController(struct event_base* _base, const std::string& tor_co
318318
// Read service private key if cached
319319
std::pair<bool,std::string> pkf = ReadBinaryFile(GetPrivateKeyFile());
320320
if (pkf.first) {
321-
LogPrint(BCLog::TOR, "tor: Reading cached private key from %s\n", fs::PathToString(GetPrivateKeyFile()));
321+
LogPrint(BCLog::TOR, "Reading cached private key from %s\n", fs::PathToString(GetPrivateKeyFile()));
322322
private_key = pkf.second;
323323
}
324324
}
@@ -359,7 +359,7 @@ void TorController::get_socks_cb(TorControlConnection& _conn, const TorControlRe
359359
}
360360
}
361361
if (!socks_location.empty()) {
362-
LogPrint(BCLog::TOR, "tor: Get SOCKS port command yielded %s\n", socks_location);
362+
LogPrint(BCLog::TOR, "Get SOCKS port command yielded %s\n", socks_location);
363363
} else {
364364
LogPrintf("tor: Get SOCKS port command returned nothing\n");
365365
}
@@ -380,7 +380,7 @@ void TorController::get_socks_cb(TorControlConnection& _conn, const TorControlRe
380380
}
381381

382382
Assume(resolved.IsValid());
383-
LogPrint(BCLog::TOR, "tor: Configuring onion proxy for %s\n", resolved.ToStringIPPort());
383+
LogPrint(BCLog::TOR, "Configuring onion proxy for %s\n", resolved.ToStringIPPort());
384384
Proxy addrOnion = Proxy(resolved, true);
385385
SetProxy(NET_ONION, addrOnion);
386386

@@ -404,7 +404,7 @@ void TorController::get_socks_cb(TorControlConnection& _conn, const TorControlRe
404404
void TorController::add_onion_cb(TorControlConnection& _conn, const TorControlReply& reply)
405405
{
406406
if (reply.code == 250) {
407-
LogPrint(BCLog::TOR, "tor: ADD_ONION successful\n");
407+
LogPrint(BCLog::TOR, "ADD_ONION successful\n");
408408
for (const std::string &s : reply.lines) {
409409
std::map<std::string,std::string> m = ParseTorReplyMapping(s);
410410
std::map<std::string,std::string>::iterator i;
@@ -423,7 +423,7 @@ void TorController::add_onion_cb(TorControlConnection& _conn, const TorControlRe
423423
service = LookupNumeric(std::string(service_id+".onion"), Params().GetDefaultPort());
424424
LogPrintf("tor: Got service ID %s, advertising service %s\n", service_id, service.ToString());
425425
if (WriteBinaryFile(GetPrivateKeyFile(), private_key)) {
426-
LogPrint(BCLog::TOR, "tor: Cached service private key to %s\n", fs::PathToString(GetPrivateKeyFile()));
426+
LogPrint(BCLog::TOR, "Cached service private key to %s\n", fs::PathToString(GetPrivateKeyFile()));
427427
} else {
428428
LogPrintf("tor: Error writing service private key to %s\n", fs::PathToString(GetPrivateKeyFile()));
429429
}
@@ -439,7 +439,7 @@ void TorController::add_onion_cb(TorControlConnection& _conn, const TorControlRe
439439
void TorController::auth_cb(TorControlConnection& _conn, const TorControlReply& reply)
440440
{
441441
if (reply.code == 250) {
442-
LogPrint(BCLog::TOR, "tor: Authentication successful\n");
442+
LogPrint(BCLog::TOR, "Authentication successful\n");
443443

444444
// Now that we know Tor is running setup the proxy for onion addresses
445445
// if -onion isn't set to something else.
@@ -490,7 +490,7 @@ static std::vector<uint8_t> ComputeResponse(const std::string &key, const std::v
490490
void TorController::authchallenge_cb(TorControlConnection& _conn, const TorControlReply& reply)
491491
{
492492
if (reply.code == 250) {
493-
LogPrint(BCLog::TOR, "tor: SAFECOOKIE authentication challenge successful\n");
493+
LogPrint(BCLog::TOR, "SAFECOOKIE authentication challenge successful\n");
494494
std::pair<std::string,std::string> l = SplitTorReplyLine(reply.lines[0]);
495495
if (l.first == "AUTHCHALLENGE") {
496496
std::map<std::string,std::string> m = ParseTorReplyMapping(l.second);
@@ -500,7 +500,7 @@ void TorController::authchallenge_cb(TorControlConnection& _conn, const TorContr
500500
}
501501
std::vector<uint8_t> serverHash = ParseHex(m["SERVERHASH"]);
502502
std::vector<uint8_t> serverNonce = ParseHex(m["SERVERNONCE"]);
503-
LogPrint(BCLog::TOR, "tor: AUTHCHALLENGE ServerHash %s ServerNonce %s\n", HexStr(serverHash), HexStr(serverNonce));
503+
LogPrint(BCLog::TOR, "AUTHCHALLENGE ServerHash %s ServerNonce %s\n", HexStr(serverHash), HexStr(serverNonce));
504504
if (serverNonce.size() != 32) {
505505
LogPrintf("tor: ServerNonce is not 32 bytes, as required by spec\n");
506506
return;
@@ -547,12 +547,12 @@ void TorController::protocolinfo_cb(TorControlConnection& _conn, const TorContro
547547
std::map<std::string,std::string> m = ParseTorReplyMapping(l.second);
548548
std::map<std::string,std::string>::iterator i;
549549
if ((i = m.find("Tor")) != m.end()) {
550-
LogPrint(BCLog::TOR, "tor: Connected to Tor version %s\n", i->second);
550+
LogPrint(BCLog::TOR, "Connected to Tor version %s\n", i->second);
551551
}
552552
}
553553
}
554554
for (const std::string &s : methods) {
555-
LogPrint(BCLog::TOR, "tor: Supported authentication method: %s\n", s);
555+
LogPrint(BCLog::TOR, "Supported authentication method: %s\n", s);
556556
}
557557
// Prefer NULL, otherwise SAFECOOKIE. If a password is provided, use HASHEDPASSWORD
558558
/* Authentication:
@@ -562,18 +562,18 @@ void TorController::protocolinfo_cb(TorControlConnection& _conn, const TorContro
562562
std::string torpassword = gArgs.GetArg("-torpassword", "");
563563
if (!torpassword.empty()) {
564564
if (methods.count("HASHEDPASSWORD")) {
565-
LogPrint(BCLog::TOR, "tor: Using HASHEDPASSWORD authentication\n");
565+
LogPrint(BCLog::TOR, "Using HASHEDPASSWORD authentication\n");
566566
ReplaceAll(torpassword, "\"", "\\\"");
567567
_conn.Command("AUTHENTICATE \"" + torpassword + "\"", std::bind(&TorController::auth_cb, this, std::placeholders::_1, std::placeholders::_2));
568568
} else {
569569
LogPrintf("tor: Password provided with -torpassword, but HASHEDPASSWORD authentication is not available\n");
570570
}
571571
} else if (methods.count("NULL")) {
572-
LogPrint(BCLog::TOR, "tor: Using NULL authentication\n");
572+
LogPrint(BCLog::TOR, "Using NULL authentication\n");
573573
_conn.Command("AUTHENTICATE", std::bind(&TorController::auth_cb, this, std::placeholders::_1, std::placeholders::_2));
574574
} else if (methods.count("SAFECOOKIE")) {
575575
// Cookie: hexdump -e '32/1 "%02x""\n"' ~/.tor/control_auth_cookie
576-
LogPrint(BCLog::TOR, "tor: Using SAFECOOKIE authentication, reading cookie authentication from %s\n", cookiefile);
576+
LogPrint(BCLog::TOR, "Using SAFECOOKIE authentication, reading cookie authentication from %s\n", cookiefile);
577577
std::pair<bool,std::string> status_cookie = ReadBinaryFile(fs::PathFromString(cookiefile), TOR_COOKIE_SIZE);
578578
if (status_cookie.first && status_cookie.second.size() == TOR_COOKIE_SIZE) {
579579
// _conn.Command("AUTHENTICATE " + HexStr(status_cookie.second), std::bind(&TorController::auth_cb, this, std::placeholders::_1, std::placeholders::_2));
@@ -615,7 +615,7 @@ void TorController::disconnected_cb(TorControlConnection& _conn)
615615
if (!reconnect)
616616
return;
617617

618-
LogPrint(BCLog::TOR, "tor: Not connected to Tor control port %s, trying to reconnect\n", m_tor_control_center);
618+
LogPrint(BCLog::TOR, "Not connected to Tor control port %s, trying to reconnect\n", m_tor_control_center);
619619

620620
// Single-shot timer for reconnect. Use exponential backoff.
621621
struct timeval time = MillisToTimeval(int64_t(reconnect_timeout * 1000.0));

src/zmq/zmqnotificationinterface.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,9 @@ bool CZMQNotificationInterface::Initialize()
7070
{
7171
int major = 0, minor = 0, patch = 0;
7272
zmq_version(&major, &minor, &patch);
73-
LogPrint(BCLog::ZMQ, "zmq: version %d.%d.%d\n", major, minor, patch);
73+
LogPrint(BCLog::ZMQ, "version %d.%d.%d\n", major, minor, patch);
7474

75-
LogPrint(BCLog::ZMQ, "zmq: Initialize notification interface\n");
75+
LogPrint(BCLog::ZMQ, "Initialize notification interface\n");
7676
assert(!pcontext);
7777

7878
pcontext = zmq_ctx_new();
@@ -85,9 +85,9 @@ bool CZMQNotificationInterface::Initialize()
8585

8686
for (auto& notifier : notifiers) {
8787
if (notifier->Initialize(pcontext)) {
88-
LogPrint(BCLog::ZMQ, "zmq: Notifier %s ready (address = %s)\n", notifier->GetType(), notifier->GetAddress());
88+
LogPrint(BCLog::ZMQ, "Notifier %s ready (address = %s)\n", notifier->GetType(), notifier->GetAddress());
8989
} else {
90-
LogPrint(BCLog::ZMQ, "zmq: Notifier %s failed (address = %s)\n", notifier->GetType(), notifier->GetAddress());
90+
LogPrint(BCLog::ZMQ, "Notifier %s failed (address = %s)\n", notifier->GetType(), notifier->GetAddress());
9191
return false;
9292
}
9393
}
@@ -98,11 +98,11 @@ bool CZMQNotificationInterface::Initialize()
9898
// Called during shutdown sequence
9999
void CZMQNotificationInterface::Shutdown()
100100
{
101-
LogPrint(BCLog::ZMQ, "zmq: Shutdown notification interface\n");
101+
LogPrint(BCLog::ZMQ, "Shutdown notification interface\n");
102102
if (pcontext)
103103
{
104104
for (auto& notifier : notifiers) {
105-
LogPrint(BCLog::ZMQ, "zmq: Shutdown notifier %s at %s\n", notifier->GetType(), notifier->GetAddress());
105+
LogPrint(BCLog::ZMQ, "Shutdown notifier %s at %s\n", notifier->GetType(), notifier->GetAddress());
106106
notifier->Shutdown();
107107
}
108108
zmq_ctx_term(pcontext);

src/zmq/zmqpublishnotifier.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ bool CZMQAbstractPublishNotifier::Initialize(void *pcontext)
106106
return false;
107107
}
108108

109-
LogPrint(BCLog::ZMQ, "zmq: Outbound message high water mark for %s at %s is %d\n", type, address, outbound_message_high_water_mark);
109+
LogPrint(BCLog::ZMQ, "Outbound message high water mark for %s at %s is %d\n", type, address, outbound_message_high_water_mark);
110110

111111
int rc = zmq_setsockopt(psocket, ZMQ_SNDHWM, &outbound_message_high_water_mark, sizeof(outbound_message_high_water_mark));
112112
if (rc != 0)
@@ -147,8 +147,8 @@ bool CZMQAbstractPublishNotifier::Initialize(void *pcontext)
147147
}
148148
else
149149
{
150-
LogPrint(BCLog::ZMQ, "zmq: Reusing socket for address %s\n", address);
151-
LogPrint(BCLog::ZMQ, "zmq: Outbound message high water mark for %s at %s is %d\n", type, address, outbound_message_high_water_mark);
150+
LogPrint(BCLog::ZMQ, "Reusing socket for address %s\n", address);
151+
LogPrint(BCLog::ZMQ, "Outbound message high water mark for %s at %s is %d\n", type, address, outbound_message_high_water_mark);
152152

153153
psocket = i->second->psocket;
154154
mapPublishNotifiers.insert(std::make_pair(address, this));
@@ -179,7 +179,7 @@ void CZMQAbstractPublishNotifier::Shutdown()
179179

180180
if (count == 1)
181181
{
182-
LogPrint(BCLog::ZMQ, "zmq: Close socket at address %s\n", address);
182+
LogPrint(BCLog::ZMQ, "Close socket at address %s\n", address);
183183
int linger = 0;
184184
zmq_setsockopt(psocket, ZMQ_LINGER, &linger, sizeof(linger));
185185
zmq_close(psocket);
@@ -208,7 +208,7 @@ bool CZMQAbstractPublishNotifier::SendZmqMessage(const char *command, const void
208208
bool CZMQPublishHashBlockNotifier::NotifyBlock(const CBlockIndex *pindex)
209209
{
210210
uint256 hash = pindex->GetBlockHash();
211-
LogPrint(BCLog::ZMQ, "zmq: Publish hashblock %s to %s\n", hash.GetHex(), this->address);
211+
LogPrint(BCLog::ZMQ, "Publish hashblock %s to %s\n", hash.GetHex(), this->address);
212212
uint8_t data[32];
213213
for (unsigned int i = 0; i < 32; i++) {
214214
data[31 - i] = hash.begin()[i];
@@ -219,7 +219,7 @@ bool CZMQPublishHashBlockNotifier::NotifyBlock(const CBlockIndex *pindex)
219219
bool CZMQPublishHashTransactionNotifier::NotifyTransaction(const CTransaction &transaction)
220220
{
221221
uint256 hash = transaction.GetHash();
222-
LogPrint(BCLog::ZMQ, "zmq: Publish hashtx %s to %s\n", hash.GetHex(), this->address);
222+
LogPrint(BCLog::ZMQ, "Publish hashtx %s to %s\n", hash.GetHex(), this->address);
223223
uint8_t data[32];
224224
for (unsigned int i = 0; i < 32; i++) {
225225
data[31 - i] = hash.begin()[i];
@@ -229,7 +229,7 @@ bool CZMQPublishHashTransactionNotifier::NotifyTransaction(const CTransaction &t
229229

230230
bool CZMQPublishRawBlockNotifier::NotifyBlock(const CBlockIndex *pindex)
231231
{
232-
LogPrint(BCLog::ZMQ, "zmq: Publish rawblock %s to %s\n", pindex->GetBlockHash().GetHex(), this->address);
232+
LogPrint(BCLog::ZMQ, "Publish rawblock %s to %s\n", pindex->GetBlockHash().GetHex(), this->address);
233233

234234
const Consensus::Params& consensusParams = Params().GetConsensus();
235235
CDataStream ss(SER_NETWORK, PROTOCOL_VERSION | RPCSerializationFlags());
@@ -251,7 +251,7 @@ bool CZMQPublishRawBlockNotifier::NotifyBlock(const CBlockIndex *pindex)
251251
bool CZMQPublishRawTransactionNotifier::NotifyTransaction(const CTransaction &transaction)
252252
{
253253
uint256 hash = transaction.GetHash();
254-
LogPrint(BCLog::ZMQ, "zmq: Publish rawtx %s to %s\n", hash.GetHex(), this->address);
254+
LogPrint(BCLog::ZMQ, "Publish rawtx %s to %s\n", hash.GetHex(), this->address);
255255
CDataStream ss(SER_NETWORK, PROTOCOL_VERSION | RPCSerializationFlags());
256256
ss << transaction;
257257
return SendZmqMessage(MSG_RAWTX, &(*ss.begin()), ss.size());
@@ -273,27 +273,27 @@ static bool SendSequenceMsg(CZMQAbstractPublishNotifier& notifier, uint256 hash,
273273
bool CZMQPublishSequenceNotifier::NotifyBlockConnect(const CBlockIndex *pindex)
274274
{
275275
uint256 hash = pindex->GetBlockHash();
276-
LogPrint(BCLog::ZMQ, "zmq: Publish sequence block connect %s to %s\n", hash.GetHex(), this->address);
276+
LogPrint(BCLog::ZMQ, "Publish sequence block connect %s to %s\n", hash.GetHex(), this->address);
277277
return SendSequenceMsg(*this, hash, /* Block (C)onnect */ 'C');
278278
}
279279

280280
bool CZMQPublishSequenceNotifier::NotifyBlockDisconnect(const CBlockIndex *pindex)
281281
{
282282
uint256 hash = pindex->GetBlockHash();
283-
LogPrint(BCLog::ZMQ, "zmq: Publish sequence block disconnect %s to %s\n", hash.GetHex(), this->address);
283+
LogPrint(BCLog::ZMQ, "Publish sequence block disconnect %s to %s\n", hash.GetHex(), this->address);
284284
return SendSequenceMsg(*this, hash, /* Block (D)isconnect */ 'D');
285285
}
286286

287287
bool CZMQPublishSequenceNotifier::NotifyTransactionAcceptance(const CTransaction &transaction, uint64_t mempool_sequence)
288288
{
289289
uint256 hash = transaction.GetHash();
290-
LogPrint(BCLog::ZMQ, "zmq: Publish hashtx mempool acceptance %s to %s\n", hash.GetHex(), this->address);
290+
LogPrint(BCLog::ZMQ, "Publish hashtx mempool acceptance %s to %s\n", hash.GetHex(), this->address);
291291
return SendSequenceMsg(*this, hash, /* Mempool (A)cceptance */ 'A', mempool_sequence);
292292
}
293293

294294
bool CZMQPublishSequenceNotifier::NotifyTransactionRemoval(const CTransaction &transaction, uint64_t mempool_sequence)
295295
{
296296
uint256 hash = transaction.GetHash();
297-
LogPrint(BCLog::ZMQ, "zmq: Publish hashtx mempool removal %s to %s\n", hash.GetHex(), this->address);
297+
LogPrint(BCLog::ZMQ, "Publish hashtx mempool removal %s to %s\n", hash.GetHex(), this->address);
298298
return SendSequenceMsg(*this, hash, /* Mempool (R)emoval */ 'R', mempool_sequence);
299299
}

src/zmq/zmqutil.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@
1212

1313
void zmqError(const std::string& str)
1414
{
15-
LogPrint(BCLog::ZMQ, "zmq: Error: %s, msg: %s\n", str, zmq_strerror(errno));
15+
LogPrint(BCLog::ZMQ, "Error: %s, msg: %s\n", str, zmq_strerror(errno));
1616
}

0 commit comments

Comments
 (0)