@@ -23,12 +23,14 @@ import (
2323
2424 "github.com/hashicorp/go-hclog"
2525 "github.com/hashicorp/go-plugin"
26+ "github.com/rs/zerolog"
2627)
2728
2829// Manager handles loading and managing plugins.
2930type Manager struct {
3031 plugins map [string ]* LoadedPlugin
3132 pluginClients map [string ]* plugin.Client
33+ logger * zerolog.Logger
3234}
3335
3436// LoadedPlugin represents a loaded plugin with its metadata.
@@ -39,10 +41,11 @@ type LoadedPlugin struct {
3941}
4042
4143// NewManager creates a new plugin manager.
42- func NewManager () * Manager {
44+ func NewManager (logger * zerolog. Logger ) * Manager {
4345 return & Manager {
4446 plugins : make (map [string ]* LoadedPlugin ),
4547 pluginClients : make (map [string ]* plugin.Client ),
48+ logger : logger ,
4649 }
4750}
4851
@@ -62,7 +65,8 @@ func (m *Manager) LoadPlugins(ctx context.Context) error {
6265 for _ , plugin := range plugins {
6366 // Load the plugin - if there is an error just skip it - we can think of a better strategy later
6467 if err := m .loadPlugin (ctx , plugin ); err != nil {
65- fmt .Printf ("failed to load plugin: %s\n " , err )
68+ m .logger .Error ().Msgf ("failed to load plugin: %s" , plugin )
69+ m .logger .Debug ().Err (err ).Msgf ("plugin loading failure reason: %s" , plugin )
6670 continue
6771 }
6872 }
0 commit comments