Пример #1
0
def init_logging():
    root = logging.getLogger()
    root.setLevel(logging.ERROR)
    handler = TLSSMTPHandler(
        ('smtp.gmail.com', 587),
        'Uptime Monitor <*****@*****.**>',
        RECIPIENTS,
        'add subject here',
        (SMTP_USER, SMTP_PASS)
    )
    handler.setFormatter(logging.Formatter('%(asctime)s:%(levelname)s:%(message)s'))
    root.addHandler(handler)
Пример #2
0
def init_logging():
    root = logging.getLogger()
    root.setLevel(logging.ERROR)
    handler = TLSSMTPHandler(
        ("smtp.gmail.com", 587),
        "Uptime Monitor <*****@*****.**>",
        RECIPIENTS,
        "add subject here",
        (SMTP_USER, SMTP_PASS),
    )
    handler.setFormatter(logging.Formatter("%(asctime)s:%(levelname)s:%(message)s"))
    root.addHandler(handler)
Пример #3
0
def init_logging():
    try: 
        un, pw = get_email_credentials()
    except Exception:
        logging.error("No localemailsettings file found.  Email notifications will not be sent")
        return 
        
    root = logging.getLogger()
    root.setLevel(logging.ERROR)
    handler = TLSSMTPHandler(
        ('smtp.gmail.com', 587),
        'Uptime Monitor <%s>' % un,
        RECIPIENTS,
        'BHOMA Server Error',
        (un, pw)
    )
    handler.setFormatter(logging.Formatter('%(asctime)s:%(levelname)s:%(message)s'))
    root.addHandler(handler)