From 3d23230ef8fedbc91c6f3c400d1a4bb2d18b632a Mon Sep 17 00:00:00 2001 From: Evans Mungai Date: Fri, 5 Sep 2025 10:00:35 +0100 Subject: [PATCH] chore: add additional logging to plugin installer Signed-off-by: Evans Mungai --- internal/plugin/installer/installer.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/internal/plugin/installer/installer.go b/internal/plugin/installer/installer.go index b65dac2f4..a6599c443 100644 --- a/internal/plugin/installer/installer.go +++ b/internal/plugin/installer/installer.go @@ -18,6 +18,7 @@ package installer import ( "errors" "fmt" + "log/slog" "net/http" "os" "path/filepath" @@ -79,6 +80,7 @@ func InstallWithOptions(i Installer, opts Options) (*VerificationResult, error) return nil, err } if _, pathErr := os.Stat(i.Path()); !os.IsNotExist(pathErr) { + slog.Warn("plugin already exists", "path", i.Path(), slog.Any("error", pathErr)) return nil, errors.New("plugin already exists") } @@ -130,6 +132,7 @@ func InstallWithOptions(i Installer, opts Options) (*VerificationResult, error) // Update updates a plugin. func Update(i Installer) error { if _, pathErr := os.Stat(i.Path()); os.IsNotExist(pathErr) { + slog.Warn("plugin does not exist", "path", i.Path(), slog.Any("error", pathErr)) return errors.New("plugin does not exist") } return i.Update() @@ -154,6 +157,7 @@ func NewForSource(source, version string) (Installer, error) { func FindSource(location string) (Installer, error) { installer, err := existingVCSRepo(location) if err != nil && err.Error() == "Cannot detect VCS" { + slog.Warn("cannot get information about plugin source", "location", location, slog.Any("error", err)) return installer, errors.New("cannot get information about plugin source") } return installer, err