Exemplo n.º 1
0
    def initLogger(self):
        if not self._capture_output:
            return

        #普通日志输出控制台
        if self._stream is None:
            self._stream = EmittingStream(textWritten=self.normalOutputWritten)
        self.log_handler = logging.StreamHandler(self._stream)
        FORMAT = logging.Formatter(
            '%(asctime)-15s [%(levelname)s] - %(message)s [%(name)s::%(funcName)s]'
        )
        self.log_handler.setFormatter(FORMAT)
        add_class_logger_handler(
            [
                MyMainWindow,
                CollectSpotThread,  #CollectToMySQLThread, CollectToMemThread,
                UsePytdxImportToH5Thread,
                UseTdxImportToH5Thread,
                ImportTdxToH5Task,
                SchedImportThread
            ],
            logging.INFO)
        for name in logging.Logger.manager.loggerDict.keys():
            logger = logging.getLogger(name)
            logger.addHandler(self.log_handler)
            logger.setLevel(logging.DEBUG)

        # 多进程日志队列
        self.mp_log_q = multiprocessing.Queue()
        self.mp_log_q_lisener = QueueListener(self.mp_log_q, self.log_handler)
        self.mp_log_q_lisener.start()
Exemplo n.º 2
0
    def initLogger(self):
        if not self._capture_output:
            return

        #普通日志输出控制台
        if self._stream is None:
            self._stream = EmittingStream(textWritten=self.normalOutputWritten)
        con = logging.StreamHandler(self._stream)
        FORMAT = logging.Formatter(
            '%(asctime)-15s [%(levelname)s] - %(message)s [%(name)s::%(funcName)s]'
        )
        con.setFormatter(FORMAT)
        add_class_logger_handler(
            con,
            [
                MyMainWindow,
                CollectSpotThread,  #CollectToMySQLThread, CollectToMemThread, 
                UsePytdxImportToH5Thread,
                UseTdxImportToH5Thread,
                ImportTdxToH5Task,
                SchedImportThread
            ],
            logging.INFO
        )
        hku_logger.addHandler(con)
Exemplo n.º 3
0
    def initLogger(self):
        if not self._capture_output:
            return

        #普通日志输出控制台
        con = logging.StreamHandler(
            EmittingStream(textWritten=self.normalOutputWritten))
        FORMAT = logging.Formatter(
            '%(asctime)-15s [%(levelname)s] - %(message)s [%(name)s::%(funcName)s]'
        )
        con.setFormatter(FORMAT)
        add_class_logger_handler(con, [
            MyMainWindow, CollectThread, UsePytdxImportToH5Thread,
            UseTdxImportToH5Thread
        ], logging.INFO)