diff --git a/vnpy/trader/engine.py b/vnpy/trader/engine.py index a2e098ee..af136dab 100644 --- a/vnpy/trader/engine.py +++ b/vnpy/trader/engine.py @@ -197,13 +197,11 @@ class BaseEngine(ABC): pass -class LogEngine(BaseEngine): +class LogEngine(BaseEngine, metaclass=Singleton): """ Processes log event and output with logging module. """ - __metaclass__ = Singleton - def __init__(self, main_engine: MainEngine, event_engine: EventEngine): """""" super(LogEngine, self).__init__(main_engine, event_engine, "log") diff --git a/vnpy/trader/utility.py b/vnpy/trader/utility.py index 9951e1f1..c221277a 100644 --- a/vnpy/trader/utility.py +++ b/vnpy/trader/utility.py @@ -14,10 +14,11 @@ from .object import BarData, TickData class Singleton(type): """ - Singleton metaclass, + Singleton metaclass, - class A: - __metaclass__ = Singleton + usage: + class A(metaclass=Singleton): + ... """ _instances = {}