Skip to content

Commit

Permalink
Merge pull request #12 from Australian-Imaging-Service/develop
Browse files Browse the repository at this point in the history
Add debugging log messages
  • Loading branch information
tclose authored Jun 20, 2024
2 parents 25549d6 + d2ab8e5 commit c433f01
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
9 changes: 9 additions & 0 deletions xnat_ingest/cli/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -433,14 +433,23 @@ def iter_staged_sessions():
SessionClass,
ScanClass,
)
logger.debug("Creating scan %s in %s", scan_id, session_path)
xscan = ScanClass(id=scan_id, type=scan_type, parent=xsession)
logger.debug(
"Creating resource %s in %s in %s",
resource_name,
scan_id,
session_path,
)
xresource = xscan.create_resource(resource_name)
if isinstance(scan, File):
for fspath in scan.fspaths:
xresource.upload(str(fspath), fspath.name)
else:
xresource.upload_dir(scan.parent)
logger.debug("retrieving checksums for %s", xresource)
remote_checksums = get_checksums(xresource)
logger.debug("calculating checksums for %s", xresource)
calc_checksums = calculate_checksums(scan)
if remote_checksums != calc_checksums:
mismatching = [
Expand Down
4 changes: 2 additions & 2 deletions xnat_ingest/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,15 +179,15 @@ def set_logger_handling(
if log_file.loglevel:
log_file_hdle.setLevel(getattr(logging, log_file.loglevel.upper()))
log_file_hdle.setFormatter(
logging.Formatter("%(asctime)s - %(levelname)s - %(message)s")
logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s")
)
for logr in loggers:
logr.addHandler(log_file_hdle)

console_hdle = logging.StreamHandler(sys.stdout)
console_hdle.setLevel(getattr(logging, log_level.upper()))
console_hdle.setFormatter(
logging.Formatter("%(asctime)s - %(levelname)s - %(message)s")
logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s")
)
for logr in loggers:
logr.addHandler(console_hdle)
Expand Down

0 comments on commit c433f01

Please sign in to comment.