Skip to content

Log a startup banner with the effective log level + config path - #11

Merged
sg merged 1 commit into
mainfrom
fix/log-startup-banner
Jun 13, 2026
Merged

sg merged 1 commit into
mainfrom
fix/log-startup-banner

Conversation

@sg

@sg sg commented Jun 13, 2026

Copy link
Copy Markdown
Owner

Summary

Makes logging configuration self-diagnosing. After setup_logging configures the loggers, it emits one INFO line:

[INFO] logging at DEBUG (log_level=DEBUG); config=/home/steve/.../mcbot.conf

It shows the effective level, its source (log_level=… from the config vs the --debug flag), and the exact config file that was loaded — or config=(no config file found) when none was read.

Why

This is a follow-up to the log_level/--debug fix (#10). When debug logging "doesn't work," the cause is almost always environmental — stale deployed code, the wrong working directory, or a config file that isn't the one being edited. This banner surfaces all of that at startup: if it prints INFO when you set DEBUG, or a config= path you didn't expect (or "no config file found"), you immediately know whether it's the code, the level, or the wrong/missing conf.

Changes

  • Config.config_path — records the config file actually loaded (None if none found).
  • load_config sets it when it finds and reads the file.
  • setup_logging emits the banner at INFO (visible in the default config and the common "expected DEBUG, got INFO" case, without polluting logs at WARNING+).
  • tests/test_logging.py — assert config_path is recorded and the banner reports the effective level + path.

Testing

tests/test_logging.py passes (incl. the new banner/config_path checks); test_repeat_tracking.py and test_radio_eviction.py still pass; py_compile clean. Verified the banner output for three cases: config with DEBUG, no config file (defaults), and --debug override.

🤖 Generated with Claude Code

Make logging configuration self-diagnosing: after setup_logging configures
the loggers it now emits one INFO line showing the effective level, its
source (log_level=... vs --debug), and the exact config file that was
loaded (or "(no config file found)"). This makes it immediately obvious
whether log_level from mcbot.conf took effect and which file was read.

- Config.config_path records the loaded config file (None if none found).
- load_config sets it when it reads the file.
- setup_logging emits the banner at INFO (visible in the default config and
  the common "expected DEBUG, got INFO" case, without polluting logs).
- tests/test_logging.py: assert config_path is recorded and the banner
  reports the level + path.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@sg
sg merged commit 0d2e78f into main Jun 13, 2026
1 check passed
@sg
sg deleted the fix/log-startup-banner branch June 13, 2026 04:45
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