1.3 Новые уровни логгера (ФИКСИТЬ!!!)
This commit is contained in:
@@ -16,9 +16,15 @@ async def setup_logger() -> None:
|
|||||||
"""
|
"""
|
||||||
logger.remove() # Удаляем все логгеры
|
logger.remove() # Удаляем все логгеры
|
||||||
|
|
||||||
if BotLogs.permission or BotLogs.permission_to_file:
|
if BotLogs.permission and BotLogs.permission_to_file:
|
||||||
# Добавляем новый уровень START
|
# Добавляем новый уровень START
|
||||||
logger.level("START", no=25, color="white", icon="🔸")
|
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:
|
if BotLogs.permission:
|
||||||
|
|||||||
@@ -9,13 +9,22 @@ class BotLogs:
|
|||||||
Класс для хранения параметров логирования: шаблоны логов, разрешения, размеры файлов и т. д.
|
Класс для хранения параметров логирования: шаблоны логов, разрешения, размеры файлов и т. д.
|
||||||
"""
|
"""
|
||||||
# Разрешение на ведение логов
|
# Разрешение на ведение логов
|
||||||
permission : bool = Permissions.logging
|
permission: bool = Permissions.logging
|
||||||
permission_to_file : bool = Permissions.logging_to_file
|
permission_to_file: bool = Permissions.logging_to_file
|
||||||
permission_msg : bool = Permissions.msg_logging
|
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"
|
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 = (
|
start_text: str = (
|
||||||
@@ -25,28 +34,28 @@ class BotLogs:
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Шаблон логов для отладки
|
# Шаблон логов для отладки
|
||||||
debug_text : str = (
|
debug_text: str = (
|
||||||
"<cyan>{time:YYYY-MM-DD HH:mm:ss}</cyan> <red>|</red> "
|
"<cyan>{time:YYYY-MM-DD HH:mm:ss}</cyan> <red>|</red> "
|
||||||
"<magenta>{extra[system]}-{extra[log_type]}</magenta> <red>|</red> "
|
"<magenta>{extra[system]}-{extra[log_type]}</magenta> <red>|</red> "
|
||||||
"<yellow>{extra[user]}</yellow> <red>|</red> <level>{message}</level>"
|
"<yellow>{extra[user]}</yellow> <red>|</red> <level>{message}</level>"
|
||||||
)
|
)
|
||||||
|
|
||||||
# Шаблон логов для информации
|
# Шаблон логов для информации
|
||||||
info_text : str = (
|
info_text: str = (
|
||||||
"<green>{time:YYYY-MM-DD HH:mm:ss}</green> <red>|</red> "
|
"<green>{time:YYYY-MM-DD HH:mm:ss}</green> <red>|</red> "
|
||||||
"<blue>{extra[system]}-{extra[log_type]}</blue> <red>|</red> "
|
"<blue>{extra[system]}-{extra[log_type]}</blue> <red>|</red> "
|
||||||
"<red>{extra[user]} |</red> <level>{message}</level>"
|
"<red>{extra[user]} |</red> <level>{message}</level>"
|
||||||
)
|
)
|
||||||
|
|
||||||
# Шаблон логов для предупреждений
|
# Шаблон логов для предупреждений
|
||||||
warning_text : str = (
|
warning_text: str = (
|
||||||
"<yellow>{time:YYYY-MM-DD HH:mm:ss}</yellow> <red>|</red> "
|
"<yellow>{time:YYYY-MM-DD HH:mm:ss}</yellow> <red>|</red> "
|
||||||
"<yellow>{extra[system]}-{extra[log_type]}</yellow> <red>|</red> "
|
"<yellow>{extra[system]}-{extra[log_type]}</yellow> <red>|</red> "
|
||||||
"<red>{extra[user]} |</red> <level>{message}</level>"
|
"<red>{extra[user]} |</red> <level>{message}</level>"
|
||||||
)
|
)
|
||||||
|
|
||||||
# Шаблон логов для ошибок
|
# Шаблон логов для ошибок
|
||||||
error_text : str = (
|
error_text: str = (
|
||||||
"<level>{time:YYYY-MM-DD HH:mm:ss} | "
|
"<level>{time:YYYY-MM-DD HH:mm:ss} | "
|
||||||
"<bold>{extra[system]}-{extra[log_type]}</bold> | "
|
"<bold>{extra[system]}-{extra[log_type]}</bold> | "
|
||||||
"{extra[user]} | {message}</level>"
|
"{extra[user]} | {message}</level>"
|
||||||
|
|||||||
Reference in New Issue
Block a user