mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-22 14:48:13 +00:00
improving logs further
This commit is contained in:
@@ -108,6 +108,7 @@ class EventListener(BaseEventListener):
|
|||||||
event.crew_name or "Crew",
|
event.crew_name or "Crew",
|
||||||
source.id,
|
source.id,
|
||||||
"completed",
|
"completed",
|
||||||
|
event.output,
|
||||||
)
|
)
|
||||||
|
|
||||||
@crewai_event_bus.on(CrewKickoffFailedEvent)
|
@crewai_event_bus.on(CrewKickoffFailedEvent)
|
||||||
@@ -170,6 +171,7 @@ class EventListener(BaseEventListener):
|
|||||||
source.id,
|
source.id,
|
||||||
source.agent.role,
|
source.agent.role,
|
||||||
"completed",
|
"completed",
|
||||||
|
event.output,
|
||||||
)
|
)
|
||||||
|
|
||||||
# Reset branch pointers for clean state management
|
# Reset branch pointers for clean state management
|
||||||
|
|||||||
@@ -188,6 +188,7 @@ class ConsoleFormatter:
|
|||||||
crew_name: str,
|
crew_name: str,
|
||||||
source_id: str,
|
source_id: str,
|
||||||
status: str = "completed",
|
status: str = "completed",
|
||||||
|
output: Optional[Any] = None,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Handle crew tree updates with consistent formatting."""
|
"""Handle crew tree updates with consistent formatting."""
|
||||||
if not self.verbose or tree is None:
|
if not self.verbose or tree is None:
|
||||||
@@ -220,6 +221,22 @@ class ConsoleFormatter:
|
|||||||
ID=source_id,
|
ID=source_id,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Add output content if available and not in starting state
|
||||||
|
if output is not None and status in ["completed", "failed"]:
|
||||||
|
# Extract the raw output text
|
||||||
|
output_text = ""
|
||||||
|
if hasattr(output, 'raw'):
|
||||||
|
output_text = output.raw
|
||||||
|
elif isinstance(output, str):
|
||||||
|
output_text = output
|
||||||
|
else:
|
||||||
|
output_text = str(output)
|
||||||
|
|
||||||
|
display_output = output_text
|
||||||
|
|
||||||
|
content.append("\n\nOutput:\n", style="white bold")
|
||||||
|
content.append(display_output, style="white")
|
||||||
|
|
||||||
self.print_panel(content, title, style)
|
self.print_panel(content, title, style)
|
||||||
|
|
||||||
def create_crew_tree(self, crew_name: str, source_id: str) -> Optional[Tree]:
|
def create_crew_tree(self, crew_name: str, source_id: str) -> Optional[Tree]:
|
||||||
@@ -277,6 +294,7 @@ class ConsoleFormatter:
|
|||||||
task_id: str,
|
task_id: str,
|
||||||
agent_role: str,
|
agent_role: str,
|
||||||
status: str = "completed",
|
status: str = "completed",
|
||||||
|
output: Optional[Any] = None,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Update task status in the tree."""
|
"""Update task status in the tree."""
|
||||||
if not self.verbose or crew_tree is None:
|
if not self.verbose or crew_tree is None:
|
||||||
@@ -314,6 +332,23 @@ class ConsoleFormatter:
|
|||||||
content = self.create_status_content(
|
content = self.create_status_content(
|
||||||
f"Task {status.title()}", str(task_id), style, Agent=agent_role
|
f"Task {status.title()}", str(task_id), style, Agent=agent_role
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Add output content if available
|
||||||
|
if output is not None:
|
||||||
|
# Extract the raw output text
|
||||||
|
output_text = ""
|
||||||
|
if hasattr(output, 'raw'):
|
||||||
|
output_text = output.raw
|
||||||
|
elif isinstance(output, str):
|
||||||
|
output_text = output
|
||||||
|
else:
|
||||||
|
output_text = str(output)
|
||||||
|
|
||||||
|
display_output = output_text
|
||||||
|
|
||||||
|
content.append("\n\nOutput:\n", style="white bold")
|
||||||
|
content.append(display_output, style="white")
|
||||||
|
|
||||||
self.print_panel(content, panel_title, style)
|
self.print_panel(content, panel_title, style)
|
||||||
|
|
||||||
def create_agent_branch(
|
def create_agent_branch(
|
||||||
|
|||||||
Reference in New Issue
Block a user