[Add] log function of LogEngine

This commit is contained in:
vn.py 2019-06-13 23:24:32 +08:00
parent 58a9f56072
commit 160998cdab

View File

@ -9,6 +9,7 @@ from email.message import EmailMessage
from queue import Empty, Queue from queue import Empty, Queue
from threading import Thread from threading import Thread
from typing import Any, Sequence from typing import Any, Sequence
from logging import INFO
from vnpy.event import Event, EventEngine from vnpy.event import Event, EventEngine
from .app import BaseApp from .app import BaseApp
@ -311,10 +312,16 @@ class LogEngine(BaseEngine):
def process_log_event(self, event: Event): def process_log_event(self, event: Event):
""" """
Output log event data with logging function. Process log event.
""" """
log = event.data log = event.data
self.logger.log(log.level, log.msg) self.log(log.msg, log.level)
def log(self, msg: str, level: int = INFO):
"""
Output log event data with logging function.
"""
self.logger.log(level, msg)
class OmsEngine(BaseEngine): class OmsEngine(BaseEngine):