sweep icon indicating copy to clipboard operation
sweep copied to clipboard

Improve error logging with loguru in github_utils.py

Open sweep-nightly[bot] opened this issue 1 year ago • 3 comments

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 logger from loguru at the top of github_utils.py to ensure it's available for logging.
  • Replaced logger.error(e) with logger.exception(f"An error occurred: {e}") to log the exception message and traceback.
  • Replaced logger.error(response.text) with logger.exception(f"Failed to get installation id: {response.text}") to log the response text with the exception.
  • Reviewed the entire github_utils.py file and updated all instances of logger.error within exception blocks to logger.exception, ensuring the use of f-strings for string formatting.

sweep-nightly[bot] avatar Jan 12 '24 21:01 sweep-nightly[bot]

Rollback Files For Sweep

  • [ ] Rollback changes to sweepai/utils/github_utils.py
  • [ ] Rollback changes to sweepai/utils/github_utils.py

sweep-nightly[bot] avatar Jan 12 '24 21:01 sweep-nightly[bot]

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

vercel[bot] avatar Jan 12 '24 21:01 vercel[bot]

Sweeping

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

sweep-nightly[bot] avatar Jan 12 '24 21:01 sweep-nightly[bot]