From 544471d07ce1949f1cc79ec2871019de199a6d23 Mon Sep 17 00:00:00 2001 From: Evgeny Gusarov <123374581+evgeny-stakewise@users.noreply.github.com> Date: Mon, 16 Oct 2023 17:35:39 +0300 Subject: [PATCH] Change ipfs log level (#68) * Decrease log level * Bump version 0.3.28 --- pyproject.toml | 2 +- sw_utils/consensus.py | 4 ++-- sw_utils/execution.py | 4 ++-- sw_utils/ipfs.py | 8 ++++---- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index f29d9ed..3ce69dc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "sw-utils" -version = "0.3.27" +version = "0.3.28" description = "StakeWise Python utils" authors = ["StakeWise Labs "] license = "GPL-3.0-or-later" diff --git a/sw_utils/consensus.py b/sw_utils/consensus.py index 23a4fa3..b2c48d9 100644 --- a/sw_utils/consensus.py +++ b/sw_utils/consensus.py @@ -100,7 +100,7 @@ async def submit_voluntary_exit( if i == len(self.base_urls) - 1: raise error - logger.error('%s: %s', url, repr(error)) + logger.warning('%s: %s', url, repr(error)) async def get_chain_finalized_head(self, slots_per_epoch: int) -> ChainHead: """Fetches the fork safe chain head.""" @@ -172,7 +172,7 @@ async def _async_make_get_request_inner(self, endpoint_uri: str) -> dict[str, An if i == len(self.base_urls) - 1: raise error - logger.error('%s: %s', url, repr(error)) + logger.warning('%s: %s', url, repr(error)) return {} diff --git a/sw_utils/execution.py b/sw_utils/execution.py index a929702..abaae43 100644 --- a/sw_utils/execution.py +++ b/sw_utils/execution.py @@ -89,7 +89,7 @@ async def make_request_inner(self, method: RPCEndpoint, params: Any) -> RPCRespo if i == len(self._providers) - 1: raise error - logger.error('%s: %s', provider.endpoint_uri, repr(error)) + logger.warning('%s: %s', provider.endpoint_uri, repr(error)) return {} @@ -121,5 +121,5 @@ def get_execution_client( if is_poa: client.middleware_onion.inject(async_geth_poa_middleware, layer=0) - logger.info('Injected POA middleware') + logger.debug('Injected POA middleware') return client diff --git a/sw_utils/ipfs.py b/sw_utils/ipfs.py index 3ddf26b..9625abe 100644 --- a/sw_utils/ipfs.py +++ b/sw_utils/ipfs.py @@ -212,7 +212,7 @@ async def _upload(self, coros: list) -> str: ipfs_hashes: dict[str, int] = {} for value in result: if isinstance(value, BaseException): - logger.error(repr(value)) + logger.warning(repr(value)) continue ipfs_hash = _strip_ipfs_prefix(value) @@ -239,7 +239,7 @@ async def remove(self, ipfs_hash: str) -> None: ) for value in result: if isinstance(value, BaseException): - logger.error(repr(value)) + logger.warning(repr(value)) continue return None @@ -265,7 +265,7 @@ async def fetch_bytes(self, ipfs_hash: str) -> bytes: return self._ipfs_fetch_bytes(endpoint, ipfs_hash) except Exception as e: - logger.error(repr(e)) + logger.warning(repr(e)) raise IpfsException(f'Failed to fetch IPFS data at {ipfs_hash}') @@ -294,7 +294,7 @@ async def fetch_json(self, ipfs_hash: str) -> Any: return self._ipfs_fetch_json(endpoint, ipfs_hash) except Exception as e: - logger.error(repr(e)) + logger.warning(repr(e)) raise IpfsException(f'Failed to fetch IPFS data at {ipfs_hash}')