[stdlib-sig] logging

Barry Warsaw barry at python.org
Mon Sep 21 16:20:44 CEST 2009


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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 832 bytes
Desc: This is a digitally signed message part
URL: <http://mail.python.org/pipermail/stdlib-sig/attachments/20090921/c93df036/attachment.pgp>


More information about the stdlib-sig mailing list