Skip to content

Replace print with uniform logging across Ankimon#271

Draft
google-labs-jules[bot] wants to merge 1 commit intomainfrom
refactor-logging-replacement-3938066199095898363
Draft

Replace print with uniform logging across Ankimon#271
google-labs-jules[bot] wants to merge 1 commit intomainfrom
refactor-logging-replacement-3938066199095898363

Conversation

@google-labs-jules
Copy link

This PR replaces inconsistent print statements with the standardized Ankimon logger (ShowInfoLogger instance).

Key changes:

  1. Dependency Injection: Settings and DataHandler now accept a logger instance in their constructor. singletons.py has been updated to pass the global logger instance.
  2. Uniform Logging: Replaced print with logger.log (levels: info, warning, error) throughout the codebase, including utils.py, trainer_card.py, and various function modules.
  3. Error Handling: Replaced some showInfo popups with logger.log_and_showinfo (mostly for errors) to ensure they are logged.
  4. Standalone Scripts: update_moves.py now uses the standard logging module as it runs independently of Anki.
  5. Cleanup: Removed legacy commented-out debug prints.

This ensures all logs are captured uniformly and respects the user's request to eliminate raw print statements.


PR created automatically by Jules for task 3938066199095898363 started by @h0tp-ftw

- Replaced `print()` calls with `mw.logger.log()` or injected `logger.log()` across `src/Ankimon/`.
- Updated `Settings` and `DataHandler` classes to accept `logger` via dependency injection.
- Updated `singletons.py` to inject `logger` into `Settings` and `DataHandler`.
- Updated `PokemonCollectionDialog` to handle logging correctly in `trade_pokemon` helper functions using `mw.logger`.
- Refactored `src/Ankimon/utils.py`, `src/Ankimon/functions/`, and `src/Ankimon/poke_engine/` files to use logging.
- Configured standard python logging for standalone script `update_moves.py`.
- Removed commented-out debug print statements in `pokedex_obj.py`.
- Replaced `showInfo` calls in `TrainerCard` with `logger.log_and_showinfo` for consistency.
@google-labs-jules
Copy link
Author

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant