python logging: email entire log file as attachment when level >= ERROR
问题 My logging system has a few handlers, log file (INFO), an email handler (>ERROR), and a stream handler for optional debugging. When an error/exception/critical message occurs, I want the email handler to attach the log file from the file handler to the error email. import logging def initialize_logging(): logger = logging.getLogger() logger.setLevel(logging.INFO) file_handler = createFileHandler() file_handler.setLevel(logging.INFO) logger.addHandler(file_handler) email_handler =