Skip to content

Commit

Permalink
Remove color from deprecation output.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sven Rebhan committed Nov 11, 2021
1 parent 82226a9 commit 3b95f31
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
12 changes: 5 additions & 7 deletions config/deprecation.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ import (
"strconv"
"strings"

"github.com/fatih/color"

"github.com/influxdata/telegraf"
"github.com/influxdata/telegraf/plugins/aggregators"
"github.com/influxdata/telegraf/plugins/inputs"
Expand Down Expand Up @@ -167,12 +165,12 @@ func (c *Config) printUserDeprecation(category, name string, plugin interface{})

switch info.Level {
case Warn:
prefix := "W! " + color.YellowString("DeprecationWarning")
prefix := "W! DeprecationWarning"
printPluginDeprecationNotice(prefix, info.Name, info.info)
// We will not check for any deprecated options as the whole plugin is deprecated anyway.
return nil
case Error:
prefix := "E! " + color.RedString("DeprecationError")
prefix := "E! DeprecationError"
printPluginDeprecationNotice(prefix, info.Name, info.info)
// We are past the grace period
return fmt.Errorf("plugin deprecated")
Expand All @@ -183,10 +181,10 @@ func (c *Config) printUserDeprecation(category, name string, plugin interface{})
for _, option := range info.Options {
switch option.Level {
case Warn:
prefix := "W! " + color.YellowString("DeprecationWarning")
prefix := "W! DeprecationWarning"
printOptionDeprecationNotice(prefix, info.Name, option.Name, option.info)
case Error:
prefix := "E! " + color.RedString("DeprecationError")
prefix := "E! DeprecationError"
printOptionDeprecationNotice(prefix, info.Name, option.Name, option.info)
deprecatedOptions = append(deprecatedOptions, option.Name)
}
Expand Down Expand Up @@ -287,7 +285,7 @@ func (c *Config) PrintDeprecationList(plugins []pluginDeprecationInfo) {
}

func printHistoricPluginDeprecationNotice(category, name string, info telegraf.DeprecationInfo) {
prefix := "E! " + color.RedString("DeprecationError")
prefix := "E! DeprecationError"
log.Printf(
"%s: Plugin %q deprecated since version %s and removed: %s",
prefix, category+"."+name, info.Since, info.Notice,
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ require (
github.com/eapache/queue v1.1.0 // indirect
github.com/echlebek/timeproxy v1.0.0 // indirect
github.com/eclipse/paho.mqtt.golang v1.3.0
github.com/fatih/color v1.10.0
github.com/fatih/color v1.10.0 // indirect
github.com/form3tech-oss/jwt-go v3.2.5+incompatible // indirect
github.com/ghodss/yaml v1.0.1-0.20190212211648-25d852aebe32
github.com/go-logfmt/logfmt v0.5.0
Expand Down

0 comments on commit 3b95f31

Please sign in to comment.