From 5a5674c36c44b2f8154fac2520cbf08817e4ef95 Mon Sep 17 00:00:00 2001 From: ritoban23 Date: Wed, 5 Nov 2025 12:32:14 +0530 Subject: [PATCH] Convert pkg/cmd/load_plugins.go to slog - Replace log.Output() calls with slog.Debug() for structured logging - Remove 'log' import and use 'log/slog' instead - Removes the settings.Debug checks in favor of slog's built-in log level handling - Improves logging consistency across the codebase Fixes #13454 Signed-off-by: ritoban23 --- pkg/cmd/load_plugins.go | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/pkg/cmd/load_plugins.go b/pkg/cmd/load_plugins.go index 534113bde..f5b863a2f 100644 --- a/pkg/cmd/load_plugins.go +++ b/pkg/cmd/load_plugins.go @@ -20,7 +20,7 @@ import ( "context" "fmt" "io" - "log" + "log/slog" "os" "path/filepath" "slices" @@ -217,9 +217,7 @@ func loadCompletionForPlugin(pluginCmd *cobra.Command, plug plugin.Plugin) { if err != nil { // The file could be missing or invalid. No static completion for this plugin. - if settings.Debug { - log.Output(2, fmt.Sprintf("[info] %s\n", err.Error())) - } + slog.Debug("plugin completion file loading", "error", err.Error()) // Continue to setup dynamic completion. cmds = &pluginCommand{} } @@ -239,9 +237,7 @@ func addPluginCommands(plug plugin.Plugin, baseCmd *cobra.Command, cmds *pluginC if len(cmds.Name) == 0 { // Missing name for a command - if settings.Debug { - log.Output(2, fmt.Sprintf("[info] sub-command name field missing for %s", baseCmd.CommandPath())) - } + slog.Debug("sub-command name field missing", "commandPath", baseCmd.CommandPath()) return }