avaldebe / PyPMS

Data acquisition and logging for Air Quality Sensors with UART interface
https://avaldebe.github.io/PyPMS/
MIT License
29 stars 8 forks source link

Disable logging unless code is running in CLI #37

Closed benthorner closed 1 year ago

benthorner commented 1 year ago

Fixes regression from ^1.

Previously this repo used Python's inbuilt logger, which does not emit INFO or DEBUG logs by default. loguru emits all logs by default. This fixes that by disabling loguru unless the code is running in CLI mode, which is when logs are actually used.

benthorner commented 1 year ago

@avaldebe library users can still customise logging with the changes here - they just need to enable the logger first. The the new default logging level of "DEBUG" (for library users) is a regression from https://github.com/avaldebe/PyPMS/commit/ecd0c9d1cd0e88284299fecc6416f5f01cadf10d.

How can we get back to that without requiring library users to learn about loguru?

avaldebe commented 1 year ago

I get your point. I'll merge your PR and publish a new version now, and will try to find a better solution later.

benthorner commented 1 year ago

Thanks @avaldebe - logs are now clean again 🎉. Appreciate it!