EDIT - just using the standard logger from python
I have a SMTP logging handler that looks like:
import logging, logging.handlers
# Logging to a file done here
rootLogger = logging.getLogger()
loggingHandler = logging.FileHandler (LOG_FILE)
loggingFormatter = logging.Formatter ('%(asctime)s %(levelname)s %(name)s %(message)s')
loggingHandler.setFormatter (loggingFormatter)
rootLogger.setLevel (logging.DEBUG)
rootLogger.addHandler (loggingHandler)
# Logging to email of any errors
emailHandler = logging.handlers.SMTPHandler ("localhost", "me@localhost", ["me@awesome.edu"], "Backup Error")
emailHandler.setFormatter (loggingFormatter)
emailHandler.setLevel (logging.ERROR)
rootLogger.addHandler (emailHandler)
The problem I'm having is each time there is an error, I get one email per error message. For the rsync automation that this logger handles, sometimes there can be thousands. Is there a way to get one email with the entire error logging, or even debug logging, from this script in one large email instead of thousands of small ones?