Skip to content

Commit 3559fff

Browse files
authored
refactor: remove excessive logging (#2576)
Co-authored-by: Oli Morris <[email protected]>
1 parent 859bc37 commit 3559fff

File tree

1 file changed

+0
-34
lines changed

1 file changed

+0
-34
lines changed

lua/codecompanion/interactions/chat/edit_tracker.lua

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ function EditTracker.init(chat)
4747
edit_counter = 0,
4848
baseline_content = {}, -- Map of path/bufnr -> true original content
4949
}
50-
log:info("[Edit Tracker] Initialized edit tracking for chat %d", chat.id)
5150
end
5251

5352
---Generate a unique key for tracking files/buffers
@@ -109,7 +108,6 @@ function EditTracker.register_edit_operation(chat, edit_info)
109108

110109
-- Initialize tracked file if this is the first edit
111110
if not tracked[key] and key then
112-
log:info("[Edit Tracker] First edit operation for: %s", key)
113111
tracked[key] = {
114112
type = edit_info.bufnr and "buffer" or "file",
115113
path = edit_info.path,
@@ -121,7 +119,6 @@ function EditTracker.register_edit_operation(chat, edit_info)
121119
-- Store the baseline original content (before any tools ran)
122120
if not chat.edit_tracker.baseline_content[key] then
123121
chat.edit_tracker.baseline_content[key] = vim.deepcopy(edit_info.original_content)
124-
log:debug("[Edit Tracker] Stored baseline content for: %s", key)
125122
end
126123
else
127124
tracked[key].last_edit_timestamp = current_timestamp
@@ -305,7 +302,6 @@ end
305302
---@param chat CodeCompanion.Chat
306303
---@return nil
307304
function EditTracker.clear(chat)
308-
log:info("[Edit Tracker] Clearing all tracked edits for chat %d", chat.id)
309305
if chat.edit_tracker then
310306
EditTracker.get_edit_stats(chat)
311307
chat.edit_tracker.tracked_files = {}
@@ -324,7 +320,6 @@ function EditTracker.handle_chat_close(chat)
324320
if stats.pending_operations == 0 then
325321
return
326322
end
327-
log:info("[Edit Tracker] Auto-accepting all pending operations for closing chat")
328323
for _, tracked_file in pairs(chat.edit_tracker.tracked_files) do
329324
for _, operation in ipairs(tracked_file.edit_operations) do
330325
if operation.status == "pending" then
@@ -346,7 +341,6 @@ function EditTracker.start_tool_monitoring(tool_name, chat, tool_args)
346341
return
347342
end
348343

349-
log:info("[Edit Tracker] Starting tool monitoring for: %s", tool_name)
350344
local target_files = {}
351345
local buffer_snapshots = {}
352346
if tool_args and tool_args.path then
@@ -423,11 +417,6 @@ function EditTracker.finish_tool_monitoring(tool_name, chat, success)
423417
return 0
424418
end
425419
local monitor = chat._tool_monitors[tool_name]
426-
log:info(
427-
"[Edit Tracker] Finishing monitoring and detecting changes for tool: %s (success=%s)",
428-
tool_name,
429-
tostring(success)
430-
)
431420

432421
-- Don't skip change detection for rejected tools - we want to track them
433422
-- Only skip for actual errors where no meaningful changes were made
@@ -469,9 +458,7 @@ function EditTracker.finish_tool_monitoring(tool_name, chat, success)
469458

470459
-- Mark as rejected if tool was not successful (rejected by user)
471460
if edit_id and not success then
472-
log:debug("[Edit Tracker] Marking edit %s as rejected for tool %s", edit_id, tool_name)
473461
EditTracker.update_edit_status(chat, edit_id, "rejected")
474-
log:debug("[Edit Tracker] Edit %s status updated to rejected", edit_id)
475462
end
476463

477464
if edit_id then
@@ -540,9 +527,7 @@ function EditTracker.finish_tool_monitoring(tool_name, chat, success)
540527

541528
-- Mark as rejected if tool was not successful (rejected by user)
542529
if edit_id and not success then
543-
log:debug("[Edit Tracker] Marking file edit %s as rejected for tool %s", edit_id, tool_name)
544530
EditTracker.update_edit_status(chat, edit_id, "rejected")
545-
log:debug("[Edit Tracker] File edit %s status updated to rejected", edit_id)
546531
end
547532
if edit_id then
548533
detected_edits = detected_edits + 1
@@ -573,25 +558,6 @@ function EditTracker.finish_tool_monitoring(tool_name, chat, success)
573558

574559
chat._tool_monitors[tool_name] = nil
575560

576-
-- Report results
577-
if detected_edits > 0 then
578-
log:debug(
579-
"[Edit Tracker] %d file changes detected for tool: %s (success=%s)",
580-
detected_edits,
581-
tool_name,
582-
tostring(success)
583-
)
584-
585-
-- Debug: Log current state of all tracked edits
586-
local stats = EditTracker.get_edit_stats(chat)
587-
log:debug(
588-
"[Edit Tracker] Current stats after %s: %d accepted, %d rejected, %d total",
589-
tool_name,
590-
stats.accepted_operations,
591-
stats.rejected_operations,
592-
stats.total_operations
593-
)
594-
end
595561
if #detection_results.errors > 0 then
596562
log:warn("[Edit Tracker] %d errors during auto-detection for tool %s", #detection_results.errors, tool_name)
597563
end

0 commit comments

Comments
 (0)