s/warnings/logger.debug/ if publish_entities is called with no engine registered

This commit is contained in:
Fabio Manganiello 2023-01-29 21:52:12 +01:00
parent 8aff181956
commit 59eb0742a1
Signed by: blacklight
GPG key ID: D90FBA7F76362774

View file

@ -1,4 +1,4 @@
import warnings
import logging
from typing import Collection, Optional
from ._base import Entity, get_entities_registry
@ -6,6 +6,7 @@ from ._engine import EntitiesEngine
from ._registry import manages, register_entity_plugin, get_plugin_entity_registry
_engine: Optional[EntitiesEngine] = None
logger = logging.getLogger(__name__)
def init_entities_engine() -> EntitiesEngine:
@ -20,7 +21,7 @@ def init_entities_engine() -> EntitiesEngine:
def publish_entities(entities: Collection[Entity]):
if not _engine:
warnings.warn('No entities engine registered')
logger.debug('No entities engine registered')
return
_engine.post(*entities)