-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLogs.py
More file actions
32 lines (22 loc) · 1.03 KB
/
Copy pathLogs.py
File metadata and controls
32 lines (22 loc) · 1.03 KB
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
from datetime import datetime
# Initialize online_agents dictionary to store agent information
online_agents = {}
def track_agent_activity(agent_id, activity):
if agent_id not in online_agents:
online_agents[agent_id] = {'last_activity': None, 'activities': []}
online_agents[agent_id]['last_activity'] = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
online_agents[agent_id]['activities'].append(activity)
def update_online_agents(agent_id):
if agent_id not in online_agents:
online_agents[agent_id] = {'last_activity': None, 'activities': []}
def view_online_agents():
print("Online Agents:")
for agent_id, agent_info in online_agents.items():
print(f"Agent ID: {agent_id}, Last Activity: {agent_info['last_activity']}")
def view_agent_activities(agent_id):
if agent_id in online_agents:
print(f"Activities for Agent ID {agent_id}:")
for activity in online_agents[agent_id]['activities']:
print(activity)
else:
print(f"Agent ID {agent_id} not found.")