Gary Jefferson wrote: > So maybe I don't have all this figured out quite as well as I thought. > What I really want to do is set an environment variable, MYDEBUG, which > contains a list of wildcarded logger names, such as "a.*.c a.d" (which > becomes ['a.*.c', 'a.d'], and then selectively crank the loglevel up to > DEBUG for those that match. > > In order to do that, I think I need something kind of like filters, but > for logger name... I'm not seeing how to do this, even after playing > with variations of test15, 18, and 21. > > What I do have working at the moment is passing a list of non-wildcard > logger names, i.e., doing the wildcard expansion manually such as > "['a.b.c', 'a.c.c', 'a.f.c', 'a.d']. Is there anyway to automate this > dynamically? > > BTW, I do understand that 'a.d' is essentially equivalent to 'a.d.*', > but I'm dealing with a hierarchy that doesn't always tidy up like that. > For example, I have top.network.server.http, top.network.server.smtp, > top.network.client.http, and top.network.client.smtp. Obviously, if I > only want server or client DEBUG msgs, this is easy. And sometimes > that's exactly what I want. Other times, I want only smtp DEBUG msgs, > and the hierarchy won't help me get that (unless I break it for just > getting client or server msgs), etc. So I would really like to figure > out how to do 'a.*.c'. > > Any ideas? > > Thanks again, > Gary
Okay, I think I'm back on track again: I can do regex comparisons against the name field of the LogRecord instance handed to me by filter(). Gary -- http://mail.python.org/mailman/listinfo/python-list