[Python-Dev] Using logging in the stdlib and its unit tests

Vinay Sajip vinay_sajip at yahoo.co.uk
Fri Dec 10 09:06:49 CET 2010


Gregory P. Smith <greg <at> krypto.org> writes:

> Hahaha. :)  Well, I won't be suggesting to anyone at work that we throw away
> our entire bazillion line codebase just because all of it happily relies on
> logging.{debug,info,warn,error,exception} functions and all log messages go
> through a single root logger.

That's a perfectly valid way of using logging: if the convenience functions suit
your needs, there's no need to use anything else.

> I'd argue that anyone using a multi-logger hierarchy has already implemented
> overkill and that the default for anyone wanting to log something should be to
> simply call the above functions directly from the logging module.

Some people need the logger hierarchy and it's there for them, but no-one is
forced to use it.

> 
> This simplistic easy usage somewhat echo's Glenn's comment on this thread
about logging seeming way to daunting as presented today.  It needn't be.
> 

Indeed, and the very first code sample in the logging documentation shows
exactly the simplistic easy usage you're talking about. I can't see why anyone
would be scared off by that example.

Regards,

Vinay Sajip



More information about the Python-Dev mailing list