# Path: irisett/stats.py
# def get_section(section: Optional[str]) -> Dict[str, float]:
# def set(var: str, value: float, section: Optional[str] = None) -> None:
# def inc(var: str, section: Optional[str] = None) -> None:
# def dec(var: str, section: Optional[str] = None) -> None:
# def get_stats() -> Dict[str, float]:
# 
# 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 Callable, Dict, Optional, List, Set, Union, Any
from irisett import (
    stats,
    log,
)
import time
import asyncio
        active_monitor_filter can be a list of active monitor ids that must match.
        """
        stats.inc('num_listeners', 'EVENT')
        listener = EventListener(self, callback, event_filter=event_filter, active_monitor_filter=active_monitor_filter)
        self.listeners.add(listener)
        return listener

    def stop_listening(self, listener: EventListener) -> None:
        """Remove a callback from the listener list."""
        if listener in self.listeners:
            stats.dec('num_listeners', 'EVENT')
            self.listeners.remove(listener)

    def running(self, event_name: str, **kwargs: Any) -> None:
        """An event is running.

        Listener callbacks will be called with:
        callback(listener-dict, event-name, timestamp, arg-dict)
        """
        stats.inc('events_fired', 'EVENT')
        if not self.listeners:
            return
        timestamp = time.time()
        for listener in self.listeners:
            if not listener.wants_event(event_name, kwargs):
                continue
            try:
                t = listener.callback(listener, event_name, timestamp, kwargs)
                asyncio.ensure_future(t)
            except Exception as e:

# Path: irisett/stats.py
# def get_section(section: Optional[str]) -> Dict[str, float]:
# def set(var: str, value: float, section: Optional[str] = None) -> None:
# def inc(var: str, section: Optional[str] = None) -> None:
# def dec(var: str, section: Optional[str] = None) -> None:
# def get_stats() -> Dict[str, float]:
# 
# 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/event.py
from typing import Callable, Dict, Optional, List, Set, Union, Any
from irisett import (
    stats,
    log,
)
import time
import asyncio

        active_monitor_filter can be a list of active monitor ids that must match.
        """
        stats.inc('num_listeners', 'EVENT')
        listener = EventListener(self, callback, event_filter=event_filter, active_monitor_filter=active_monitor_filter)
        self.listeners.add(listener)
        return listener

    def stop_listening(self, listener: EventListener) -> None:
        """Remove a callback from the listener list."""
        if listener in self.listeners:
            stats.dec('num_listeners', 'EVENT')
            self.listeners.remove(listener)

    def running(self, event_name: str, **kwargs: Any) -> None:
        """An event is running.

        Listener callbacks will be called with:
        callback(listener-dict, event-name, timestamp, arg-dict)
        """
        stats.inc('events_fired', 'EVENT')
        if not self.listeners:
            return
        timestamp = time.time()
        for listener in self.listeners:
            if not listener.wants_event(event_name, kwargs):
                continue
            try:
                t = listener.callback(listener, event_name, timestamp, kwargs)
                asyncio.ensure_future(t)
            except Exception as e:

                log.msg('Failed to run event listener callback: %s' % str(e))