Skip to content

Commit

Permalink
adding s3 logs in client (#1875)
Browse files Browse the repository at this point in the history
* adding debug logs for rows and search - s3

* fix error

* add more logs for s3 client
  • Loading branch information
AndreaFrancis authored Sep 27, 2023
1 parent 0e2a174 commit e43aa8a
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions libs/libcommon/src/libcommon/s3_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,22 @@ def __init__(
self, region_name: str, aws_access_key_id: Optional[str] = None, aws_secret_access_key: Optional[str] = None
) -> None:
try:
logging.debug(
f"init s3 client with {region_name=} aws_access_key_id exists: {aws_access_key_id is not None} -"
f" aws_secret_access_key exists: {aws_secret_access_key is not None} "
)
self._client = boto3.client(
S3_RESOURCE,
region_name=region_name,
aws_access_key_id=aws_access_key_id,
aws_secret_access_key=aws_secret_access_key,
)
# no needed, just helps verify client has been configured correctly
logging.debug("trying to list buckets to verify configuration")
self._client.list_buckets()
logging.info("client was configured/initialized correctly")
except Exception:
logging.error("client was not configured/initialized correctly")
except Exception as e:
logging.error(f"client was not configured/initialized correctly {e}")
self._client = None

def is_available(self) -> bool:
Expand Down

0 comments on commit e43aa8a

Please sign in to comment.