mirror of
https://github.com/instructkr/claude-code.git
synced 2026-05-28 16:36:45 +00:00
feat(tools): add LoggingAspect to unified tool dispatch entry point
Adds aspect-rs AOP-style logging to execute_tool_with_enforcer, providing cross-cutting arg/result logging for all tool dispatches. Introduces aspect-core, aspect-macros, and aspect-std dependencies.
This commit is contained in:
@@ -15,6 +15,10 @@ reqwest = { version = "0.12", default-features = false, features = ["blocking",
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
serde_json.workspace = true
|
||||
tokio = { version = "1", features = ["rt-multi-thread"] }
|
||||
aspect-core = "0.1"
|
||||
aspect-macros = "0.1"
|
||||
aspect-std = "0.1"
|
||||
log = "0.4"
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
@@ -3,6 +3,9 @@ use std::path::{Path, PathBuf};
|
||||
use std::process::Command;
|
||||
use std::time::{Duration, Instant};
|
||||
|
||||
use aspect_macros::aspect;
|
||||
use aspect_std::LoggingAspect;
|
||||
|
||||
use api::{
|
||||
max_tokens_for_model, model_family_identity_for, resolve_model_alias, ApiError,
|
||||
ContentBlockDelta, InputContentBlock, InputMessage, MessageRequest, MessageResponse,
|
||||
@@ -1199,6 +1202,7 @@ pub fn execute_tool(name: &str, input: &Value) -> Result<String, String> {
|
||||
}
|
||||
|
||||
#[allow(clippy::too_many_lines)]
|
||||
#[aspect(LoggingAspect::new().log_args().log_result())]
|
||||
fn execute_tool_with_enforcer(
|
||||
enforcer: Option<&PermissionEnforcer>,
|
||||
name: &str,
|
||||
|
||||
Reference in New Issue
Block a user