Nan Qi

18 papers Journal 10Unranked 8
YearRankTypeTitle / Venue / Authors
2025 J jnl
CoRR
Runchu Dong, Peng Zhao, Guiqin Wang, Nan Qi, Jie Lin
2025 J jnl
CoRR
Yu Luo, Jiamin Jiang, Jingfei Feng, Lei Tao, Qingliang Zhang, Xidao Wen, Yongqian Sun, Shenglin Zhang, Jielong Huang, Nan Qi, Dan Pei
2025 J jnl
Comput. Biol. Medicine
Bo Wang, Liuyang Feng, Lei Xu, Hao Gao, Xiaoyu Luo, Nan Qi
2024 conf
ISSCC
Jiaxiang Li, Zimu Li, Yun Yin, Changgu Yan, Nan Qi, Ming Liu, Hongtao Xu
2021 J jnl
Sci. China Inf. Sci.
Taikun Ma, Zipeng Chen, Jianxi Wu, Wei Zheng, Shufu Wang, Nan Qi, Min Lin, Baoyong Chi
2020 J jnl
IEEE Trans. Circuits Syst. I Regul. Pap.
Jianxi Wu, Wei Deng, Zipeng Chen, Wei Zheng, Yibo Liu, Shufu Wang, Nan Qi, Baoyong Chi
2020 J jnl
IEEE J. Solid State Circuits
Taikun Ma, Wei Deng, Zipeng Chen, Jianxi Wu, Wei Zheng, Shufu Wang, Nan Qi, Yibo Liu, Baoyong Chi
2020 conf
WCSP
Wanning Liu, Yitao Xu, Nan Qi, Kailing Yao, Yuli Zhang, Wenhui He
2020 J jnl
Sensors
Xianye Li, Nan Qi, Shan Jiang, Yurong Wang, Xun Li, Baoqing Sun
2019 conf
SCFA
Xiuqiao Li, Nan Qi, Yuanyuan He, Bill McMillan
2018 conf
A-SSCC
Jianxi Wu, Zipeng Chen, Wei Zheng, Yibo Liu, Shufu Wang, Nan Qi, Baoyong Chi
2018 conf
A-SSCC
Taikun Ma, Zipeng Chen, Jianxi Wu, Wei Zheng, Shufu Wang, Nan Qi, Baoyong Chi
2017 J jnl
CoRR
Hao Gao, Liuyang Feng, Nan Qi, Colin Berry, Boyce E. Griffith, Xiaoyu Luo
2015 J jnl
Comput. Intell. Neurosci.
Chao Tan, Nan Qi, Xin Zhou, Xin-hua Liu, Xingang Yao, Zhongbin Wang, Lei Si
2015 conf
MWSCAS
Bing Xia, Nan Qi, Yu Yin, Su Liu
2015 conf
FIMH
Hao Gao, Nan Qi, Xingshuang Ma, Boyce E. Griffith, Colin Berry, Xiaoyu Luo
2014 J jnl
Comput. Phys. Commun.
Yufeng Nie, Weiwei Zhang, Nan Qi, Yiqiang Li
2011 conf
EMEIT
Qiang Li, Nan Qi, Yongjian Gong
redb/logging_utils.py
← Index redb/logging_utils.py python
"""
Logging utilities and shared enums for REDB.

Contains the ImportResult enum, log formatters, and logger setup functions
used across the ingestor pipeline.
"""
import logging
from logging.handlers import QueueHandler
import os
from enum import Enum


class ImportResult(Enum):
    CORRECTLY = 0
    PARTIALLY = 1
    FAILED = 2
    PENDING = 3
    SKIPPED = 4


class FileNameFormatter(logging.Formatter):
    def format(self, record):
        record.filenameinfo = getattr(record, "filenameinfo", "unknown")
        return super().format(record)


def setup_logger(log_queue, filename):
    logger = logging.getLogger(filename)
    if not logger.handlers:
        if os.getenv("SERVER_ENV") == "prod":
            logger.setLevel(logging.INFO)
        else:
            logger.setLevel(logging.DEBUG)
        handler = QueueHandler(log_queue)
        logger.addHandler(handler)
        logger.propagate = False  # Prevent propagation to parent loggers
    return logger


def logger_thread(log_queue, log_file):
    handler = logging.FileHandler(log_file)
    formatter = FileNameFormatter(
        "%(asctime)s - %(filenameinfo)s - %(levelname)s - %(message)s"
    )
    handler.setFormatter(formatter)

    while True:
        try:
            record = log_queue.get()
            if record is None:
                break
            # Format and write the log record
            message = formatter.format(record)
            handler.stream.write(message + "\n")
            handler.stream.flush()
        except Exception:
            import traceback
            import sys

            print("[ERR] Error in logger thread:", file=sys.stderr)
            traceback.print_exc(file=sys.stderr)


def setup_direct_logger(log_file, filename, pid=None):
    """Setup a logger that writes directly to the log file without using a queue."""
    # Create a unique logger name using the process ID
    logger_name = f"{filename}_{pid}" if pid else filename
    logger = logging.getLogger(logger_name)

    if not logger.handlers:
        handler = logging.FileHandler(log_file)
        formatter = logging.Formatter("%(asctime)s - %(filenameinfo)s - %(levelname)s - %(message)s")
        handler.setFormatter(formatter)
        logger.addHandler(handler)

        if os.getenv("SERVER_ENV") == "prod":
            logger.setLevel(logging.INFO)
        else:
            logger.setLevel(logging.DEBUG)

    # Add filename info to the logger's extra info
    extra = {"filenameinfo": filename}
    logger = logging.LoggerAdapter(logger, extra)

    return logger