def configure_email_logging(app):
import logging<EOL>from scout.log import TlsSMTPHandler<EOL>mail_handler = TlsSMTPHandler(<EOL>mailhost=app.config['<STR_LIT>'],<EOL>fromaddr=app.config['<STR_LIT>'],<EOL>toaddrs=app.config['<STR_LIT>'],<EOL>subject="<STR_LIT>".format(app.name),<EOL>credentials=(app.config['<STR_LIT>'], app.config['<STR_LIT>'])<EOL>)<EOL>mail_handler.setLevel(logging.ERROR)<EOL>mail_handler.setFormatter(logging.Formatter(<EOL>'<STR_LIT>'<EOL>'<STR_LIT>')<EOL>)<EOL>app.logger.addHandler(mail_handler)<EOL>
Setup logging of error/exceptions to email.