[Python-Dev] Using logging in the stdlib and its unit tests (original) (raw)
Gregory P. Smith greg at krypto.org
Fri Dec 10 05:24:33 CET 2010
- Previous message: [Python-Dev] Using logging in the stdlib and its unit tests
- Next message: [Python-Dev] Using logging in the stdlib and its unit tests
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Tue, Dec 7, 2010 at 5:51 PM, Vinay Sajip <vinay_sajip at yahoo.co.uk> wrote:
Nick Coghlan <ncoghlan gmail.com> writes:
> Indeed - I was very surprised to find just now that calling > "logging.warn('Whatever')" is not the same as doing "log = > logging.getLogger(); log.warn('Whatever')". Don't know why you'd be surprised: it's been that way since logging was added to Python, and the logging.debug() etc. are documented as convenience methods for casual use in throwaway scripts, interactive sessions etc. The convenience is in that you don't need to specify a logger (the root logger is used) and that basicConfig() is called for you.
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.
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.
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.
-gps -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20101209/4b9fa3d1/attachment.html>
- Previous message: [Python-Dev] Using logging in the stdlib and its unit tests
- Next message: [Python-Dev] Using logging in the stdlib and its unit tests
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]