Alex Hall wrote: > One related question. This more of a style choice, I know, but I'd like > anyone's thoughts all the same. Currently, in my ADLogger.logExceptions > function, I log the exception (obviously). But I also take the opportunity > to generate and send an email, warning that the job raised an exception > and attaching the log file as well as printing the traceback in the email. > Loggers generally just log, and it feels kind of hacky to include email > code in a function that primarily logs exceptions. At the same time, this > is a perfect place to do it, because it gets called if an exception is > raised, and if that happens, the job almost certainly failed so I need to > know about it. I don't know of another way to do this since I don't have a > Python-based central manager, so can't examine exit codes or anything > else.
Sending emails should be the concern of a handler, not a logger. https://docs.python.org/dev/library/logging.handlers.html#smtphandler _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor