logging: handle everything EXCEPT certain loggers

Gábor Farkas gabor.farkas at gmail.com
Mon Nov 7 09:18:35 EST 2011


2011/11/7 Jean-Michel Pichavant <jeanmichel at sequans.com>:
> Gábor Farkas wrote:
>>
>> is there a way to setup log-handlers in a way that they log logs from
>> every logger, exept certain ones?
>>
>> i tried to create filters, but the log-record does not have access to
>> his logger, so i cannot filter based on it's "path".
>
> Are you sure ?
> LogRecord objects have a name attribute. You could do something like
>
> return 'IdontWantYou' not in record.name
>
> in your filter.

d'oh .. thanks, i somehow overlooked the name attribute. it's exactly
what i need.

thanks,
gabor



More information about the Python-list mailing list