Skip to content

Commit 88799ea

Browse files
author
MarcoFalke
committed
Merge #10124: [test] Suppress test logging spam
45ce471 Reduce spammy test logging (John Newbery) Tree-SHA512: 64b2ce29fb62a4e738840bbaf93563559451c2ef078ba66ecfc1dbe34adefea61ad2ad2d768444cb2e0b30cb3cbe47e38ed818d4c91f7723a3d1ba9fdd0043f9
2 parents df1ca9e + 45ce471 commit 88799ea

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

test/functional/test_framework/mininode.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1749,7 +1749,7 @@ def got_data(self):
17491749
def send_message(self, message, pushbuf=False):
17501750
if self.state != "connected" and not pushbuf:
17511751
raise IOError('Not connected, no pushbuf')
1752-
logger.debug("Send message to %s:%d: %s" % (self.dstaddr, self.dstport, repr(message)))
1752+
self._log_message("send", message)
17531753
command = message.command
17541754
data = message.serialize()
17551755
tmsg = self.MAGIC_BYTES[self.network]
@@ -1771,9 +1771,19 @@ def got_message(self, message):
17711771
self.messagemap[b'ping'] = msg_ping_prebip31
17721772
if self.last_sent + 30 * 60 < time.time():
17731773
self.send_message(self.messagemap[b'ping']())
1774-
logger.debug("Received message from %s:%d: %s" % (self.dstaddr, self.dstport, repr(message)))
1774+
self._log_message("receive", message)
17751775
self.cb.deliver(self, message)
17761776

1777+
def _log_message(self, direction, msg):
1778+
if direction == "send":
1779+
log_message = "Send message to "
1780+
elif direction == "receive":
1781+
log_message = "Received message from "
1782+
log_message += "%s:%d: %s" % (self.dstaddr, self.dstport, repr(msg)[:500])
1783+
if len(log_message) > 500:
1784+
log_message += "... (msg truncated)"
1785+
logger.debug(log_message)
1786+
17771787
def disconnect_node(self):
17781788
self.disconnect = True
17791789

test/functional/test_framework/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ def start_node(i, dirname, extra_args=None, rpchost=None, timewait=None, binary=
315315
datadir = os.path.join(dirname, "node"+str(i))
316316
if binary is None:
317317
binary = os.getenv("BITCOIND", "bitcoind")
318-
args = [ binary, "-datadir="+datadir, "-server", "-keypool=1", "-discover=0", "-rest", "-logtimemicros", "-debug", "-mocktime="+str(get_mocktime()) ]
318+
args = [binary, "-datadir=" + datadir, "-server", "-keypool=1", "-discover=0", "-rest", "-logtimemicros", "-debug", "-debugexclude=libevent", "-debugexclude=leveldb", "-mocktime=" + str(get_mocktime())]
319319
if extra_args is not None: args.extend(extra_args)
320320
bitcoind_processes[i] = subprocess.Popen(args, stderr=stderr)
321321
logger.debug("initialize_chain: bitcoind started, waiting for RPC to come up")

0 commit comments

Comments
 (0)