Add file logging to agent — writes to /workspace/agent.log
This commit is contained in:
@@ -217,8 +217,18 @@ def execute_skill(script_path, args):
|
|||||||
TOOLS, SKILL_SCRIPTS = discover_skills()
|
TOOLS, SKILL_SCRIPTS = discover_skills()
|
||||||
|
|
||||||
|
|
||||||
|
LOG_FILE = f"{WORKSPACE}/agent.log" if os.path.isdir(WORKSPACE) else None
|
||||||
|
|
||||||
|
|
||||||
def log(msg):
|
def log(msg):
|
||||||
print(f"[agent:{NICK}] {msg}", flush=True)
|
line = f"[{time.strftime('%H:%M:%S')}] {msg}"
|
||||||
|
print(f"[agent:{NICK}] {line}", flush=True)
|
||||||
|
if LOG_FILE:
|
||||||
|
try:
|
||||||
|
with open(LOG_FILE, "a") as f:
|
||||||
|
f.write(line + "\n")
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
log(f"Loaded {len(TOOLS)} skills: {', '.join(SKILL_SCRIPTS.keys())}")
|
log(f"Loaded {len(TOOLS)} skills: {', '.join(SKILL_SCRIPTS.keys())}")
|
||||||
|
|||||||
Reference in New Issue
Block a user