> > But if the libraries are already doing logging, can't I already do that? > > And if the libraries aren't doing logging, this won't magically add > logging to them, will it? >
As a best practice, libraries log into a NullHandler to avoid setting up the root logger, and to prevent sending messages to the default fallback. In other words, the current best practice mentioned by the Python docs (which I personally believe is good) prevents you from seeing errors if the root logger wasn't set up correctly, or set up at all. Even if they don't send it to NullHandler, log messages below warning level aren't displayed by default. With my proposal you'd be able to see everything with 1 simple flag, no matter the configuration. It could have saved me, and probably other developers as well, lots of time. Regarding your request for an example, this won't change anything from the point of view of the library creator. As for the library user, he can continue as he does, knowing that in case there's ever a hard-to-figure bug he can turn on that flag together with -Xdev and have an easier time figuring things out. It's also useful for external developers tackling code that is not theirs. They can give themselves a guarantee that no matter the script, if it logs, it'll show. Keep in mind developers can also use it for cases where they don't set up the logging, as a permanent replacement for basicConfig, but I believe it's not a best practice for many reasons. Bar
_______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/RSB7M7YLCEPYJFFXU24X7YSEVPGQI2HC/ Code of Conduct: http://python.org/psf/codeofconduct/