base renamed to vbancmd

misc renamed to event

info message fixed if no events subbed to

now using logging module in Event class
This commit is contained in:
onyx-and-iris 2022-09-28 18:03:22 +01:00
parent f46abedf12
commit 1169435104
2 changed files with 14 additions and 8 deletions

View File

@ -1,13 +1,19 @@
import logging
class Event:
logger = logging.getLogger("event.event")
def __init__(self, subs: dict):
self.subs = subs
def info(self, msg):
info = (
f"{msg} events",
f"Now listening for {', '.join(self.get())} events",
)
print("\n".join(info))
info = (f"{msg} events",)
if self.any():
info += (f"now listening for {', '.join(self.get())} events",)
else:
info += (f"not listening for any events",)
self.logger.info(", ".join(info))
@property
def pdirty(self):

View File

@ -3,7 +3,7 @@ import time
from abc import ABCMeta, abstractmethod
from typing import Iterable, Optional, Union
from .misc import Event
from .event import Event
from .packet import RequestHeader
from .subject import Subject
from .util import Socket, comp, script
@ -122,8 +122,8 @@ class VbanCmd(metaclass=ABCMeta):
strip levels in PREFADER mode.
"""
return (
tuple(val for val in packet.inputlevels),
tuple(val for val in packet.outputlevels),
tuple(((1 << 16) - 1) - val for val in packet.inputlevels),
tuple(((1 << 16) - 1) - val for val in packet.outputlevels),
)
def apply(self, data: dict):