Write a script that hits multiple REST endpoints and logs the errors.
Asked in the Coding test stage.
For deterministic grading, implement the error-processing portion using endpoint results produced by a mocked REST client. Each result is a dictionary with url, status, and optional error. Return one structured record for every failed request, where failures include HTTP status codes >= 400 and requests with a non-empty error. Also log each returned record with Python's logging module.
Implement log_endpoint_errors(results). Return records containing url, status, and error, preserving input order. Successful responses produce no record.
def log_endpoint_errors(results):