On Tue, Dec 7, 2010 at 5:51 PM, Vinay Sajip <vinay_sa...@yahoo.co.uk> wrote:
> Nick Coghlan <ncoghlan <at> 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
_______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com