From 160998cdab7da9ba5edc8f6e67834268139c2d7b Mon Sep 17 00:00:00 2001 From: "vn.py" Date: Thu, 13 Jun 2019 23:24:32 +0800 Subject: [PATCH] [Add] log function of LogEngine --- vnpy/trader/engine.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/vnpy/trader/engine.py b/vnpy/trader/engine.py index 9a65e90d..7c7bebcd 100644 --- a/vnpy/trader/engine.py +++ b/vnpy/trader/engine.py @@ -9,6 +9,7 @@ from email.message import EmailMessage from queue import Empty, Queue from threading import Thread from typing import Any, Sequence +from logging import INFO from vnpy.event import Event, EventEngine from .app import BaseApp @@ -311,10 +312,16 @@ class LogEngine(BaseEngine): def process_log_event(self, event: Event): """ - Output log event data with logging function. + Process log event. """ 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):