Skip to content

Feature logging enhancement #333

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

nunster3000
Copy link

Title:

🚀 Enhanced Logging and Error Handling in Color_Game/main.py

Description:

This pull request improves the Color Game project by implementing structured logging and error handling in main.py. These enhancements provide better debugging, increase maintainability, and prevent unexpected crashes due to missing files or invalid input.

🔹 Key Enhancements:
✅ Added a Logging System (app.log)

Logs important execution steps (INFO).
Captures and records errors (ERROR) for debugging.
✅ Improved Error Handling:

Prevents crashes when files are missing (FileNotFoundError).
Handles empty or invalid data gracefully (ValueError).
✅ Created a Default Sample File (sample.txt)

Ensures the script has a valid file to read.
🔹 Why This Improvement?
Before: If sample.txt was missing, the script crashed without clear feedback.
Now: The script logs errors instead of crashing and provides meaningful messages.
🔹 Code Changes:
Modified Color_Game/main.py to:

Use Python’s logging module to track execution.
Log errors when files are missing or invalid.
Write logs to app.log for future debugging.

Checklist:

Please tick all the boxes that are fulfilled by your Pull Request.

  • I have named my files and folder, according to this project's guidelines.
  • My code follows the style guidelines of this project.
  • I have commented on my code, particularly in hard-to-understand areas.
  • I have created a helpful and easy to understand README.md, according to the given README_TEMPLATE.
  • My changes do not produce any warnings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant