Websites, apps & code / Coding & debugging
Make your program leave a log when it fails
Your program runs overnight, fails, and in the morning you have no idea what went wrong.
1Fill in your details
Leave blank to use the example. Names are remembered for other prompts too (stored only on your device).
3Copy the prompt
My program runs unattended and when it fails I have no idea. Please help me add logging. My program now: A Python script running nightly at 11pm that reads a CSV, calculates and emails the result, with no prints at all What I want to know: When it ran, how many rows it read, where it failed and why How I read the log: Write to a daily log file and delete ones older than 30 days automatically. Please: 1. Use Python's built-in logging with no extra packages. 2. Explain the log levels (info, warning, error) and when to use each. 3. Add a log line at the file reading, calculating and emailing steps, writing the full error reason when something fails. 4. The log must never contain passwords, customer phone numbers or full email bodies; explain how to avoid that. 5. Teach me how to read the log to find the problem. Give me the complete program with logging added and mark the new parts. [Make it sound human] - Explain in plain words; no pleasantry openers or empty summaries. - Only necessary, short, practical code comments; the simplest working approach, no over-engineering. - Interface text (buttons, hints, error messages) should sound like a person wrote it; no "seamless", "empower", "unlock". [Quality] Code must run as is and handle common errors; tell me how to test it and confirm it works; ask first if a requirement is unclear; never put passwords or API keys in the code.
Paste it into ChatGPT, Gemini, Claude or Meta AI.
Test result
AI tools that suit this
- Claude Suggested tool Free plan
Strong at long documents, editing and code
- ChatGPT Suggested tool Free plan
The most widely used AI chat, for writing, questions and images
- Gemini Suggested tool Free plan
Google's AI; generates and edits images, works with Gmail and Docs
Recommendations only, not sponsored. Check each site for what the free plan includes.
This site is made by FullMark Tech
Want your own website, or your shop spreadsheets automated? FullMark Tech builds business websites and custom Excel tools.