Esempio n. 1
0
    def handle(self, record):

        if self.markers is None:
            return False

        if matchMarkerHelp(record, self.markers):
            if sys.version_info > (2, 7):
                return super(SMTPHandler, self).handle(record)
            else:
                return SMTPHandler.handle(self, record)

        return False
Esempio n. 2
0
    def send_notification(self, record):
        # type: (LogRecord) -> bool
        """Email notification handler.

        Matches the record with the specific markers set for email
        notifications. Sends an email notification if that marker(s) matched.

        Args:
            record (LogRecord): A record that might contain a marker.
        Returns:
            bool: Whether a record was passed for emission (to be sent).
        """

        if  hasattr(self, "markers") and \
            self.markers is None:
            return False

        if match_markers(record, self.markers):

            if is_above_python_2_7():
                return super(MarkerNotifyHandler, self).handle(record)
            return SMTPHandler.handle(self, record)

        return False