The SMTPHandler requires a "subject" to be included when it is initialized.
How can the subject line include the level of the event that generated the email? For example:
import logging from logging.handlers import SMTPHandler logger = logging.getLogger('test_logger') email = SMTPHandler(*credentials, subject="class_name") logger.addHandler(email) logs.info('Info Test') logs.error('Error Test') How to make the subject list for logs.info('Info Test') be INFO: class_name and logs.Error('Error Test') be ERROR: class_name?
SMTPHandlersubject line.