Skip to content
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

Request: 'g.debug' -> python logging #33

Open
hmaerki opened this issue Sep 11, 2024 · 3 comments · May be fixed by #43
Open

Request: 'g.debug' -> python logging #33

hmaerki opened this issue Sep 11, 2024 · 3 comments · May be fixed by #43
Assignees

Comments

@hmaerki
Copy link

hmaerki commented Sep 11, 2024

g.debug / meterbus.debug(True) may be archived using python logging. In a central point, the loglevels may be controlled.

Would it be better to trash 'g.debug' and just use python logging?

@ganehag
Copy link
Owner

ganehag commented Sep 11, 2024

The original idea, as I remember it from years ago, was that the purpose of the debug variable was to control whether specific debugging routines were executed at all.

If debug is not active, these routines don’t run, so there's no overhead. However, if these routines were to send their output through the standard Python logging function, the logging call would still be made, even if nothing is actually displayed.

This means the debugging code would still run, adding unnecessary processing when not in use.

@ganehag ganehag self-assigned this Jan 22, 2025
@ganehag
Copy link
Owner

ganehag commented Jan 22, 2025

I might take this on when I have the time, but if anyone else wants to give it a try, feel free to do so.

@hmaerki
Copy link
Author

hmaerki commented Jan 22, 2025

@ganehag: but if anyone else wants to give it a try
I wrote the initial comment. We use pyMeterBus to collect data for http://www.puenterswis.ch/ and we are thankful for this library.

I will create a PR with a proposal if this is fine by you!

@hmaerki hmaerki linked a pull request Jan 23, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants