upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/src/util.cpp
diff options
context:
space:
mode:
authorbitflash-maintainer <noreply@bitflash.invalid>2026-09-02 05:31:22 +0000
committerbitflash-maintainer <noreply@bitflash.invalid>2026-09-02 05:31:22 +0000
commit2661de141e46dadfb2903bb12e72dc87c5a64375 (patch)
tree73f5492187a1da4b362463834983ad767f105306 /src/util.cpp
parentae1c6a7b49d9b4f8cf7218c0baec84f348eb5ef6 (diff)
log: demote the four lines that were 90% of debug.log behind /debugrelay
A 13-hour production capture was ~71% "sending: tx", ~16% "Nostr: discovered .btf peer", ~5% "Relaying wtx", and ~43% of raw lines were CBlock/CTransaction dumps -- all already under -debug, which operators run permanently, so -debug was useless as a filter. The category mechanism gains a verbose tier: "relay" and "nostrdiscovery" are accepted only with the new /debugrelay flag (which implies /debug); everything else keeps its current gate. Demoted, with message text unchanged for anyone grepping it: net.h "sending: tx (N bytes)" (BeginMessage/EndMessage/ AbortMessage all pick the category from the command, so no orphaned "(N bytes)" fragments leak into a plain -debug log) main.cpp "Relaying wtx", "received block:" + CBlock::print, and the BitcoinMiner block dump nostr.cpp "Nostr: discovered .btf peer" -> "nostrdiscovery" Pool/worker/payout, [payout], BLOCK ORPHANED/ACCEPTED and share flow lines are untouched. Because LogPrint dedup keys on category, demoted lines also keep their burst collapse under /debugrelay. Closes #35
Diffstat (limited to 'src/util.cpp')
-rw-r--r--src/util.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/util.cpp b/src/util.cpp
index 52cda84..a5a4e80 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -7,6 +7,7 @@
7 7
8 8
9bool fDebug = false; 9bool fDebug = false;
10bool fDebugRelay = false;
10 11
11// In-process cap for debug.log, in bytes. Default matches the 1G trigger of 12// In-process cap for debug.log, in bytes. Default matches the 1G trigger of
12// the shipped logrotate policy so a long-running node stays bounded even 13// the shipped logrotate policy so a long-running node stays bounded even
@@ -31,10 +32,22 @@ static bool LogCategoryDefaultOn(const char* category)
31 strcmp(category, "payout") == 0; 32 strcmp(category, "payout") == 0;
32} 33}
33 34
35// Categories so noisy they drown out everything else even under -debug:
36// per-message send traces, wallet relay rebroadcasts, raw CBlock dumps and
37// per-address discovery lines made up ~90% of a 13-hour production capture
38// (issue #35). They need /debugrelay, not merely /debug.
39static bool LogCategoryVerboseOnly(const char* category)
40{
41 return strcmp(category, "relay") == 0 ||
42 strcmp(category, "nostrdiscovery") == 0;
43}
44
34bool LogAcceptsCategory(const char* category) 45bool LogAcceptsCategory(const char* category)
35{ 46{
36 if (LogCategoryDefaultOn(category)) 47 if (LogCategoryDefaultOn(category))
37 return true; 48 return true;
49 if (LogCategoryVerboseOnly(category))
50 return fDebugRelay;
38 return fDebug; 51 return fDebug;
39} 52}
40 53