Spaces:
Running
Running
Download src/observers/debug_observer.py from latishab/tars-conversation-app: direct link, hf CLI and curl.
- Browser
- Download file 846 Bytes
-
https://huggingface.co/spaces/latishab/tars-conversation-app/resolve/main/src/observers/debug_observer.py
- Command line
-
hf download hf://spaces/latishab/tars-conversation-app/src/observers/debug_observer.py
-
curl -L -o debug_observer.py https://huggingface.co/spaces/latishab/tars-conversation-app/resolve/main/src/observers/debug_observer.py
846 Bytes
| """Observer for general purpose debug logging.""" | |
| from loguru import logger | |
| from pipecat.observers.base_observer import BaseObserver, FramePushed | |
| class DebugObserver(BaseObserver): | |
| """General purpose debug logger for non-media frames.""" | |
| def __init__(self, label="Debug"): | |
| super().__init__() | |
| self.label = label | |
| async def on_push_frame(self, data: FramePushed): | |
| """Watch frames as they're pushed through the pipeline.""" | |
| frame = data.frame | |
| frame_type = type(frame).__name__ | |
| if "Audio" not in frame_type and "Video" not in frame_type and "Image" not in frame_type: | |
| # Log the User ID so we can verify they match | |
| uid = getattr(frame, 'user_id', 'None') | |
| logger.info(f"🔍 [{self.label}] {frame_type} | User: '{uid}' | Content: {str(frame)[:100]}") | |