From 68e75707e455af055fa454ad370ab6b2299701c0 Mon Sep 17 00:00:00 2001 From: Alex Stokes Date: Tue, 10 Sep 2019 16:03:24 -0400 Subject: [PATCH] Enhance logs --- libp2p/pubsub/pubsub.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/libp2p/pubsub/pubsub.py b/libp2p/pubsub/pubsub.py index 5c0466cd..90fa63cd 100644 --- a/libp2p/pubsub/pubsub.py +++ b/libp2p/pubsub/pubsub.py @@ -13,6 +13,7 @@ from typing import ( cast, ) +import base58 from lru import LRU from libp2p.exceptions import ValidationError @@ -414,14 +415,19 @@ class Pubsub: # Validate the signature of the message # FIXME: `signature_validator` is currently a stub. if not signature_validator(msg.key, msg.SerializeToString()): - log.debug(f"Signature validation failed for msg={msg}") + log.debug("Signature validation failed for msg: %s", msg) return # Validate the message with registered topic validators. # If the validation failed, return(i.e., don't further process the message). try: await self.validate_msg(msg_forwarder, msg) except ValidationError: - log.debug(f"Topic validation failed for msg={msg}") + log.debug( + "Topic validation failed: sender %s sent data %s under topic IDs: %s", + f"{base58.b58encode(msg.from_id).decode()}:{msg.seqno.hex()}", + msg.data, + msg.topicIDs, + ) return self._mark_msg_seen(msg)