init.py 文件源码

python
阅读 41 收藏 0 点赞 0 评论 0

项目:Grating_Advanced_Simulation_Platform 作者: GratingLaboratories 项目源码 文件源码
def format(self, record):
        stdout_template = '{levelname}' + Fore.RESET + '] {threadName}: ' + '{message}'
        stdout_head = '[%s'

        allFormats = {
            logging.DEBUG: logging.StrFormatStyle(stdout_head % Fore.LIGHTBLUE_EX + stdout_template),
            logging.INFO: logging.StrFormatStyle(stdout_head % Fore.GREEN + stdout_template),
            logging.WARNING: logging.StrFormatStyle(stdout_head % Fore.LIGHTYELLOW_EX + stdout_template),
            logging.ERROR: logging.StrFormatStyle(stdout_head % Fore.LIGHTRED_EX + stdout_template),
            logging.CRITICAL: logging.StrFormatStyle(stdout_head % Fore.RED + stdout_template)
        }

        self._style = allFormats.get(record.levelno, logging.StrFormatStyle(logging._STYLES['{'][1]))
        self._fmt = self._style._fmt
        result = logging.Formatter.format(self, record)

        return result
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号