diff --git a/chord_drs/models.py b/chord_drs/models.py index 11f66dc..903c248 100644 --- a/chord_drs/models.py +++ b/chord_drs/models.py @@ -69,6 +69,8 @@ class DrsBlob(db.Model, DrsMixin): location = db.Column(db.String(500), nullable=False) def __init__(self, *args, **kwargs): + logger = current_app.logger + # If set, we are deduplicating with an existing file object object_to_copy: DrsBlob | None = kwargs.get("object_to_copy") @@ -104,10 +106,12 @@ def __init__(self, *args, **kwargs): self.size = os.path.getsize(p) self.checksum = drs_file_checksum(location) except Exception as e: - current_app.logger.error(f"Encountered exception during DRS object creation: {e}") + logger.error(f"Encountered exception during DRS object creation: {e}") # TODO: implement more specific exception handling raise Exception("Well if the file is not saved... we can't do squat") + logger.info(f"Creating new DRS object: name={self.name}; size={self.size}; sha256={self.checksum}") + for key_to_remove in ("location", "filename"): if key_to_remove in kwargs: del kwargs[key_to_remove] diff --git a/chord_drs/routes.py b/chord_drs/routes.py index e223c44..a1be118 100644 --- a/chord_drs/routes.py +++ b/chord_drs/routes.py @@ -475,6 +475,7 @@ def object_ingest(): try: filename: str | None = None # no override, use path filename if path is specified instead of a file upload if file is not None: + logger.debug(f"ingest - recieved file object: {file}") file.save(t_obj_path) obj_path = t_obj_path filename = file.filename # still may be none, in which case the temporary filename will be used