Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update logger_factory.py #2328

Closed
wants to merge 9 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion autogen/logger/logger_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@

__all__ = ("LoggerFactory",)

try:
from autogen.logger.cosmos_db_logger import CosmosDBLogger
cosmos_imported = True
except ImportError:
cosmos_imported = False

class LoggerFactory:
@staticmethod
Expand All @@ -16,6 +21,9 @@ def get_logger(logger_type: str = "sqlite", config: Optional[Dict[str, Any]] = N
if logger_type == "sqlite":
return SqliteLogger(config)
elif logger_type == "cosmos":
return CosmosDBLogger(config)
if cosmos_imported:
return CosmosDBLogger(config)
else:
raise ImportError("CosmosDBLogger could not be imported. Please ensure the cosmos package is installed.")
wmwxwa marked this conversation as resolved.
Show resolved Hide resolved
else:
raise ValueError(f"[logger_factory] Unknown logger type: {logger_type}")
Loading