1.3 Новые уровни логгера (ФИКСИТЬ!!!)

This commit is contained in:
Verum
2025-02-26 11:18:15 +07:00
parent 8c2e0e4246
commit ce5000ceba
2 changed files with 24 additions and 9 deletions

View File

@@ -16,9 +16,15 @@ async def setup_logger() -> None:
"""
logger.remove() # Удаляем все логгеры
if BotLogs.permission or BotLogs.permission_to_file:
if BotLogs.permission and BotLogs.permission_to_file:
# Добавляем новый уровень START
logger.level("START", no=25, color="white", icon="🔸")
if BotLogs.permission and BotLogs.permission_new_user:
# Добавляем новый уровень NEW_USER
logger.level("NEW_USER", no=4, color="white", icon="👋")
if BotLogs.permission and BotLogs.permission_leave_user:
# Добавляем новый уровень LEAVE_USER
logger.level("LEAVE_USER", no=3, color="white", icon="🫰")
# Настройка логирования в консоль для каждого уровня
if BotLogs.permission:

View File

@@ -13,9 +13,18 @@ class BotLogs:
permission_to_file: bool = Permissions.logging_to_file
permission_msg: bool = Permissions.msg_logging
permission_new_user: bool = Permissions.new_user
permission_leave_user: bool = Permissions.leave_user
# Максимальный размер лог-файла
max_size: str = "500 MB"
# Шаблон логов для отладки
new_user_text: str = (
"<cyan>{time:YYYY-MM-DD HH:mm:ss}</cyan> <red>|</red> "
"<magenta>{extra[system]}-{extra[log_type]}</magenta> <red>|</red> "
"<yellow>{extra[user]}</yellow> <red>|</red> <level>{message}</level>"
)
# Шаблон логов для старта
start_text: str = (