At Wednesday 6/12/2006 16:04, Lutz Steinborn wrote:
I need to log each and only this loglevel to a different file.
So for example all INFO to info.log and all ERROR to error.log.
And I need a master logfile with all messages.
How can I do this ?
Any example ?
Define a handler for each logfile you want, setting the *minimum*
level you want to get there.
Define a new Filter class:
class LevelFilter(Filter):
def __init__(self, levelmin, levelmax):
Filter.__init__(self)
self.levelmin = levelmin
self.levelmax = levelmax
def filter(self, record):
return (record.levelno >= self.levelmin and
record.levelno <= self.levelmax)
and add an instance of LevelFilter to each handler. (Untested)
--
Gabriel Genellina
Softlab SRL
__________________________________________________
Correo Yahoo!
Espacio para todos tus mensajes, antivirus y antispam ¡gratis!
¡Abrí tu cuenta ya! - http://correo.yahoo.com.ar
--
http://mail.python.org/mailman/listinfo/python-list