I have some Python code processing incoming e-mail. In there, there's a function process_mail
. While using the logging
module from the Python3 stdlib, I would like to be able to send all log entries from one call to process_mail
via e-mail to the original sender in case of an error.
So the question is: How can I create temporary, throw-away logger instances at the beginning of my function, and use this to send the log back to the sender, preferably without having to read/filter the log file? At the same time, all entries should go to my normal logs.