Properly log exceptions
This commit is contained in:
parent
98fe448348
commit
c59f022a55
|
@ -24,6 +24,7 @@ def send(subject: str = None, body: str = None, alert_type: str = 'INFO'):
|
|||
)
|
||||
except Exception as ex:
|
||||
logger.error("Exception raised when sending alert [%s]: %s", instance.name, ex)
|
||||
logger.exception(ex)
|
||||
|
||||
if len(alert_classes) == 0:
|
||||
logger.info("No alerts configured")
|
||||
|
|
|
@ -51,6 +51,6 @@ class SMTPAlert(BaseAlert):
|
|||
server.sendmail(self.user, self.to, msg.as_string())
|
||||
logger.info('Email sent')
|
||||
except Exception as ex:
|
||||
logger.error(ex)
|
||||
logger.exception(ex)
|
||||
finally:
|
||||
server.close()
|
||||
|
|
Loading…
Reference in New Issue