added: logs

This commit is contained in:
lla-dane
2025-05-24 00:30:19 +05:30
committed by varun-r-mallya
parent b3137aa159
commit e868f77f93
5 changed files with 78 additions and 8 deletions

View File

@ -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()