[Python-Dev] Using logging in the stdlib and its unit tests
ncoghlan at gmail.com
Sat Dec 11 18:18:43 CET 2010
On Sat, Dec 11, 2010 at 10:06 PM, Vinay Sajip <vinay_sajip at yahoo.co.uk> wrote:
> Nick Coghlan <ncoghlan <at> gmail.com> writes:
>> the logging module is a tool to track what is happening in a program, not a
>> tool for providing a console based UI.
> That was certainly the thinking behind how it worked before my recent changes,
> but I completely accept that it wasn't helpful in the concurrent.futures
> scenario, and agree with the comments you made around this in your earlier
> posts. However, what Antoine has said on this thread (and others have concurred)
> leads me to believe that he wants to use it not purely as a tracking tool (as
> I've termed it, "an adjunct to doing real work") but also as a tool to provide
> program output (e.g. doing some of the program's real work, say by calling
> error() to print an error message).
I think that's actually just a case where the lines get a little
blurry. From logging's point of view, it is still being used to say
"Hey, this particular event happened during program execution". We're
just adjusting our display policy to say that there are certain kinds
of events that should be made visible to the user by default, but
piping them into the logging machinery is preferable to writing them
directly to sys,stderr.
By contrast, most information that is written to sys.stdout isn't
really reporting events that happened in the program - it is actual
meaningful data that is related to the task the program accomplishes.
Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
More information about the Python-Dev