The log is your map: green lines mean success and a red line shows the exact command that failed. I read a real pipeline log and print success or failure for each line.
def read_log(log):
ok_words = ["done", "passed", "Deployed"]
for line in log:
status = "success" if any(w in line for w in ok_words) else "FAIL"
print(f"{status}: {line.strip()}")
log = [
"[install] npm install ... done (12s)",
"[test] pytest ... 140 passed (3s)",
"[build] npm run build ... done",
"[deploy] Deployed to test server ✅",
"[lint] flake8 ... FAIL: 2 errors found",
]
read_log(log)
Before you run it, say out loud what it will print. Then open the answer.
What it prints
success: [install] npm install ... done (12s)
success: [test] pytest ... 140 passed (3s)
success: [build] npm run build ... done
success: [deploy] Deployed to test server ✅
FAIL: [lint] flake8 ... FAIL: 2 errors found
A red line shows the exact command that failed, so you know where to look instead of guessing.