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
init.py 文件源码
python
阅读 41
收藏 0
点赞 0
评论 0
评论列表
文章目录