One of the most important aspects of production software is being notified in case of errors. As we are not the user of the software itself, we can only know that something is wrong if the software notifies us (or when it's too late and users are complaining).
Based on the Python standard library, we can easily build a solution that notifies developers in case of a crash by email.
The logging
module has a way to report exceptions by email, so we can set up a logger and trap the exceptions to log them by email:
import logging import logging.handlers import functools crashlogger = logging.getLogger('__crashes__') def configure_crashreport(mailhost, fromaddr, toaddrs, subject, credentials, tls=False): if configure_crashreport._configured: return crashlogger.addHandler( logging.handlers.SMTPHandler( mailhost=mailhost, fromaddr=fromaddr, toaddrs=toaddrs, ...