From 3b95f310f0e8f99835f9e7555a6fbda25f66a402 Mon Sep 17 00:00:00 2001 From: Sven Rebhan Date: Thu, 11 Nov 2021 10:36:21 +0100 Subject: [PATCH] Remove color from deprecation output. --- config/deprecation.go | 12 +++++------- go.mod | 2 +- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/config/deprecation.go b/config/deprecation.go index ca1d2d71c8dda..4e9f17b6b31e6 100644 --- a/config/deprecation.go +++ b/config/deprecation.go @@ -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" @@ -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") @@ -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) } @@ -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, diff --git a/go.mod b/go.mod index 9c816468a3508..625386db84383 100644 --- a/go.mod +++ b/go.mod @@ -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