mirror of
https://github.com/varun-r-mallya/py-libp2p.git
synced 2025-12-31 20:36:24 +00:00
added: logs
This commit is contained in:
@ -5,7 +5,6 @@ from collections.abc import (
|
||||
from contextlib import (
|
||||
asynccontextmanager,
|
||||
)
|
||||
import logging
|
||||
from typing import (
|
||||
TYPE_CHECKING,
|
||||
Optional,
|
||||
@ -68,7 +67,10 @@ if TYPE_CHECKING:
|
||||
# telling it to listen on the given listen addresses.
|
||||
|
||||
|
||||
logger = logging.getLogger("libp2p.network.basic_host")
|
||||
# logger = logging.getLogger("libp2p.network.basic_host")
|
||||
from loguru import (
|
||||
logger,
|
||||
)
|
||||
|
||||
|
||||
class BasicHost(IHost):
|
||||
@ -181,12 +183,15 @@ class BasicHost(IHost):
|
||||
:return: stream: new stream created
|
||||
"""
|
||||
net_stream = await self._network.new_stream(peer_id)
|
||||
|
||||
logger.info("INETSTREAM CHECKING IN")
|
||||
logger.info(protocol_ids)
|
||||
# Perform protocol muxing to determine protocol to use
|
||||
try:
|
||||
logger.debug("PROTOCOLS TRYING TO GET SENT")
|
||||
selected_protocol = await self.multiselect_client.select_one_of(
|
||||
list(protocol_ids), MultiselectCommunicator(net_stream)
|
||||
)
|
||||
logger.info("PROTOCOLS GOT SENT")
|
||||
except MultiselectClientError as error:
|
||||
logger.debug("fail to open a stream to peer %s, error=%s", peer_id, error)
|
||||
await net_stream.reset()
|
||||
|
||||
Reference in New Issue
Block a user