fix sync /chat call to agents service

This commit is contained in:
Ramnique Singh 2025-04-05 00:37:20 +05:30
parent 57693b36cc
commit a59d8c3ed3
6 changed files with 29 additions and 31 deletions

View file

@ -9,15 +9,12 @@ from openai import OpenAI
load_dotenv()
def setup_logger(name, log_file='./run.log', level=logging.INFO, log_to_file=True):
def setup_logger(name, log_file='./run.log', level=logging.INFO, log_to_file=False):
"""Function to set up a logger with a specific name and log file."""
formatter = logging.Formatter('%(asctime)s %(levelname)s [%(filename)s:%(lineno)d] %(message)s')
if log_to_file:
handler = logging.FileHandler(log_file)
else:
handler = logging.StreamHandler(sys.stdout)
# Changed to use stderr instead of stdout
handler = logging.StreamHandler(sys.stderr)
handler.setFormatter(formatter)
# Create a logger and set its level