feat: Improve error logging on plugin initialization (#10307)

This commit is contained in:
Thomas Casteleyn 2021-12-21 16:59:47 +01:00 committed by GitHub
parent a57aaddb0d
commit 9f7e8befae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -196,28 +196,28 @@ func (a *Agent) initPlugins() error {
err := processor.Init() err := processor.Init()
if err != nil { if err != nil {
return fmt.Errorf("could not initialize processor %s: %v", return fmt.Errorf("could not initialize processor %s: %v",
processor.Config.Name, err) processor.LogName(), err)
} }
} }
for _, aggregator := range a.Config.Aggregators { for _, aggregator := range a.Config.Aggregators {
err := aggregator.Init() err := aggregator.Init()
if err != nil { if err != nil {
return fmt.Errorf("could not initialize aggregator %s: %v", return fmt.Errorf("could not initialize aggregator %s: %v",
aggregator.Config.Name, err) aggregator.LogName(), err)
} }
} }
for _, processor := range a.Config.AggProcessors { for _, processor := range a.Config.AggProcessors {
err := processor.Init() err := processor.Init()
if err != nil { if err != nil {
return fmt.Errorf("could not initialize processor %s: %v", return fmt.Errorf("could not initialize processor %s: %v",
processor.Config.Name, err) processor.LogName(), err)
} }
} }
for _, output := range a.Config.Outputs { for _, output := range a.Config.Outputs {
err := output.Init() err := output.Init()
if err != nil { if err != nil {
return fmt.Errorf("could not initialize output %s: %v", return fmt.Errorf("could not initialize output %s: %v",
output.Config.Name, err) output.LogName(), err)
} }
} }
return nil return nil