Document and add support to input plugins for logging alias (#6357)

This commit is contained in:
Greg
2019-09-23 16:39:50 -06:00
committed by Daniel Nelson
parent e42d2e39c6
commit 817c9a69a9
111 changed files with 961 additions and 659 deletions

View File

@@ -4,7 +4,6 @@ import (
"bufio"
"fmt"
"io"
"log"
"net/url"
"regexp"
"strconv"
@@ -23,6 +22,8 @@ type Redis struct {
Password string
tls.ClientConfig
Log telegraf.Logger
clients []Client
initialized bool
}
@@ -101,13 +102,13 @@ func (r *Redis) init(acc telegraf.Accumulator) error {
for i, serv := range r.Servers {
if !strings.HasPrefix(serv, "tcp://") && !strings.HasPrefix(serv, "unix://") {
log.Printf("W! [inputs.redis]: server URL found without scheme; please update your configuration file")
r.Log.Warn("Server URL found without scheme; please update your configuration file")
serv = "tcp://" + serv
}
u, err := url.Parse(serv)
if err != nil {
return fmt.Errorf("Unable to parse to address %q: %v", serv, err)
return fmt.Errorf("unable to parse to address %q: %s", serv, err.Error())
}
password := ""

View File

@@ -20,6 +20,7 @@ func TestRedisConnect(t *testing.T) {
addr := fmt.Sprintf(testutil.GetLocalHost() + ":6379")
r := &Redis{
Log: testutil.Logger{},
Servers: []string{addr},
}