thoughts_tool/utils/
logging.rs1use crate::documents::active_logs_dir;
7use agentic_logging::{CallTimer, LogWriter, ToolCallRecord};
8
9pub fn log_tool_call(
14 timer: &CallTimer,
15 tool: &str,
16 request: serde_json::Value,
17 success: bool,
18 error: Option<String>,
19 summary: Option<serde_json::Value>,
20) {
21 let writer = match active_logs_dir() {
22 Ok(dir) => LogWriter::new(dir),
23 Err(_) => return, };
25
26 let (completed_at, duration_ms) = timer.finish();
27 let record = ToolCallRecord {
28 call_id: timer.call_id.clone(),
29 server: "thoughts_tool".into(),
30 tool: tool.into(),
31 started_at: timer.started_at,
32 completed_at,
33 duration_ms,
34 request,
35 response_file: None,
36 success,
37 error,
38 model: None,
39 token_usage: None,
40 summary,
41 };
42
43 if let Err(e) = writer.append_jsonl(&record) {
44 tracing::warn!("Failed to append JSONL log: {}", e);
45 }
46}