Repository navigation
Apply [logging] log_level to the meshcore library logger too - #10
Merged
Merged
Conversation
log_level in mcbot.conf only set the bot's own "mcbot" logger; the meshcore library's "meshcore" logger was pinned to INFO unless --debug was passed. Since most verbose output comes from the library logger, log_level=DEBUG appeared to do nothing and --debug was the only way to get debug output. setup_logging now computes one effective level and applies it to BOTH loggers, with --debug as a shortcut for DEBUG: - log_level=DEBUG -> both DEBUG (full debug; equivalent to --debug) - log_level=INFO -> both INFO (unchanged default) - log_level=WARNING -> both WARNING (the library is now quietable too) - --debug -> both DEBUG regardless of log_level Also document the behavior in mcbot.conf.example and add tests/test_logging.py. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This was referenced Jun 13, 2026
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.
Problem
Setting
log_level = DEBUGinmcbot.confhad no apparent effect — the only way to get debug logging was the--debugCLI flag.Root cause
The bot uses two loggers:
mcbot(its own) andmeshcore(the library's verbose packet/protocol logs). Insetup_logging:[logging] log_levelwas applied only to themcbotlogger.--debugset only themeshcorelibrary logger to DEBUG; otherwise it was pinned to INFO.Most of the output people think of as "debug logging" comes from the library logger, so
log_level=DEBUGraised only themcbotlogger and looked like a no-op, while--debuglit up the library logger. Confirmed:Fix
setup_loggingnow computes one effective level and applies it to both loggers, with--debugas a shortcut for DEBUG:Result:
log_level=DEBUG→ both DEBUG (full debug, incl. library output) — equivalent to--debuglog_level=INFO(default) → both INFO (unchanged)log_level=WARNING→ both WARNING (the library is now quietable too, which it wasn't before)--debug→ both DEBUG regardless oflog_levelMinor behavior note:
--debugnow also raises the bot's own logger to DEBUG (previously it touched only the library) — intuitive, since "debug" should mean full debug.Changes
mcbot.py— unify the level across both loggers insetup_logging.mcbot.conf.example— document thatlog_levelcovers both loggers and thatDEBUGequals--debug.tests/test_logging.py— 4 checks asserting both loggers tracklog_leveland--debug.Testing
tests/test_logging.pypasses (4/4); existingtest_repeat_tracking.pyandtest_radio_eviction.pystill pass;py_compileclean.🤖 Generated with Claude Code