# Path: irisett/log.py
# def configure_logging(logtype: str, logfilename: Optional[str]=None, debug_logging: bool=False,
#                       rotate_length: int=1000000, max_rotated_files: int=250) -> None:
# def msg(logmsg: str, section: Optional[str]=None) -> None:
# def debug(logmsg: str, section: Optional[str]=None) -> None:
#     def log_msg(self, logmsg: str) -> None:
#     def log_debug(self, logmsg: str) -> None:
# class LoggingMixin:


from typing import Optional, Dict, Any, Union, Iterable
from email import charset
from email.mime.text import MIMEText
from irisett import (
    log,
)
import aiosmtplib
import jinja2
import asyncio
        for rcpt in mail_to:
            msg = MIMEText(body)
            msg['Subject'] = subject
            msg['From'] = mail_from
            msg['To'] = rcpt
            await smtp.send_message(msg)
        await smtp.quit()
    except aiosmtplib.errors.SMTPException as e:
        log.msg('Error sending smtp notification: %s' % (str(e)), 'NOTIFICATIONS')


async def send_alert_notification(
        loop: asyncio.AbstractEventLoop, settings: Dict[str, Any],
        recipients: Iterable[str], tmpl_args: Dict[str, Any]) -> None:
    subject = settings['tmpl-subject'].render(**tmpl_args)
    body = settings['tmpl-body'].render(**tmpl_args)
    await send_email(loop, settings['sender'], recipients, subject, body, settings['server'])


def parse_settings(config: Any) -> Optional[Dict[str, Any]]:
    ret = {
        'sender': config.get('email-sender'),
        'tmpl-subject': config.get('email-tmpl-subject'),
        'tmpl-body': config.get('email-tmpl-body'),
        'server': config.get('email-server', fallback='localhost')
    }  # type: Any
    if not ret['sender'] or not ret['tmpl-subject'] or not ['tmpl-body'] or not ['server']:
        log.msg('Email settings missing, no email notifications will be sent', 'NOTIFICATIONS')
        ret = None
    else:

# Path: irisett/log.py
# def configure_logging(logtype: str, logfilename: Optional[str]=None, debug_logging: bool=False,
#                       rotate_length: int=1000000, max_rotated_files: int=250) -> None:
# def msg(logmsg: str, section: Optional[str]=None) -> None:
# def debug(logmsg: str, section: Optional[str]=None) -> None:
#     def log_msg(self, logmsg: str) -> None:
#     def log_debug(self, logmsg: str) -> None:
# class LoggingMixin:


# Path: irisett/notify/email.py
from typing import Optional, Dict, Any, Union, Iterable
from email import charset
from email.mime.text import MIMEText
from irisett import (
    log,
)
import aiosmtplib
import jinja2
import asyncio

        for rcpt in mail_to:
            msg = MIMEText(body)
            msg['Subject'] = subject
            msg['From'] = mail_from
            msg['To'] = rcpt
            await smtp.send_message(msg)
        await smtp.quit()
    except aiosmtplib.errors.SMTPException as e:
        log.msg('Error sending smtp notification: %s' % (str(e)), 'NOTIFICATIONS')


async def send_alert_notification(
        loop: asyncio.AbstractEventLoop, settings: Dict[str, Any],
        recipients: Iterable[str], tmpl_args: Dict[str, Any]) -> None:
    subject = settings['tmpl-subject'].render(**tmpl_args)
    body = settings['tmpl-body'].render(**tmpl_args)
    await send_email(loop, settings['sender'], recipients, subject, body, settings['server'])


def parse_settings(config: Any) -> Optional[Dict[str, Any]]:
    ret = {
        'sender': config.get('email-sender'),
        'tmpl-subject': config.get('email-tmpl-subject'),
        'tmpl-body': config.get('email-tmpl-body'),
        'server': config.get('email-server', fallback='localhost')
    }  # type: Any
    if not ret['sender'] or not ret['tmpl-subject'] or not ['tmpl-body'] or not ['server']:
        log.msg('Email settings missing, no email notifications will be sent', 'NOTIFICATIONS')
        ret = None
    else:

        log.debug('Valid email notification settings found', 'NOTIFICATIONS')