Hallöchen!

Is there a portable and simply way to direct file-like IO to simply
nothing?  I try to implement some sort of NullLogging by saying

--8<---------------cut here---------------start------------->8---
import logging
if options.logging:
    logging.basicConfig(level=logging.DEBUG, filename=options.logfile, 
filemode="w",
                        format='%(asctime)s %(name)s %(levelname)s   
%(message)s')
else:
    # redirect logging to a memory buffer in order to simply ignore it.
    import StringIO
    logging.basicConfig(stream=StringIO.StringIO())
--8<---------------cut here---------------end--------------->8---

However, this consumes memory.  Is there a better way?

Tschö,
Torsten.

-- 
Torsten Bronger, aquisgrana, europa vetus
                                      Jabber ID: [EMAIL PROTECTED]
                      (See http://ime.webhop.org for ICQ, MSN, etc.)
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to