Migrate console to coreEvents.emitFeedback or debugLogger
Summary
As title suggests, also added a no-console rule to eslint to prevent usage of console.* unless there's a valid reason.
There were also other console.* statements picked up by my rule that wasn't a sub issue, I used my best judgement + Gemini CLI to figure out whether it should be kept or be a user/non-user facing error
Details
Related Issues
Closes all the sub-issues in #10761 except migrating CLI appEvents to Core coreEvents
Closes #11838 Closes #11841 Closes #11852 Closes #11854 Closes #11862 Closes #11872 Closes #11876 Closes #11880 Closes #11883 Closes #11884 Closes #11885 Closes #11887 Closes #11891 Closes #11897 Closes #11898 Closes #11899 Closes #11901 Closes #11906
How to Validate
Pre-Merge Checklist
- [ ] Updated relevant documentation and README (if needed)
- [ ] Added/updated tests (if needed)
- [ ] Noted breaking changes (if any)
- [ ] Validated on required platforms/methods:
- [ ] MacOS
- [X] npm run
- [ ] npx
- [ ] Docker
- [ ] Podman
- [ ] Seatbelt
- [ ] Windows
- [ ] npm run
- [ ] npx
- [ ] Docker
- [ ] Linux
- [ ] npm run
- [ ] npx
- [ ] Docker
- [ ] MacOS
Summary of Changes
Hello @Adib234, I'm Gemini Code Assist[^1]! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
This pull request undertakes a significant refactoring effort to centralize and standardize how the application handles logging and error reporting. By replacing direct console.* calls with dedicated coreEvents.emitFeedback and debugLogger utilities, the change aims to provide a more structured approach to output, allowing for better control over what information is presented to the user versus what is logged internally for debugging. This also lays the groundwork for more robust telemetry and feedback mechanisms.
Highlights
-
Standardized Logging: Migrated most direct
console.*calls across the codebase to eithercoreEvents.emitFeedbackfor user-facing messages ordebugLoggerfor internal debugging and warnings, improving error handling and output control. -
ESLint Rule Enforcement: Introduced a new
no-consoleESLint rule to prevent future direct usage ofconsole.*methods, ensuring adherence to the new standardized logging practices. -
Improved Error Reporting: Enhanced the error reporting mechanism to use
coreEvents.emitFeedbackfor user notifications when error reports are generated or fail to write, providing more consistent user feedback.
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.
| Feature | Command | Description |
|---|---|---|
| Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
| Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
| Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in pull request comments and review comments. |
| Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with :thumbsup: and :thumbsdown: on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
[^1]: Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.
Size Change: +1.36 kB (+0.01%)
Total Size: 22.1 MB
| Filename | Size | Change |
|---|---|---|
./bundle/gemini.js |
22 MB | +1.36 kB (+0.01%) |
ℹ️ View Unchanged
| Filename | Size |
|---|---|
./bundle/sandbox-macos-permissive-closed.sb |
1.03 kB |
./bundle/sandbox-macos-permissive-open.sb |
890 B |
./bundle/sandbox-macos-permissive-proxied.sb |
1.31 kB |
./bundle/sandbox-macos-restrictive-closed.sb |
3.29 kB |
./bundle/sandbox-macos-restrictive-open.sb |
3.36 kB |
./bundle/sandbox-macos-restrictive-proxied.sb |
3.56 kB |
/gemini review