chore(logging): stream backend logs to console + instrument dispatch/notify

This commit is contained in:
Abhimanyu Saharan
2026-02-02 20:51:08 +05:30
parent 0caaaa1cb4
commit 8cd32124cd
5 changed files with 106 additions and 1 deletions

View File

@@ -1,10 +1,13 @@
from __future__ import annotations
import logging
import os
from typing import Any
import requests
logger = logging.getLogger("app.openclaw")
class OpenClawClient:
def __init__(self, base_url: str, token: str):
@@ -28,6 +31,9 @@ class OpenClawClient:
timeout_s: float = 5.0,
) -> dict[str, Any]:
payload: dict[str, Any] = {"tool": tool, "args": args}
logger.info(
"openclaw.tools_invoke", extra={"tool": tool, "has_session_key": bool(session_key)}
)
if session_key is not None:
payload["sessionKey"] = session_key
@@ -38,4 +44,5 @@ class OpenClawClient:
timeout=timeout_s,
)
r.raise_for_status()
logger.info("openclaw.tools_invoke: ok", extra={"tool": tool, "status": r.status_code})
return r.json()