Passing error messages to log file

This commit is contained in:
M madrigal 2025-10-17 09:55:44 -04:00
parent 5cace9c15c
commit 9248549744

View File

@ -91,10 +91,12 @@ def collect_iperf(
if result.returncode != 0:
print(f"Error running iperf3: {result.stderr}")
output = ""
error = result.stderr
except subprocess.TimeoutExpired:
print(f"iPerf test timed out after {timeout} seconds.")
output = ""
error = f"iPerf test timed out after {timeout} seconds."
sender_bitrate, receiver_bitrate = parse_iperf_output(output)
@ -113,7 +115,7 @@ def collect_iperf(
"stations": stations,
}
if output == "":
data["error"] = f"Test exceeded timeout of {timeout}s"
data["error"] = error
else:
print(f"\n{server_ip} {test_type} IPERF complete")
print(f"IPERF sender bitrate: {sender_bitrate}")