import{_ as s,c as i,o as a,a4 as h}from"./chunks/framework.BZiUP1E-.js";const y=JSON.parse('{"title":"liteyuki.log","description":"","frontmatter":{"title":"liteyuki.log"},"headers":[],"relativePath":"en/dev/api/log.md","filePath":"en/dev/api/log.md","lastUpdated":1725101868000}'),t={name:"en/dev/api/log.md"},k=h(`
Description: Copyright (C) 2020-2024 LiteyukiStudio. All Rights Reserved
@Time : 2024/7/27 上午9:12 @Author : snowykami @Email : snowykami@outlook.com @File : log.py @Software: PyCharm
get_format(level: str) -> str
def get_format(level: str) -> str:
if level == 'DEBUG':
return debug_format
else:
return default_format
init_log(config: dict)
Description: 在语言加载完成后执行
def init_log(config: dict):
"""
在语言加载完成后执行
Returns:
"""
logger.remove()
logger.add(sys.stdout, level=0, diagnose=False, format=get_format(config.get('log_level', 'INFO')))
show_icon = config.get('log_icon', True)
logger.level('DEBUG', color='<blue>', icon=f"{('🐛' if show_icon else '')}DEBUG")
logger.level('INFO', color='<normal>', icon=f"{('ℹ️' if show_icon else '')}INFO")
logger.level('SUCCESS', color='<green>', icon=f"{('✅' if show_icon else '')}SUCCESS")
logger.level('WARNING', color='<yellow>', icon=f"{('⚠️' if show_icon else '')}WARNING")
logger.level('ERROR', color='<red>', icon=f"{('⭕' if show_icon else '')}ERROR")