Fix logger initialization in exec input (#6492)

This commit is contained in:
Daniel Nelson
2019-10-07 12:18:36 -07:00
committed by GitHub
parent d7988915e9
commit 74c7dd3ce7
3 changed files with 11 additions and 7 deletions

View File

@@ -10,13 +10,12 @@ import (
"sync"
"time"
"github.com/kballard/go-shellquote"
"github.com/influxdata/telegraf"
"github.com/influxdata/telegraf/internal"
"github.com/influxdata/telegraf/plugins/inputs"
"github.com/influxdata/telegraf/plugins/parsers"
"github.com/influxdata/telegraf/plugins/parsers/nagios"
"github.com/kballard/go-shellquote"
)
const sampleConfig = `
@@ -50,7 +49,7 @@ type Exec struct {
parser parsers.Parser
runner Runner
log telegraf.Logger
Log telegraf.Logger `toml:"-"`
}
func NewExec() *Exec {
@@ -161,7 +160,7 @@ func (e *Exec) ProcessCommand(command string, acc telegraf.Accumulator, wg *sync
if isNagios {
metrics, err = nagios.TryAddState(runErr, metrics)
if err != nil {
e.log.Errorf("Failed to add nagios state: %s", err)
e.Log.Errorf("Failed to add nagios state: %s", err)
}
}