
On Sep 18, 2009, at 9:54 AM, Vinay Sajip wrote:
A StreamHandler (which includes file-based handlers) has a stream attribute which is a file-like object. Just pass that to your 3rd-party API.
Thanks Vinay. If that's part of the public (i.e. supported) API, could you add that to the documentation?
N.B. If it's a file-based handler and you specify a delay argument to the handler constructor, the file isn't actually opened until you first log to it, so stream will be None. So you might need to be careful about that (by default, a file-based handler doesn't delay opening the file).
I see. Is .stream used internally? Could it be a property that ensures its underlying file is open when its accessed? Also, if the handler is not StreamHandler, is it insane to want to print to it? IOW, would it make sense to implement .write() on the base Handler? -Barry