Skip to content

Keep debug logging out of the terminal; fresh log every launch - #14

Merged
NoHudd merged 1 commit into
devfrom
fix/quiet-console-logs
Sep 29, 2026
Merged

NoHudd merged 1 commit into
devfrom
fix/quiet-console-logs

Conversation

@NoHudd

@NoHudd NoHudd commented Sep 29, 2026

Copy link
Copy Markdown
Owner

When you quit, the terminal showed the debug lines from world loading (and teardown). debug_log printed every line to the terminal as well as debug.log; the ones printed before the game screen opened were left in scrollback.

  • debug_log now writes debug.log only. The log panel (L) still shows everything. Real startup failures ("Could not load game data") still print, since there is no screen yet to show them.
  • Each launch still starts an empty debug.log and keeps the previous session as combat.log, but the reset now runs before the game modules import. Before, the lines they log while importing (e.g. the combat system's attack table) were wiped from every session. It also uses the configured DEBUG_LOG_FILE instead of a hard-coded name.

Checked with a simulated launch in a scratch copy (real main.py, headless UI in place of the screen): nothing printed to the terminal, the old log moved to combat.log, and the new debug.log includes the import-time lines.

make check: ruff and mypy clean, 409 passed (4 new in tests/test_logging.py), content validates.

🤖 Generated with Claude Code

debug_log wrote every line to debug.log and also printed it to stderr.
Lines printed while the world loaded sat behind the game screen, and
they (plus the teardown lines) were left in the terminal when the player
quit. The log panel (L) already shows them from the file, so debug_log
now writes the file only.

main.py already emptied debug.log on each launch (keeping the previous
session as combat.log), but only after the game modules were imported,
and some of them log while importing, so each session lost its first
lines. rotate_logs() now runs before those imports and uses the
configured DEBUG_LOG_FILE instead of a hard-coded name.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@NoHudd
NoHudd merged commit 4f598c7 into dev Sep 29, 2026
1 check passed
@NoHudd
NoHudd deleted the fix/quiet-console-logs branch September 29, 2026 21:56
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.

1 participant