mirror of
https://github.com/varun-r-mallya/py-libp2p.git
synced 2026-02-12 16:10:57 +00:00
Add some loggings to pubsub
This commit is contained in:
@ -1,3 +1,4 @@
|
||||
import logging
|
||||
from typing import Iterable, List, Sequence
|
||||
|
||||
from libp2p.peer.id import ID
|
||||
@ -10,6 +11,9 @@ from .pubsub_router_interface import IPubsubRouter
|
||||
|
||||
PROTOCOL_ID = TProtocol("/floodsub/1.0.0")
|
||||
|
||||
logger = logging.getLogger("libp2p.pubsub.floodsub")
|
||||
logger.setLevel(logging.DEBUG)
|
||||
|
||||
|
||||
class FloodSub(IPubsubRouter):
|
||||
|
||||
@ -75,6 +79,9 @@ class FloodSub(IPubsubRouter):
|
||||
origin=ID(pubsub_msg.from_id),
|
||||
)
|
||||
rpc_msg = rpc_pb2.RPC(publish=[pubsub_msg])
|
||||
|
||||
logger.debug("publishing message %s", pubsub_msg)
|
||||
|
||||
for peer_id in peers_gen:
|
||||
stream = self.pubsub.peers[peer_id]
|
||||
# FIXME: We should add a `WriteMsg` similar to write delimited messages.
|
||||
|
||||
Reference in New Issue
Block a user