mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-09 16:18:30 +00:00
Enhance Event Listener with Rich Visualization and Improved Logging (#2321)
* Enhance Event Listener with Rich Visualization and Improved Logging * Add verbose flag to EventListener for controlled logging * Update crew test to set EventListener verbose flag * Refactor EventListener logging and visualization with improved tool usage tracking * Improve task logging with task ID display in EventListener * Fix EventListener tool branch removal and type hinting * Add type hints to EventListener class attributes * Simplify EventListener import in Crew class * Refactor EventListener tree node creation and remove unused method * Refactor EventListener to utilize ConsoleFormatter for improved logging and visualization * Enhance EventListener with property setters for crew, task, agent, tool, flow, and method branches to streamline state management * Refactor crew test to instantiate EventListener and set verbose flags for improved clarity in logging * Keep private parts private * Remove unused import and clean up type hints in EventListener * Enhance flow logging in EventListener and ConsoleFormatter by including flow ID in tree creation and status updates for better traceability. --------- Co-authored-by: Brandon Hancock <brandon@brandonhancock.io> Co-authored-by: Brandon Hancock (bhancock_ai) <109994880+bhancockio@users.noreply.github.com>
This commit is contained in:
@@ -54,6 +54,7 @@ from crewai.utilities.events.crew_events import (
|
||||
CrewTrainStartedEvent,
|
||||
)
|
||||
from crewai.utilities.events.crewai_event_bus import crewai_event_bus
|
||||
from crewai.utilities.events.event_listener import EventListener
|
||||
from crewai.utilities.formatter import (
|
||||
aggregate_raw_outputs_from_task_outputs,
|
||||
aggregate_raw_outputs_from_tasks,
|
||||
@@ -248,7 +249,11 @@ class Crew(BaseModel):
|
||||
@model_validator(mode="after")
|
||||
def set_private_attrs(self) -> "Crew":
|
||||
"""Set private attributes."""
|
||||
|
||||
self._cache_handler = CacheHandler()
|
||||
event_listener = EventListener()
|
||||
event_listener.verbose = self.verbose
|
||||
event_listener.formatter.verbose = self.verbose
|
||||
self._logger = Logger(verbose=self.verbose)
|
||||
if self.output_log_file:
|
||||
self._file_handler = FileHandler(self.output_log_file)
|
||||
|
||||
Reference in New Issue
Block a user