Open caco3 opened 11 months ago
Hey @caco3, thanks for the PR.
Are you suggesting that BuildHAT
incorrectly sets log
to true
in this case, so ignoring the specifics of dlogging this proposed change is needed anyway?
If so, since the default behaviour is changing, we might want to be more specific / provide a docs update explicitly mentioning how to enable debugging.
Usually one can suppress this with logging.getLogger('
').setLevel(logging.WARNING), how ever none of my approaches worked
I'm concerned that the opposite may be true; if debug logging is switched off by default, is it definitely possible to turn it back on using the methods you mention trying above?
And finally;
If an application has its dlogging set to DEBUG, BuildHAT flods with a tonn of unwanted debug messages.
Is it not expected that if dlogging is set to DEBUG that the BuildHAT does output log messages?
Sorry for the late response.
N.B. dlogging is a typo, I meant logging.
Is it not expected that if logging is set to DEBUG that the BuildHAT does output log messages?
Yes, this is right.
But I only want the debug log of my own code, not the one of all modules. To do so, one usually can call logging.getLogger('<MODULE NAME>').setLevel(logging.WARNING)
to set the log level of an imported module.
How ever this does not work on the BuildHat! I see 2 issues there which both got fixed in my PR:
def write()
has it enabled by default -> why? Most users do not want to see the debug log unless they debug the BuildHat.def read()
misses the parameter to disable the logging at all.
If an application has its dlogging set to DEBUG, BuildHAT flods with a tonn of unwanted debug messages.
Usually one can suppress this with
logging.getLogger('<MODULE NAME>').setLevel(logging.WARNING)
, how ever none of my approaches worked:So I ended up to disable the logging by default. This seems to be correct on the
HAT
class level, but wrong down in theBuildHAT
: https://github.com/RaspberryPiFoundation/python-build-hat/blob/main/buildhat/hat.py#L11