Fix duplicate log print issue

This commit is contained in:
z060142 2025-05-16 02:26:28 +08:00
parent dad375dec8
commit e3e3d3b914
2 changed files with 4 additions and 2 deletions

1
.gitignore vendored
View File

@ -3,6 +3,7 @@
llm_debug.log
config.py
config.py.bak
simple_bubble_dedup.json
__pycache__/
debug_screenshots/
chat_logs/

View File

@ -69,6 +69,7 @@ keep_monitoring_flag.set()
# logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
# Setup logger instance. This can be configured further if needed.
logger = logging.getLogger(__name__)
logger.propagate = False
if not logger.handlers: # Avoid adding multiple handlers if script is reloaded
handler = logging.StreamHandler()
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
@ -2783,8 +2784,8 @@ else: # HAS_SOCKETIO is False
# ===============================================================
if __name__ == "__main__":
# Setup main logger for the application if not already done
if not logging.getLogger().handlers: # Check root logger
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
#if not logging.getLogger().handlers: # Check root logger
# logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
app = WolfChatSetup()
app.protocol("WM_DELETE_WINDOW", app.on_closing) # Handle window close button