sweep
sweep copied to clipboard
Improve error logging with loguru in github_utils.py
PR Feedback (click)
- [ ] 👍 Sweep Did Well
- [ ] 👎 Sweep Needs Improvement
I created this PR to address this rule:
"We should use loguru for error logging. If the log is inside an exception, use logger.exception to add tracebacks, where logger is imported from loguru. Use f-strings for string formatting in logger calls (e.g. logger.info(f'Hello {name}') instead of logger.info('Hello {name}', name=name))."
Description
This PR addresses the issue of updating the error logging in sweepai/utils/github_utils.py to conform to our logging standards. The changes include using logger.exception instead of logger.error to log exceptions with tracebacks and adopting f-strings for string formatting in logger calls.
Summary of Changes
- Imported
loggerfromloguruat the top ofgithub_utils.pyto ensure it's available for logging. - Replaced
logger.error(e)withlogger.exception(f"An error occurred: {e}")to log the exception message and traceback. - Replaced
logger.error(response.text)withlogger.exception(f"Failed to get installation id: {response.text}")to log the response text with the exception. - Reviewed the entire
github_utils.pyfile and updated all instances oflogger.errorwithin exception blocks tologger.exception, ensuring the use of f-strings for string formatting.
Rollback Files For Sweep
- [ ] Rollback changes to sweepai/utils/github_utils.py
- [ ] Rollback changes to sweepai/utils/github_utils.py
The latest updates on your projects. Learn more about Vercel for Git ↗︎
| Name | Status | Preview | Comments | Updated (UTC) |
|---|---|---|---|---|
| sweep-docs | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Jan 12, 2024 9:05pm |
Fixing PR: track the progress here.
I'm currently fixing this PR to address the following:
[Sweep GHA Fix] The GitHub Actions run failed with the following error logs:
✨ Created Pull Request: https://github.com/sweepai/sweep/pull/2935