-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(assistants, orchestrator, utils): enhance logging and error hand…
…ling - Add logging setup with rotating file handler and rich tracebacks - Create custom exception classes for better error handling - Refactor assistants module to use new logging and exceptions - Refactor orchestrator to use new logging, exceptions, and helper methods - Update tests to handle new exceptions - Add .gitignore entries for logs directory and output files
- Loading branch information
Showing
7 changed files
with
169 additions
and
124 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -78,4 +78,7 @@ concatenated_files.txt | |
copy_py_files.py | ||
|
||
# An empty output folder | ||
output/ | ||
output/ | ||
|
||
# Logs | ||
logs/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,5 +10,5 @@ | |
"settings", | ||
"Orchestrator", | ||
"Task", | ||
"TaskExchange" | ||
"TaskExchange", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
class SAAOrchestratorError(Exception): | ||
"""Base exception class for SAA Orchestrator""" | ||
|
||
|
||
class AssistantError(SAAOrchestratorError): | ||
"""Raised when there's an error with an AI assistant""" | ||
|
||
|
||
class WorkflowError(SAAOrchestratorError): | ||
"""Raised when there's an error in the workflow execution""" | ||
|
||
|
||
class ConfigurationError(SAAOrchestratorError): | ||
"""Raised when there's an error in the configuration""" | ||
|
||
|
||
class PluginError(SAAOrchestratorError): | ||
"""Raised when there's an error with a plugin""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import logging | ||
import os | ||
from logging.handlers import RotatingFileHandler | ||
|
||
from rich.logging import RichHandler | ||
|
||
|
||
def setup_logging(log_level=logging.INFO, log_file="saa_orchestrator.log"): | ||
# Create logs directory if it doesn't exist | ||
logs_dir = os.path.join(os.getcwd(), "logs") | ||
os.makedirs(logs_dir, exist_ok=True) | ||
|
||
# Configure root logger | ||
logging.basicConfig( | ||
level=log_level, | ||
format="%(asctime)s - %(name)s - %(levelname)s - %(message)s", | ||
datefmt="%Y-%m-%d %H:%M:%S", | ||
handlers=[ | ||
RichHandler(rich_tracebacks=True), | ||
RotatingFileHandler( | ||
os.path.join(logs_dir, log_file), | ||
maxBytes=10_000_000, # 10MB | ||
backupCount=5, | ||
), | ||
], | ||
) | ||
|
||
# Create a logger for this module | ||
logger = logging.getLogger(__name__) | ||
|
||
return logger | ||
|
||
|
||
# Usage example | ||
logger = setup_logging() |
Oops, something went wrong.