Your question is Error Logging in Automation Scripts. Take a moment with it on the right.
Talk me through your thinking if you like. When you're confident, submit your answer and I'll grade it like a real screen (7/10 or better passes).
How would you handle error logging in a script? What would you log, how would you structure it, and how would you make those logs useful for debugging and alerting?