Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add debugging log messages #12

Merged
merged 3 commits into from
Jun 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading