forked from platypush/platypush
s/disable_logging/logging_level/g on entity events.
This commit is contained in:
parent
3e41418742
commit
b044fa4acf
1 changed files with 7 additions and 8 deletions
|
@ -1,19 +1,15 @@
|
||||||
from abc import ABC
|
import logging
|
||||||
from typing import Union
|
from typing import Union
|
||||||
|
|
||||||
from platypush.entities import Entity
|
from platypush.entities import Entity
|
||||||
from platypush.message.event import Event
|
from platypush.message.event import Event
|
||||||
|
|
||||||
|
|
||||||
class EntityEvent(Event, ABC):
|
class EntityEvent(Event):
|
||||||
def __init__(
|
def __init__(self, entity: Union[Entity, dict], *args, **kwargs):
|
||||||
self, entity: Union[Entity, dict], *args, disable_logging=True, **kwargs
|
|
||||||
):
|
|
||||||
if isinstance(entity, Entity):
|
if isinstance(entity, Entity):
|
||||||
entity = entity.to_json()
|
entity = entity.to_json()
|
||||||
super().__init__(
|
super().__init__(entity=entity, *args, **kwargs)
|
||||||
entity=entity, *args, disable_logging=disable_logging, **kwargs
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class EntityUpdateEvent(EntityEvent):
|
class EntityUpdateEvent(EntityEvent):
|
||||||
|
@ -22,6 +18,9 @@ class EntityUpdateEvent(EntityEvent):
|
||||||
a sensor, a media player etc.) updates its state.
|
a sensor, a media player etc.) updates its state.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
def __init__(self, *args, logging_level=logging.DEBUG, **kwargs):
|
||||||
|
super().__init__(*args, logging_level=logging_level, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
class EntityDeleteEvent(EntityEvent):
|
class EntityDeleteEvent(EntityEvent):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in a new issue