def setEmailsOnLogger(self, logger, emails):
    _removeHandlersFromLogger(logger, logging.handlers.SMTPHandler)
    if (emails is False):
        return
    smtpServer = self.config.getSMTPServer()
    smtpPort = self.config.getSMTPPort()
    fromAddr = self.config.getFromAddr()
    emailSubject = self.config.getEmailSubject()
    username = self.config.getEmailUsername()
    password = self.config.getEmailPassword()
    if self.config.getSecureSMTP():
        secure = (None, None)
    else:
        secure = None
    if (emails is True):
        toAddrs = self.config.getToAddrs()
    elif isinstance(emails, (list, tuple)):
        toAddrs = emails
    else:
        msg = 'Argument emails should be True to use the default addresses, False to not send any emails or a list of recipient addresses. Got %s.'
        raise ValueError((msg % type(emails)))
    _addMailHandlerToLogger(logger, (smtpServer, smtpPort), fromAddr, toAddrs, emailSubject, username, password, secure)
def setEmailsOnLogger(self, logger, emails):
    _removeHandlersFromLogger(logger, logging.handlers.SMTPHandler)
    if (emails is False):
        return
    smtpServer = self.config.getSMTPServer()
    smtpPort = self.config.getSMTPPort()
    fromAddr = self.config.getFromAddr()
    emailSubject = self.config.getEmailSubject()
    username = self.config.getEmailUsername()
    password = self.config.getEmailPassword()
    if self.config.getSecureSMTP():
        secure = (None, None)
    else:
        secure = None
    if (emails is True):
        toAddrs = self.config.getToAddrs()
    elif isinstance(emails, (list, tuple)):
        toAddrs = emails
    else:
        msg = 'Argument emails should be True to use the default addresses, False to not send any emails or a list of recipient addresses. Got %s.'
        raise ValueError((msg % type(emails)))
    _addMailHandlerToLogger(logger, (smtpServer, smtpPort), fromAddr, toAddrs, emailSubject, username, password, secure)