Island: Remove unnecesary logging from LocalStorageFileRepository
Most logging is now handled by FileRepositoryLoggingDecorator, which makes the logging reusable across different implementations of `IFileRepository`.
This commit is contained in:
parent
a329177b49
commit
6cc3689ab4
|
@ -36,7 +36,6 @@ class LocalStorageFileRepository(IFileRepository):
|
||||||
try:
|
try:
|
||||||
safe_file_path = self._get_safe_file_path(unsafe_file_name)
|
safe_file_path = self._get_safe_file_path(unsafe_file_name)
|
||||||
|
|
||||||
logger.debug(f"Saving file contents to {safe_file_path}")
|
|
||||||
with open(safe_file_path, "wb") as dest:
|
with open(safe_file_path, "wb") as dest:
|
||||||
shutil.copyfileobj(file_contents, dest)
|
shutil.copyfileobj(file_contents, dest)
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
|
@ -45,8 +44,6 @@ class LocalStorageFileRepository(IFileRepository):
|
||||||
def open_file(self, unsafe_file_name: str) -> BinaryIO:
|
def open_file(self, unsafe_file_name: str) -> BinaryIO:
|
||||||
try:
|
try:
|
||||||
safe_file_path = self._get_safe_file_path(unsafe_file_name)
|
safe_file_path = self._get_safe_file_path(unsafe_file_name)
|
||||||
|
|
||||||
logger.debug(f"Opening {safe_file_path}")
|
|
||||||
return open(safe_file_path, "rb")
|
return open(safe_file_path, "rb")
|
||||||
except FileNotFoundError as err:
|
except FileNotFoundError as err:
|
||||||
# Wrap Python's FileNotFound error, which is-an OSError, in repository.FileNotFoundError
|
# Wrap Python's FileNotFound error, which is-an OSError, in repository.FileNotFoundError
|
||||||
|
@ -61,8 +58,6 @@ class LocalStorageFileRepository(IFileRepository):
|
||||||
def delete_file(self, unsafe_file_name: str):
|
def delete_file(self, unsafe_file_name: str):
|
||||||
try:
|
try:
|
||||||
safe_file_path = self._get_safe_file_path(unsafe_file_name)
|
safe_file_path = self._get_safe_file_path(unsafe_file_name)
|
||||||
|
|
||||||
logger.debug(f"Deleting {safe_file_path}")
|
|
||||||
safe_file_path.unlink()
|
safe_file_path.unlink()
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
# This method is idempotent.
|
# This method is idempotent.
|
||||||
|
|
Loading…
Reference in New Issue