-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathlogs.py
More file actions
35 lines (27 loc) Β· 1016 Bytes
/
logs.py
File metadata and controls
35 lines (27 loc) Β· 1016 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
"""
CLI command for serving logs with file watching and real-time updates.
"""
import sys
from pathlib import Path
from ..utils.logs_server import serve_logs
def logs_command(args):
"""Serve logs with file watching and real-time updates"""
port = args.port
print("π Starting Eval Protocol Logs Server")
print(f"π URL: http://localhost:{port}")
print(f"π WebSocket: ws://localhost:{port}/ws")
print(f"π Watching paths: {['current directory']}")
print("Press Ctrl+C to stop the server")
print("-" * 50)
# setup Elasticsearch
from eval_protocol.pytest.elasticsearch_setup import ElasticsearchSetup
elasticsearch_config = ElasticsearchSetup().setup_elasticsearch()
try:
serve_logs(port=args.port, elasticsearch_config=elasticsearch_config)
return 0
except KeyboardInterrupt:
print("\nπ Server stopped by user")
return 0
except Exception as e:
print(f"β Error starting server: {e}")
return 1