🦄 refactor(log): colorful log

This commit is contained in:
kalicyh
2025-02-18 00:07:19 +08:00
parent 921e3c2c75
commit 2acee60d73
32 changed files with 423 additions and 190 deletions
+5 -4
View File
@@ -1,15 +1,16 @@
import logging
from config.logger import setup_logging
import json
from core.handle.abortHandle import handleAbortMessage
from core.handle.helloHandle import handleHelloMessage
from core.handle.audioHandle import startToChat
logger = logging.getLogger(__name__)
TAG = __name__
logger = setup_logging()
async def handleTextMessage(conn, message):
"""处理文本消息"""
logger.info(f"收到文本消息:{message}")
logger.bind(tag=TAG).info(f"收到文本消息:{message}")
try:
msg_json = json.loads(message)
if isinstance(msg_json, int):
@@ -22,7 +23,7 @@ async def handleTextMessage(conn, message):
elif msg_json["type"] == "listen":
if "mode" in msg_json:
conn.client_listen_mode = msg_json["mode"]
logger.debug(f"客户端拾音模式:{conn.client_listen_mode}")
logger.bind(tag=TAG).debug(f"客户端拾音模式:{conn.client_listen_mode}")
if msg_json["state"] == "start":
conn.client_have_voice = True
conn.client_voice_stop = False