From f1007771997bd0401516eda87a7e0ac92f269680 Mon Sep 17 00:00:00 2001 From: adamdottv <2363879+adamdottv@users.noreply.github.com> Date: Fri, 9 May 2025 13:37:13 -0500 Subject: wip: logging improvements --- internal/llm/tools/edit.go | 12 ++++++------ internal/llm/tools/patch.go | 8 ++++---- internal/llm/tools/write.go | 6 +++--- 3 files changed, 13 insertions(+), 13 deletions(-) (limited to 'internal/llm/tools') diff --git a/internal/llm/tools/edit.go b/internal/llm/tools/edit.go index a5f0687cb..44787f525 100644 --- a/internal/llm/tools/edit.go +++ b/internal/llm/tools/edit.go @@ -12,9 +12,9 @@ import ( "github.com/opencode-ai/opencode/internal/config" "github.com/opencode-ai/opencode/internal/diff" "github.com/opencode-ai/opencode/internal/history" - "github.com/opencode-ai/opencode/internal/logging" "github.com/opencode-ai/opencode/internal/lsp" "github.com/opencode-ai/opencode/internal/permission" + "log/slog" ) type EditParams struct { @@ -234,7 +234,7 @@ func (e *editTool) createNewFile(ctx context.Context, filePath, content string) _, err = e.files.CreateVersion(ctx, sessionID, filePath, content) if err != nil { // Log error but don't fail the operation - logging.Debug("Error creating file history version", "error", err) + slog.Debug("Error creating file history version", "error", err) } recordFileWrite(filePath) @@ -347,13 +347,13 @@ func (e *editTool) deleteContent(ctx context.Context, filePath, oldString string // User Manually changed the content store an intermediate version _, err = e.files.CreateVersion(ctx, sessionID, filePath, oldContent) if err != nil { - logging.Debug("Error creating file history version", "error", err) + slog.Debug("Error creating file history version", "error", err) } } // Store the new version _, err = e.files.CreateVersion(ctx, sessionID, filePath, "") if err != nil { - logging.Debug("Error creating file history version", "error", err) + slog.Debug("Error creating file history version", "error", err) } recordFileWrite(filePath) @@ -467,13 +467,13 @@ func (e *editTool) replaceContent(ctx context.Context, filePath, oldString, newS // User Manually changed the content store an intermediate version _, err = e.files.CreateVersion(ctx, sessionID, filePath, oldContent) if err != nil { - logging.Debug("Error creating file history version", "error", err) + slog.Debug("Error creating file history version", "error", err) } } // Store the new version _, err = e.files.CreateVersion(ctx, sessionID, filePath, newContent) if err != nil { - logging.Debug("Error creating file history version", "error", err) + slog.Debug("Error creating file history version", "error", err) } recordFileWrite(filePath) diff --git a/internal/llm/tools/patch.go b/internal/llm/tools/patch.go index dcd3027b5..e0c0bf5bc 100644 --- a/internal/llm/tools/patch.go +++ b/internal/llm/tools/patch.go @@ -11,9 +11,9 @@ import ( "github.com/opencode-ai/opencode/internal/config" "github.com/opencode-ai/opencode/internal/diff" "github.com/opencode-ai/opencode/internal/history" - "github.com/opencode-ai/opencode/internal/logging" "github.com/opencode-ai/opencode/internal/lsp" "github.com/opencode-ai/opencode/internal/permission" + "log/slog" ) type PatchParams struct { @@ -318,7 +318,7 @@ func (p *patchTool) Run(ctx context.Context, call ToolCall) (ToolResponse, error // If not adding a file, create history entry for existing file _, err = p.files.Create(ctx, sessionID, absPath, oldContent) if err != nil { - logging.Debug("Error creating file history", "error", err) + slog.Debug("Error creating file history", "error", err) } } @@ -326,7 +326,7 @@ func (p *patchTool) Run(ctx context.Context, call ToolCall) (ToolResponse, error // User manually changed content, store intermediate version _, err = p.files.CreateVersion(ctx, sessionID, absPath, oldContent) if err != nil { - logging.Debug("Error creating file history version", "error", err) + slog.Debug("Error creating file history version", "error", err) } } @@ -337,7 +337,7 @@ func (p *patchTool) Run(ctx context.Context, call ToolCall) (ToolResponse, error _, err = p.files.CreateVersion(ctx, sessionID, absPath, newContent) } if err != nil { - logging.Debug("Error creating file history version", "error", err) + slog.Debug("Error creating file history version", "error", err) } // Record file operations diff --git a/internal/llm/tools/write.go b/internal/llm/tools/write.go index decc51e47..617d69c29 100644 --- a/internal/llm/tools/write.go +++ b/internal/llm/tools/write.go @@ -12,9 +12,9 @@ import ( "github.com/opencode-ai/opencode/internal/config" "github.com/opencode-ai/opencode/internal/diff" "github.com/opencode-ai/opencode/internal/history" - "github.com/opencode-ai/opencode/internal/logging" "github.com/opencode-ai/opencode/internal/lsp" "github.com/opencode-ai/opencode/internal/permission" + "log/slog" ) type WriteParams struct { @@ -201,13 +201,13 @@ func (w *writeTool) Run(ctx context.Context, call ToolCall) (ToolResponse, error // User Manually changed the content store an intermediate version _, err = w.files.CreateVersion(ctx, sessionID, filePath, oldContent) if err != nil { - logging.Debug("Error creating file history version", "error", err) + slog.Debug("Error creating file history version", "error", err) } } // Store the new version _, err = w.files.CreateVersion(ctx, sessionID, filePath, params.Content) if err != nil { - logging.Debug("Error creating file history version", "error", err) + slog.Debug("Error creating file history version", "error", err) } recordFileWrite(filePath) -- cgit v1.2.3