Extracted functions log_report and discover_affected_files.