# 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 List, Tuple, Union, cast
from irisett import log
import asyncio.subprocess
        raise MonitorFailedError(std_data)
    text, perf = parse_plugin_output(std_data)
    if proc.returncode not in [STATUS_OK, STATUS_WARNING]:
        raise MonitorFailedError(text)
    return text, perf


def parse_plugin_output(output: Union[str, bytes]) -> Tuple[str, List[str]]:
    """Parse nagios output.

    Splits the data into a text string and performance data.
    """
    output = decode_plugin_output(output)
    if '|' not in output:
        text = output
        perf = []  # type: List[str]
    else:
        text, _perf = output.split('|', 1)
        perf = _perf.split('|')
    text = text.strip()
    return text, perf


def decode_plugin_output(output: Union[str, bytes]) -> str:
    """Decode nagios output from latin-1."""
    try:
        if type(output) == bytes:
            output = cast(bytes, output)
            output = output.decode('latin-1', 'replace')
    except Exception as e:

# 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/nagios.py
from typing import List, Tuple, Union, cast
from irisett import log
import asyncio.subprocess

        raise MonitorFailedError(std_data)
    text, perf = parse_plugin_output(std_data)
    if proc.returncode not in [STATUS_OK, STATUS_WARNING]:
        raise MonitorFailedError(text)
    return text, perf


def parse_plugin_output(output: Union[str, bytes]) -> Tuple[str, List[str]]:
    """Parse nagios output.

    Splits the data into a text string and performance data.
    """
    output = decode_plugin_output(output)
    if '|' not in output:
        text = output
        perf = []  # type: List[str]
    else:
        text, _perf = output.split('|', 1)
        perf = _perf.split('|')
    text = text.strip()
    return text, perf


def decode_plugin_output(output: Union[str, bytes]) -> str:
    """Decode nagios output from latin-1."""
    try:
        if type(output) == bytes:
            output = cast(bytes, output)
            output = output.decode('latin-1', 'replace')
    except Exception as e:

        log.debug('nagios.encode_monitor_output: error: %s' % str(e))