From 0a66e1b24cd7d58c919b162b3da871d49cb8aa3b Mon Sep 17 00:00:00 2001 From: Jack Robison Date: Mon, 19 Aug 2019 11:05:26 -0400 Subject: [PATCH] logging --- lbry/lbry/blob_exchange/client.py | 4 +++- lbry/lbry/blob_exchange/server.py | 2 +- lbry/lbry/dht/node.py | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lbry/lbry/blob_exchange/client.py b/lbry/lbry/blob_exchange/client.py index 8009a672f..c4c8bde30 100644 --- a/lbry/lbry/blob_exchange/client.py +++ b/lbry/lbry/blob_exchange/client.py @@ -154,7 +154,9 @@ class BlobExchangeClientProtocol(asyncio.Protocol): log.info(msg) msg = f"downloaded {self.blob.blob_hash[:8]} from {self.peer_address}:{self.peer_port}" await asyncio.wait_for(self.writer.finished, self.peer_timeout, loop=self.loop) - log.info(msg + f" at {round((float(self._blob_bytes_received) / float(time.perf_counter() - start_time)) / 1000000.0, 2)}MB/s") + log.info("%s at %fMB/s", msg, + round((float(self._blob_bytes_received) / + float(time.perf_counter() - start_time)) / 1000000.0, 2)) # await self.blob.finished_writing.wait() not necessary, but a dangerous change. TODO: is it needed? return self._blob_bytes_received, self except asyncio.TimeoutError: diff --git a/lbry/lbry/blob_exchange/server.py b/lbry/lbry/blob_exchange/server.py index 93867e2e7..eeabe538e 100644 --- a/lbry/lbry/blob_exchange/server.py +++ b/lbry/lbry/blob_exchange/server.py @@ -102,7 +102,7 @@ class BlobServerProtocol(asyncio.Protocol): try: sent = await asyncio.wait_for(blob.sendfile(self), self.transfer_timeout, loop=self.loop) self.blob_manager.connection_manager.sent_data(self.peer_address_and_port, sent) - log.debug("sent %s (%i bytes) to %s:%i", bh, sent, peer_address, peer_port) + log.info("sent %s (%i bytes) to %s:%i", bh, sent, peer_address, peer_port) except (ConnectionResetError, BrokenPipeError, RuntimeError, OSError, asyncio.TimeoutError) as err: if isinstance(err, asyncio.TimeoutError): log.debug("timed out sending blob %s to %s", bh, peer_address) diff --git a/lbry/lbry/dht/node.py b/lbry/lbry/dht/node.py index 01a4f9d66..625db46b5 100644 --- a/lbry/lbry/dht/node.py +++ b/lbry/lbry/dht/node.py @@ -235,7 +235,7 @@ class Node: peer.update_udp_port(udp_port_to_try) self.loop.create_task(ping(peer)) else: - log.debug("skip bad peer %s:%i for %s", blob_hash) + log.debug("skip bad peer %s:%i for %s", peer.address, peer.tcp_port, blob_hash) if to_put: result_queue.put_nowait(to_put)