Report.send: log report sending success/error

This commit is contained in:
Benjamin Renard 2021-04-19 14:55:54 +02:00
parent 2c442a2433
commit 64c2db5d5d

View file

@ -56,7 +56,11 @@ class Report(object): # pylint: disable=useless-object-inheritance
subject=self.subject or subject,
text_body=content
)
return email_client.send(self.rcpt_to or rcpt_to, msg=msg, just_try=just_try)
if email_client.send(self.rcpt_to or rcpt_to, msg=msg, just_try=just_try):
logging.debug('Report sent to %s', self.rcpt_to or rcpt_to)
return True
logging.error('Fail to send report to %s', self.rcpt_to or rcpt_to)
return False
def send_at_exit(self, **kwargs):
""" Send report at exit """