Question by someone coming from C...

John Krukoff jkrukoff at ltgc.com
Wed Jun 11 01:58:56 CEST 2008


On Wed, 2008-06-11 at 00:43 +0200, Christian Heimes wrote:
> John Krukoff wrote:
> > Since you probably want access to these from many different places in
> > your code, I find the simplest way is to create a logging module of your
> > own (not called logging, obviously) and instantiate all of your loggers
> > in that namespace, then import that one module as needed.
> 
> No, don't do that. Simple do
> 
> import logging
> log = logging.getLogger("some_name")
> 
> The logging module takes care of the rest. The logging.getLogger()
> function creates a new logger *only* when the name hasn't been used yet.
> 
> Christian
> 
> --
> http://mail.python.org/mailman/listinfo/python-list

Nifty, I never noticed that function, thanks for pointing it out as
it'll make my application a bit simpler.

Now, if they'd only add a syslog module that uses the libc syslog
interface (sure, it wouldn't be thread safe, but at least it'd be
portable to AIX, unlike the current one), I'll be a happy camper.
-- 
John Krukoff <jkrukoff at ltgc.com>
Land Title Guarantee Company




More information about the Python-list mailing list