Deprecate log_level and log_file_path in LightRAG.
- Remove log_level from API initialization - Add warnings for deprecated logging params
This commit is contained in:
@@ -3,6 +3,7 @@ from __future__ import annotations
|
||||
import asyncio
|
||||
import configparser
|
||||
import os
|
||||
import warnings
|
||||
from dataclasses import asdict, dataclass, field
|
||||
from datetime import datetime
|
||||
from functools import partial
|
||||
@@ -85,14 +86,10 @@ class LightRAG:
|
||||
doc_status_storage: str = field(default="JsonDocStatusStorage")
|
||||
"""Storage type for tracking document processing statuses."""
|
||||
|
||||
# Logging
|
||||
# Logging (Deprecated, use setup_logger in utils.py instead)
|
||||
# ---
|
||||
|
||||
log_level: int = field(default=logger.level)
|
||||
"""Logging level for the system (e.g., 'DEBUG', 'INFO', 'WARNING')."""
|
||||
|
||||
log_file_path: str = field(default=os.path.join(os.getcwd(), "lightrag.log"))
|
||||
"""Log file path."""
|
||||
|
||||
# Entity extraction
|
||||
# ---
|
||||
@@ -270,6 +267,24 @@ class LightRAG:
|
||||
initialize_share_data,
|
||||
)
|
||||
|
||||
# Handle deprecated parameters
|
||||
kwargs = self.__dict__
|
||||
if "log_level" in kwargs:
|
||||
warnings.warn(
|
||||
"WARNING: log_level parameter is deprecated, use setup_logger in utils.py instead",
|
||||
UserWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
# Remove the attribute to prevent its use
|
||||
delattr(self, "log_level")
|
||||
if "log_file_path" in kwargs:
|
||||
warnings.warn(
|
||||
"WARNING: log_file_path parameter is deprecated, use setup_logger in utils.py instead",
|
||||
UserWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
delattr(self, "log_file_path")
|
||||
|
||||
initialize_share_data()
|
||||
|
||||
if not os.path.exists(self.working_dir):
|
||||
|
Reference in New Issue
Block a user