WebSocket Logs API#
The WebSocket Logs API provides a real-time streaming interface for receiving logs from all DUMB-managed subprocesses. It is primarily used by the DUMB Frontend to power the live log viewer.
๐ก WebSocket Endpoint#
/ws/logs
Connect to this endpoint using a WebSocket client (e.g., browser or Python client) to receive log lines as plain text.
๐ Message Format#
Each log entry is sent as a plain text line formatted by DUMBโs logger, for example:
Apr 12, 2025 10:04:01 - INFO - Riven Backend started
๐ Filtering Logs (Client-side)#
The server pushes all logs to connected clients. It is up to the client to filter based on:
- Process Name
- Log Level
- Search Term
The DUMB Frontend implements dropdowns and search bars for this purpose.
๐ Connection Behavior#
- The server broadcasts logs to all connected WebSocket clients.
- If the connection is dropped, reconnect using
/ws/logs. - Log history is not buffered, so missed logs are not resent on reconnect.
- Sending
{"type":"ping"}will returnpong.
๐งช Example (Python Client)#
import websockets
import asyncio
import json
async def consume_logs():
uri = "ws://localhost:8000/ws/logs"
async with websockets.connect(uri) as websocket:
async for message in websocket:
print(message)
asyncio.run(consume_logs())
๐ Related Modules#
websocket_logs.py- Logs API for historical log file access
- Frontend Log Viewer