From e40f86b446870c4f8873c6e0fef7680649437be6 Mon Sep 17 00:00:00 2001 From: Michael Bolin Date: Mon, 2 Jun 2025 13:31:33 -0700 Subject: [PATCH] chore: logging cleanup (#1196) Update what we log to make `RUST_LOG=debug` a bit easier to work with. --- [//]: # (BEGIN SAPLING FOOTER) Stack created with [Sapling](https://sapling-scm.com). Best reviewed with [ReviewStack](https://reviewstack.dev/openai/codex/pull/1196). * #1167 * __->__ #1196 --- codex-rs/core/src/client.rs | 16 ++++++++++++++-- codex-rs/core/src/openai_tools.rs | 1 - 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/codex-rs/core/src/client.rs b/codex-rs/core/src/client.rs index 034cfaec..6eb20149 100644 --- a/codex-rs/core/src/client.rs +++ b/codex-rs/core/src/client.rs @@ -117,8 +117,7 @@ impl ModelClient { let base_url = self.provider.base_url.clone(); let base_url = base_url.trim_end_matches('/'); let url = format!("{}/responses", base_url); - debug!(url, "POST"); - trace!("request payload: {}", serde_json::to_string(&payload)?); + trace!("POST to {url}: {}", serde_json::to_string(&payload)?); let mut attempt = 0; loop { @@ -303,6 +302,19 @@ where }; }; } + "response.content_part.done" + | "response.created" + | "response.function_call_arguments.delta" + | "response.in_progress" + | "response.output_item.added" + | "response.output_text.delta" + | "response.output_text.done" + | "response.reasoning_summary_part.added" + | "response.reasoning_summary_text.delta" + | "response.reasoning_summary_text.done" => { + // Currently, we ignore these events, but we handle them + // separately to skip the logging message in the `other` case. + } other => debug!(other, "sse event"), } } diff --git a/codex-rs/core/src/openai_tools.rs b/codex-rs/core/src/openai_tools.rs index 0cbdcae0..ef12a629 100644 --- a/codex-rs/core/src/openai_tools.rs +++ b/codex-rs/core/src/openai_tools.rs @@ -93,7 +93,6 @@ pub(crate) fn create_tools_json_for_responses_api( .map(|(name, tool)| mcp_tool_to_openai_tool(name, tool)), ); - tracing::debug!("tools_json: {}", serde_json::to_string_pretty(&tools_json)?); Ok(tools_json) }