Re: Should I acquire lock for logging.Handler.flush()?

2012-02-23 Thread Vinay Sajip
On Feb 22, 4:44 am, Fayaz Yusuf Khan fayaz.yusuf.k...@gmail.com wrote: Anyway, I read the source and found many interesting things that ought to be mentioned in the docs. Such as flush() should be called from close() whenever it's implemented. (FileHandler.close() is doing it) This is

Re: Should I acquire lock for logging.Handler.flush()?

2012-02-23 Thread Fayaz Yusuf Khan
On Thursday 23 Feb 2012 8:23:42 AM Vinay Sajip wrote: If locking is required in a particular handler class for close or flush, that can be implemented by the developer of that handler class. AFAIK there is no such need for the handler classes in the stdlib - if you have reason to believe

Re: Should I acquire lock for logging.Handler.flush()?

2012-02-23 Thread Vinay Sajip
On Feb 23, 5:55 pm, Fayaz Yusuf Khan fayaz.yusuf.k...@gmail.com wrote: Well, as emit() is always being called from within a lock, I assumed that flush() should/would also be handled similarly. Afterall, they are handling the same underlying output stream or in case of the BufferingHandler

Re: Should I acquire lock for logging.Handler.flush()?

2012-02-23 Thread Vinay Sajip
On Feb 23, 5:55 pm, Fayaz Yusuf Khan fayaz.yusuf.k...@gmail.com wrote: buffer. Shouldn't the access be synchronized? I've now updated the repos for 2.7, 3.2 and default to add locking for flush/close operations. Thanks for the suggestion. Regards, Vinay Sajip --

Re: Should I acquire lock for logging.Handler.flush()?

2012-02-21 Thread Vinay Sajip
On Feb 21, 7:23 am, Fayaz Yusuf Khan fayaz.yusuf.k...@gmail.com wrote: I'm writing a custom logging Handler that sends emails through AWS Simple Email Service using the boto library. As there's a quota cap on how many (200) emails I can send within 24hrs, I think I need to buffer my log

Re: Should I acquire lock for logging.Handler.flush()?

2012-02-21 Thread Fayaz Yusuf Khan
On Tuesday 21 Feb 2012 12:52:14 PM Vinay Sajip wrote: If you are using SMTPHandler, calling flush() won't do anything. You'll probably need to subclass the handler to implement rate limiting. Oh, no! I'm writing my own handler. https://github.com/fayazkhan/ses_handler/blob/master/ses_handler.py

Should I acquire lock for logging.Handler.flush()?

2012-02-20 Thread Fayaz Yusuf Khan
I'm writing a custom logging Handler that sends emails through AWS Simple Email Service using the boto library. As there's a quota cap on how many (200) emails I can send within 24hrs, I think I need to buffer my log messages from the emit() calls (Or is that a bad idea?). And I was reading the