Optional use of logging library module

Irmen de Jong irmen at -nospam-remove-this-xs4all.nl
Tue Jun 22 16:02:47 EDT 2004


Eric DeWall wrote:

> User of the class passes in a Logger object they have already set up with
> handlers, etc., class simply calls log methods on the logger when
> appropriate.  But I can't find a way to create a good "null" logging object
> that the class can use by default if no Logger is passed in.  I'd like a
> simple approach that doesn't involve extending the existing logging library.

Try the 'null' object design pattern:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/68205

--Irmen



More information about the Python-list mailing list