mirror of
https://github.com/meshcore-dev/meshcore_py.git
synced 2026-09-14 17:56:38 +00:00
Stop configuring the root logger on import
logging.basicConfig() at import time in __init__.py silently clobbered the embedding application's own logging setup. Replace it with a NullHandler so the library stays silent by default without touching global config. Also stop MeshCore.__init__ from unconditionally forcing the "meshcore" logger to INFO when neither debug= nor only_error= is passed - only set a level when the caller explicitly asks for one, otherwise leave whatever the app already configured alone. Document the idiomatic logging setup for consumers in README.md. Fixes #58
This commit is contained in:
@@ -371,6 +371,15 @@ meshcore = await MeshCore.create_serial("/dev/ttyUSB0", debug=True)
|
||||
|
||||
This logs detailed information about commands sent and events received.
|
||||
|
||||
meshcore_py does not configure Python's root logger or call `logging.basicConfig()` itself - it only attaches a `NullHandler` so it stays silent by default. To see its logs, configure logging in your own application, e.g.:
|
||||
|
||||
```python
|
||||
import logging
|
||||
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
logging.getLogger("meshcore").setLevel(logging.DEBUG)
|
||||
```
|
||||
|
||||
## Common Examples
|
||||
|
||||
### Sending Messages to Contacts
|
||||
|
||||
Reference in New Issue
Block a user