watchforstock / evohome-client

Python client to access the Evohome web service
Apache License 2.0
88 stars 52 forks source link

Improve debug logging to expected behavior #74

Closed zxdavb closed 5 years ago

zxdavb commented 5 years ago

The existing code has the following (rather useful) block that is executed during initialization:

if debug = True:
    turn_debug_logging_on()
else:
    turn_debug_logging_off()

Turning debug logging on is useful, but not turning it on shouldn't mean that it must be turned off. By default, such debugging is off anyway!

However, forcing it to be off can be troublesome. For example, I use this component in a smarthome platform, and it has a means to configure logging of it's components, libraries, etc. in a single log file. The existing code overrules this behaviour.

My experience is that although I have enabled logging for evohomecleint, it doesn't occur unless I also set debug = True, and then I get more logging than I expected.

Here, I am proposing:

if debug = True:
    turn_debug_logging_on()

If debug is not true, then the debugging may still occur according to the expected behavior of logger