Ricardo Aráoz wrote:
Why should it be all or nothing. Couldn't the programmer indicate that
both handlers use the same file?

It would be very easy to do this using StreamHandlers instead of
FileHandlers. It would also be easy to make a FileHandler subclass that
keeps a map from file name to file objects so if the same file is given
to two instances it reuses the first one. This could be specified as the
handler in the config file even.

This is probably just the right suggestion (subclassing FileHandler,
including a map of files and overriding the open() method).

I realise that our requirements are somewhat special (needing
different formatters for one file), and that it maybe unwise trying to
'protect' the programmer from himself.

On the positive side: while the logging module is not clever enough to provide 
the discussed functionality, it is easy to understand (and extend).

Python has 'batteries included' but sometimes you have to add some
wiring ;-)

Thanks to everybody who contributed to this; I think we have  found a good 
solution.

Regards,

Hans





Kent
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor




_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to