Refactor: use logger = logging.getLogger(__name__) in logging (#24515)

Co-authored-by: Yongtao Huang <99629139+hyongtao-db@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: crazywoola <100913391+crazywoola@users.noreply.github.com>
This commit is contained in:
Yongtao Huang
2025-08-26 18:10:31 +08:00
committed by GitHub
parent 8af2ae973f
commit fa753239ad
102 changed files with 565 additions and 401 deletions

View File

@@ -10,6 +10,8 @@ from models.model import Message, MessageAnnotation, MessageFeedback
from models.tools import ToolConversationVariables, ToolFile
from models.web import PinnedConversation
logger = logging.getLogger(__name__)
@shared_task(queue="conversation")
def delete_conversation_related_data(conversation_id: str) -> None:
@@ -20,7 +22,7 @@ def delete_conversation_related_data(conversation_id: str) -> None:
conversation_id: conversation Id
"""
logging.info(
logger.info(
click.style(f"Starting to delete conversation data from db for conversation_id {conversation_id}", fg="green")
)
start_at = time.perf_counter()
@@ -53,7 +55,7 @@ def delete_conversation_related_data(conversation_id: str) -> None:
db.session.commit()
end_at = time.perf_counter()
logging.info(
logger.info(
click.style(
f"Succeeded cleaning data from db for conversation_id {conversation_id} latency: {end_at - start_at}",
fg="green",
@@ -61,7 +63,7 @@ def delete_conversation_related_data(conversation_id: str) -> None:
)
except Exception as e:
logging.exception("Failed to delete data from db for conversation_id: %s failed", conversation_id)
logger.exception("Failed to delete data from db for conversation_id: %s failed", conversation_id)
db.session.rollback()
raise e
finally: