fix: replace print() debug statements with logger calls in db_engine.py (#22) #53

Open
cal wants to merge 1 commits from ai/major-domo-database-22 into next-release
Owner

Summary

Replaces 4 print() calls in app/db_engine.py that were bypassing the rotating file logger with proper logger.error() calls.

Lines changed:

  • Line 462: print(f'I could not drop {move.player.name}')logger.error(...) (active roster drop)
  • Line 523: same pattern in short IL roster drop
  • Line 584: same pattern in long IL roster drop
  • Line 890: print(f'**Error** (db_engine player): {e}')logger.error(...) in Player.get_season()

All four calls now route through the module-level logger = logging.getLogger('discord_app') and will appear in /tmp/sba-database.log.

Files Changed

  • app/db_engine.py (4 lines)

Tests

No test suite — changes verified by reading modified lines in context.

Other observations

  • Lines 461, 522, 583 still use bare except: — covered by PR #50 (fix: replace bare except: with except Exception:).
## Summary Replaces 4 `print()` calls in `app/db_engine.py` that were bypassing the rotating file logger with proper `logger.error()` calls. **Lines changed:** - Line 462: `print(f'I could not drop {move.player.name}')` → `logger.error(...)` (active roster drop) - Line 523: same pattern in short IL roster drop - Line 584: same pattern in long IL roster drop - Line 890: `print(f'**Error** (db_engine player): {e}')` → `logger.error(...)` in `Player.get_season()` All four calls now route through the module-level `logger = logging.getLogger('discord_app')` and will appear in `/tmp/sba-database.log`. ## Files Changed - `app/db_engine.py` (4 lines) ## Tests No test suite — changes verified by reading modified lines in context. ## Other observations - Lines 461, 522, 583 still use bare `except:` — covered by PR #50 (fix: replace bare except: with except Exception:).
cal added 1 commit 2026-03-06 00:34:19 +00:00
fix: replace print() debug statements with logger calls in db_engine.py (#22)
All checks were successful
Build Docker Image / build (pull_request) Successful in 2m12s
d0e16cc463
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
cal added the
ai-reviewing
label 2026-03-06 00:45:34 +00:00
cal reviewed 2026-03-06 00:46:29 +00:00
cal left a comment
Author
Owner

AI Code Review

Files Reviewed

  • app/db_engine.py (modified)

Findings

Correctness

  • All 4 print()logger.error() substitutions are correct.
  • The module-level logger = logging.getLogger('discord_app') (line 42) is in scope at all 4 call sites.
  • The three roster-drop messages (lines 462, 523, 584) use bare except: blocks and reference only move.player.name — no exception variable needed, format strings are valid.
  • Line 890: except Exception as e:e is correctly in scope for the error message.
  • No logic changes, no functional regressions possible.

Security

  • No issues. Log messages contain only player names (game data), no credentials or PII.

Style & Conventions

  • logger.error() matches the existing pattern used throughout the codebase.
  • No new imports required — logger already defined at module level.

Suggestions

  • None. The PR is appropriately scoped.

Notes

  • The bare except: blocks at lines 461, 522, 583 are pre-existing and correctly noted by the author as covered by PR #50 — out of scope here.
  • The finally: return player pattern at line 891–892 (suppresses exceptions) is pre-existing, not introduced by this PR.

Verdict: APPROVED

Clean, minimal change. All 4 print() calls correctly replaced with logger.error() calls that will appear in /tmp/sba-database.log. No issues found.


Automated review by Claude PR Reviewer

## AI Code Review ### Files Reviewed - `app/db_engine.py` (modified) ### Findings #### Correctness - All 4 `print()` → `logger.error()` substitutions are correct. - The module-level `logger = logging.getLogger('discord_app')` (line 42) is in scope at all 4 call sites. - The three roster-drop messages (lines 462, 523, 584) use bare `except:` blocks and reference only `move.player.name` — no exception variable needed, format strings are valid. - Line 890: `except Exception as e:` — `e` is correctly in scope for the error message. - No logic changes, no functional regressions possible. #### Security - No issues. Log messages contain only player names (game data), no credentials or PII. #### Style & Conventions - `logger.error()` matches the existing pattern used throughout the codebase. - No new imports required — `logger` already defined at module level. #### Suggestions - None. The PR is appropriately scoped. ### Notes - The bare `except:` blocks at lines 461, 522, 583 are pre-existing and correctly noted by the author as covered by PR #50 — out of scope here. - The `finally: return player` pattern at line 891–892 (suppresses exceptions) is pre-existing, not introduced by this PR. ### Verdict: APPROVED Clean, minimal change. All 4 print() calls correctly replaced with logger.error() calls that will appear in `/tmp/sba-database.log`. No issues found. --- *Automated review by Claude PR Reviewer*
cal added
ai-reviewed
and removed
ai-reviewing
labels 2026-03-06 00:46:56 +00:00
cal changed target branch from main to next-release 2026-03-07 07:32:44 +00:00
All checks were successful
Build Docker Image / build (pull_request) Successful in 2m12s
This pull request has changes conflicting with the target branch.
  • app/db_engine.py

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin ai/major-domo-database-22:ai/major-domo-database-22
git checkout ai/major-domo-database-22
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: cal/major-domo-database#53
No description provided.