Skip to content

Added Logging Handler Names & windows pytest support #812

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

shukari
Copy link

@shukari shukari commented Aug 6, 2025

It is now possible to set loglevels for each module or for all per:

# all loggers
logging.getLogger('meshtastic').setLevel(logging.DEBUG)

# only ble_interface
logging.getLogger('meshtastic.ble_interface').setLevel(logging.DEBUG)
  • test are now runable on windows, some are ignored and a fake termios for the decorators
  • test_exit_with_exception with a true exception

@ianmcorvidae ianmcorvidae requested a review from Copilot August 6, 2025 17:15
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces structured logging with module-specific handlers throughout the Meshtastic codebase. The main purpose is to enable granular log level control for individual modules or the entire library.

  • Adds named logger instances to all modules using logging.getLogger(__name__)
  • Replaces direct logging.* calls with module-specific logger.* calls
  • Enables per-module log level configuration as described in the PR description

Reviewed Changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
meshtastic/util.py Adds module logger and converts logging calls
meshtastic/tunnel.py Adds module logger and converts logging calls
meshtastic/test.py Adds module logger and converts logging calls
meshtastic/tcp_interface.py Adds module logger and converts logging calls
meshtastic/stream_interface.py Adds module logger and converts logging calls
meshtastic/serial_interface.py Adds module logger and converts logging calls
meshtastic/remote_hardware.py Adds module logger and converts logging calls
meshtastic/node.py Adds module logger and converts logging calls
meshtastic/mesh_interface.py Adds module logger and converts logging calls
meshtastic/ble_interface.py Adds module logger and converts logging calls
meshtastic/main.py Adds module logger and converts logging calls
meshtastic/init.py Adds module logger and converts logging calls

@ianmcorvidae
Copy link
Contributor

Looks pretty reasonable to me skimming from my phone; I'll throw copilot at it for now and set off CI, and try to give it a close look when I've next got a small block of time at a proper computer just in case there's anything finicky to spot. Thanks for the PR!

shukari and others added 3 commits August 6, 2025 19:54
- test are now runable on windows, some are ignored and a fake termios for the decorators
- test_exit_with_exception with a true exception
@shukari shukari changed the title Added Logging Handler Names Added Logging Handler Names & windows pytest support Aug 6, 2025
@shukari
Copy link
Author

shukari commented Aug 6, 2025

@ianmcorvidae because the test test_exit_with_exception didnt raise a true exception, the test failed. I changed it and it should now report the traceback. Also i did some changes that windows users can run the tests (some are linux only atm)

@shukari
Copy link
Author

shukari commented Aug 9, 2025

So.... i did a pytest and a pylint... please... be ok now 😅

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.

2 participants