feat: add toggleable debug logging#18
Merged
Merged
Conversation
New debug_log module writes structured lines to logs/debug-YYYY-MM-DD.log (daily rotation) when the setting is enabled. Toggle via Settings → Preferences → Debug logging — takes effect immediately, no restart needed. Events logged: - [SYNC] Hevy full/incremental sync start & complete (counts) - [SYNC] Google Fit sync start & complete (counts) - [AI] Token usage per request (provider, model, in/out/cache) - [AI] Coaching report start (provider, model, weeks) - [ERROR] AI exceptions with provider, model, status, traceback line - [PROFILE] Profile create, activate, rename, delete Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…TRIBUTING README: new "Debug logs" section explaining how to enable, what is captured per category, and an example of the log format. CONTRIBUTING: new "Reporting bugs" section at the top asking for steps to reproduce, screenshots/terminal output, the debug log, and environment details. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
New log categories and events:
- [APP] Startup (profile, provider, model) and clean exit
- [MENU] Every main menu selection
- [SYNC] Fresh-data skip, auto-sync trigger, user accept/decline for
both Hevy and Google Fit
- [GOAL] Goal created (type only, no personal content)
- [SETTING] Every user-initiated settings change (key + new value)
- [RESET] Memories cleared, goals cleared, sync state reset, full wipe
- [AI] Chat session start (provider, model, weeks, slim, language),
tool calls (push_routine / update_routine / manage_goals),
session end (turn count), memories extracted count,
coaching report complete (token delta)
Personal data is never written: goal descriptions, body targets, and
per-session token counts are omitted from all log lines.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- [SYNC] Manual sync: type chosen (full/incremental) - [GOAL] Weekly check-in result (confirmed/update/skipped) - [GOAL] Goals reset from "start from scratch" in goals menu - [GOAL] First-run goals wizard accepted/declined - [GOAL] Weekly check-in triggered - [AI] Coaching report: weeks requested; error with type - [SETTING] Google Fit connected / disconnected - [ERROR] Google Fit connect failures (credentials missing, auth error) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
cli.py:
- [MENU] Stats viewed (weeks), Progression viewed (type + weeks),
Records viewed, Goals action selected (view/update/reset)
- [GOAL] Goals wizard completed (total, mode)
- [AI] Chat weeks requested
- [PROFILE] Migration completed, first-run profile created,
multi-profile selection at startup,
profile switch requested (from→to),
switched to newly created profile
- [ERROR] Google Fit sync error from _do_fit()
ai/coach.py:
- [AI] Routine push confirmed → Hevy (routine_id, exercise count)
- [AI] Routine update confirmed → Hevy (routine_id)
- [AI] Routine push/update declined by user
- [AI] Goal change (add/update/remove) applied
- [AI] Goal change declined by user
- [ERROR] Routine push/update failures
- [ERROR] Goal change failures
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Expands the "What is logged" table from 6 rows to all 9 categories (APP, MENU, SYNC, GOAL, AI, SETTING, PROFILE, RESET, ERROR) with complete event descriptions. Updates the example log snippet to show a realistic end-to-end session. Adds a note that personal data is never written to logs. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- What it does: add Profiles and Debug logs feature rows; expand Settings row
- Setup step 3: correct path from Settings → Profiles to Settings → Profile
for updating the Hevy API key
- Settings → Profile: add Hevy API key row
- Settings → Preferences: add Debug logging row
- Reset data: update manual sqlite/rm commands to use profiles/{slug}/ paths
instead of the old root hevy.db and fit_token.json paths
- Architecture: add profile_mgr.py and debug_log.py; replace root hevy.db /
fit_token.json with the profiles/{slug}/ directory structure
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
debug_log.pymodule:init()/enable()/log()— writes structured lines tologs/debug-YYYY-MM-DD.log(daily rotation). Never raises, no-op when disabled.logs/added to.gitignore;debug_logadded topy-modulesfor system-wide install.What gets logged:
[SYNC][AI][ERROR][PROFILE]Example log lines:
Test plan
pytest tests/— 264 passed, no regressionslogs/debug-YYYY-MM-DD.logafter sync/AI requestmake installpicks updebug_logmodule in system-wide install🤖 Generated with Claude Code