Skip to content

Conversation

@suhaibmujahid
Copy link
Member

This will allow filtering logs based on the rule name.

Checklist

  • Type annotations added to new functions
  • Docs added to functions touched in main classes
  • Dry-run produced the expected results
  • The to-be-announced tag added if this is worth announcing

@suhaibmujahid suhaibmujahid requested a review from Copilot October 29, 2025 18:48
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the logger initialization to support adding extra context (specifically the rule name) to log messages. The logger is now created as a LoggerAdapter that can carry contextual information about which bugbot rule is executing.

Key changes:

  • Refactored logger initialization into a create_logger() function that returns a LoggerAdapter
  • Introduced a logger_extra dictionary to store contextual information (bugbot rule name)
  • Modified the BzCleaner.run() method to set the rule name in the logger extra context

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
bugbot/init.py Refactored logger initialization into create_logger() function and introduced logger_extra dictionary for contextual logging
bugbot/bzcleaner.py Added import for bugbot module and set bugbot_rule in logger context at rule execution start

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@suhaibmujahid suhaibmujahid requested a review from marco-c October 29, 2025 18:58
@suhaibmujahid suhaibmujahid merged commit 4d9ff09 into mozilla:master Oct 29, 2025
2 checks passed
@suhaibmujahid suhaibmujahid deleted the log-rule-name branch October 29, 2025 19:22
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.

2 participants