Reputation: 10099
I'm using the logging module in Python 2.7. I have a logger with different children and two handlers.
How can I check if the logger handled an event of a certain level (eg. an exception)?
Upvotes: 1
Views: 2350
Reputation: 99317
Your best bet would be to write a custom handler which took the appropriate action specific to your needs. For example, you could use a MemoryHandler
subclass with a flush level set to the level value you want, and the flush()
method could be overridden to send an email (ideally, in a separate thread, if responsiveness is important).
Upvotes: 1