From 1a4f21cc205a06575660ef16f849674e4510860c Mon Sep 17 00:00:00 2001 From: dddennnisss Date: Wed, 15 Jul 2026 14:48:15 +0700 Subject: [PATCH] =?UTF-8?q?fix:=20=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D1=82=D1=8C=20sd=5Fworkflow=5Flogger=20=D0=B8=20=D0=BE=D1=82?= =?UTF-8?q?=D0=BD=D0=BE=D1=81=D0=B8=D1=82=D0=B5=D0=BB=D1=8C=D0=BD=D1=8B?= =?UTF-8?q?=D0=B9=20=D0=BF=D1=83=D1=82=D1=8C=20=D0=BA=20config?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index d44336d..1083ea6 100644 --- a/main.py +++ b/main.py @@ -1,6 +1,7 @@ import sys import asyncio import logging +from logging.handlers import RotatingFileHandler import os import psutil import time @@ -17,6 +18,13 @@ logging.basicConfig( ) logging.getLogger('trueconf.client.chatbot').propagate = False logger = logging.getLogger(__name__) +sd_workflow_logger = logging.getLogger('sd_workflow') +sd_workflow_logger.setLevel(logging.INFO) +if not sd_workflow_logger.handlers: + handler = RotatingFileHandler(os.path.join(os.path.dirname(__file__), 'logs', 'sd_workflow.log'), maxBytes=10*1024*1024, backupCount=5) + formatter = logging.Formatter('%(asctime)s - %(levelname)s - %(message)s') + handler.setFormatter(formatter) + sd_workflow_logger.addHandler(handler) # Добавляем путь к проекту в sys.path sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) @@ -123,7 +131,7 @@ async def main_menu(msg: Message): urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) # Импортируем SD_URL и SD_TOKEN из config import importlib.util - spec = importlib.util.spec_from_file_location("custom_config", "/opt/trueconf_bot/config/config.py") + spec = importlib.util.spec_from_file_location("custom_config", os.path.join(os.path.dirname(os.path.abspath(__file__)), "config", "config.py")) custom_config = importlib.util.module_from_spec(spec) spec.loader.exec_module(custom_config) SD_URL = custom_config.SD_URL