From 93648c93e7bbb71fccc74e092c9b4c49bfd20cca Mon Sep 17 00:00:00 2001 From: yanghua Date: Wed, 21 Aug 2024 11:49:16 +0800 Subject: [PATCH] Core: Clean unnecessary logs --- tosfs/core.py | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/tosfs/core.py b/tosfs/core.py index 1f88370..a7f6974 100644 --- a/tosfs/core.py +++ b/tosfs/core.py @@ -314,16 +314,13 @@ def _bucket_info(self, bucket: str) -> dict: self.tos_client.head_bucket(bucket) return self._fill_bucket_info(bucket) except tos.exceptions.TosClientError as e: - logger.error("Tosfs failed with client error: %s", e) raise e except tos.exceptions.TosServerError as e: if e.status_code == SERVER_RESPONSE_CODE_NOT_FOUND: raise FileNotFoundError(bucket) from e else: - logger.error("Tosfs failed with server error: %s", e) raise e except Exception as e: - logger.error("Tosfs failed with unknown error: %s", e) raise TosfsError(f"Tosfs failed with unknown error: {e}") from e def _object_info( @@ -376,16 +373,13 @@ def _object_info( "ContentType": out.content_type or "", } except tos.exceptions.TosClientError as e: - logger.error("Tosfs failed with client error: %s", e) raise e except tos.exceptions.TosServerError as e: if e.status_code == SERVER_RESPONSE_CODE_NOT_FOUND: pass else: - logger.error("Tosfs failed with server error: %s", e) raise e except Exception as e: - logger.error("Tosfs failed with unknown error: %s", e) raise TosfsError(f"Tosfs failed with unknown error: {e}") from e return {} @@ -411,15 +405,12 @@ def _try_dir_info(self, bucket: str, key: str, path: str, fullpath: str) -> dict raise FileNotFoundError(path) except tos.exceptions.TosClientError as e: - logger.error("Tosfs failed with client error: %s", e) raise e except tos.exceptions.TosServerError as e: - logger.error("Tosfs failed with server error: %s", e) raise e except FileNotFoundError as e: raise e except Exception as e: - logger.error("Tosfs failed with unknown error: %s", e) raise TosfsError(f"Tosfs failed with unknown error: {e}") from e def _lsbuckets(self, refresh: bool = False) -> List[dict]: @@ -456,13 +447,10 @@ def _lsbuckets(self, refresh: bool = False) -> List[dict]: try: resp = self.tos_client.list_buckets() except tos.exceptions.TosClientError as e: - logger.error("Tosfs failed with client error: %s", e) raise e except tos.exceptions.TosServerError as e: - logger.error("Tosfs failed with server error: %s", e) raise e except Exception as e: - logger.error("Tosfs failed with unknown error: %s", e) raise TosfsError(f"Tosfs failed with unknown error: {e}") from e buckets = [self._fill_bucket_info(bucket.name) for bucket in resp.buckets] @@ -631,17 +619,10 @@ def _listdir( return all_results except tos.exceptions.TosClientError as e: - logger.error( - "Tosfs failed with client error, message:%s, cause: %s", - e.message, - e.cause, - ) raise e except tos.exceptions.TosServerError as e: - logger.error("Tosfs failed with server error: %s", e) raise e except Exception as e: - logger.error("Tosfs failed with unknown error: %s", e) raise TosfsError(f"Tosfs failed with unknown error: {e}") from e def _rm(self, path: str) -> None: @@ -651,13 +632,10 @@ def _rm(self, path: str) -> None: try: self.tos_client.delete_object(bucket, key) except tos.exceptions.TosClientError as e: - logger.error("Tosfs failed with client error: %s", e) raise e except tos.exceptions.TosServerError as e: - logger.error("Tosfs failed with server error: %s", e) raise e except Exception as e: - logger.error("Tosfs failed with unknown error: %s", e) raise TosfsError(f"Tosfs failed with unknown error: {e}") from e def _split_path(self, path: str) -> Tuple[str, str, Optional[str]]: