Framework for orchestrating role-playing, autonomous AI agents. By fostering collaborative intelligence, CrewAI empowers agents to work together seamlessly, tackling complex tasks.
Fix/logger - fix #1412 (#1413)
Shahar Yair42871d9ffc6e
diff --git a/src/crewai/crew.py b/src/crewai/crew.pyindex 422f64248..7d936a8ad 100644--- a/src/crewai/crew.py+++ b/src/crewai/crew.py@@ -771,7 +771,7 @@ class Crew(BaseModel):def _log_task_start(self, task: Task, role: str = "None"):if self.output_log_file:- self._file_handler.log(agent=role, task=task.description, status="started")+ self._file_handler.log(task_name=task.name, task=task.description, agent=role, status="started")def _update_manager_tools(self, task: Task):if self.manager_agent:@@ -793,7 +793,7 @@ class Crew(BaseModel):def _process_task_result(self, task: Task, output: TaskOutput) -> None:role = task.agent.role if task.agent is not None else "None"if self.output_log_file:- self._file_handler.log(agent=role, task=output, status="completed")+ self._file_handler.log(task_name=task.name, task=task.description, agent=role, status="completed", output=output.raw)def _create_crew_output(self, task_outputs: List[TaskOutput]) -> CrewOutput:if len(task_outputs) != 1:diff --git a/src/crewai/utilities/file_handler.py b/src/crewai/utilities/file_handler.pyindex 1125cae4e..091bd930a 100644--- a/src/crewai/utilities/file_handler.py+++ b/src/crewai/utilities/file_handler.py@@ -16,7 +16,7 @@ class FileHandler:def log(self, **kwargs):now = datetime.now().strftime("%Y-%m-%d %H:%M:%S")- message = f"{now}: ".join([f"{key}={value}" for key, value in kwargs.items()])+ message = f"{now}: " + ", ".join([f"{key}=\"{value}\"" for key, value in kwargs.items()]) + "\n"with open(self._path, "a", encoding="utf-8") as file:file.write(message + "\n")