Closed fredrikbaberg closed 4 years ago
Hey @fredrikbaberg thanks for bringing this up.
Actually I realized that I have not been using logging in a very pythonic way very recently. I'll make a fix for this and push a release later today.
That was a very quick response! I attempted to add the line I referenced, replacing the name, but it did not work for me. Perhaps something else is needed, or I installed it the wrong way.
There was a call on on_startup that I used to explicitly set the logging level when debugging.
As a further note, what I learned last week was that you should not need to set the behaviour of the logger directly, and probably not use a string name. In packages it's common to simply use logger = logging.getLogger(__name__)
and the responsibility of the parent modules to collect and set the respective logging levels. Manually adding the name of the package shouldn't be necessary either.
When I install and enable the HomeAssistant plugin, my output log becomes full of DEBUG statements, see below. Normally it is possible to change log level in OctoPrint settings, but this plugin does not seem to respect that.
I'm just guessing now, since I have not been able to test it, but I think a setup of the logger is missing. See e.g. https://github.com/jneilliii/OctoPrint-TPLinkSmartplug/blob/ca8bcc6ab3cddac7f5010ef41e94c9659985c442/octoprint_tplinksmartplug/__init__.py#L84