Fix to not sending stack dumps in development environment

This commit is contained in:
Keith Edmunds 2022-12-24 20:23:30 +00:00
parent ea4d7693ef
commit abd6ad0a64

View File

@ -2,7 +2,8 @@
import logging import logging
import logging.handlers import logging.handlers
import stackprinter import os
import stackprinter # type: ignore
import sys import sys
import traceback import traceback
@ -75,7 +76,7 @@ def log_uncaught_exceptions(_ex_cls, ex, tb):
logging.critical(''.join(traceback.format_tb(tb))) logging.critical(''.join(traceback.format_tb(tb)))
print("\033[1;37;40m") print("\033[1;37;40m")
print(stackprinter.format(ex, style="darkbg2", add_summary=True)) print(stackprinter.format(ex, style="darkbg2", add_summary=True))
if os.environ("MM_ENV") != "DEVELOPMENT": if os.environ["MM_ENV"] != "DEVELOPMENT":
msg = stackprinter.format(ex) msg = stackprinter.format(ex)
send_mail(Config.ERRORS_TO, Config.ERRORS_FROM, send_mail(Config.ERRORS_TO, Config.ERRORS_FROM,
"Exception from musicmuster", msg) "Exception from musicmuster", msg)