Optimize logger message

This commit is contained in:
yangdx 2025-07-24 02:13:39 +08:00
parent 42710221f5
commit 5a5d32dc32
3 changed files with 6 additions and 4 deletions

View file

@ -536,7 +536,7 @@ class MilvusVectorDBStorage(BaseVectorStorage):
# Load the collection if it's not already loaded
# In Milvus, collections need to be loaded before they can be searched
self._client.load_collection(self.namespace)
logger.debug(f"Collection {self.namespace} loaded successfully")
# logger.debug(f"Collection {self.namespace} loaded successfully")
except Exception as e:
logger.error(f"Failed to load collection {self.namespace}: {e}")

View file

@ -2795,7 +2795,7 @@ async def _find_related_text_unit_from_relationships(
# Extract chunk IDs from entity_chunks
entity_chunk_ids = set()
for chunk in entity_chunks:
chunk_id = chunk.get("chunk_id") or chunk.get("id")
chunk_id = chunk.get("chunk_id")
if chunk_id:
entity_chunk_ids.add(chunk_id)
@ -2808,7 +2808,7 @@ async def _find_related_text_unit_from_relationships(
]
logger.debug(
f"Deduplication with entity chunks: {original_count} -> {len(selected_chunk_ids)} chunks "
f"Deduplication relation-chunks with entity-chunks: {original_count} -> {len(selected_chunk_ids)} chunks "
)
# Early return if no chunks remain after deduplication

View file

@ -85,8 +85,10 @@ def verbose_debug(msg: str, *args, **kwargs):
formatted_msg = msg
# Then truncate the formatted message
truncated_msg = (
formatted_msg[:100] + "..." if len(formatted_msg) > 100 else formatted_msg
formatted_msg[:150] + "..." if len(formatted_msg) > 150 else formatted_msg
)
# Remove consecutive newlines
truncated_msg = re.sub(r"\n+", "\n", truncated_msg)
logger.debug(truncated_msg, **kwargs)