fix(config): Correctly print removal version info (#15937)
This commit is contained in:
parent
83f6710fec
commit
697f7e9e3f
|
|
@ -366,7 +366,7 @@ func PrintOptionDeprecationNotice(plugin, option string, info telegraf.Deprecati
|
||||||
prefix := deprecationPrefix(di.logLevel)
|
prefix := deprecationPrefix(di.logLevel)
|
||||||
log.Printf(
|
log.Printf(
|
||||||
"%s: Option %q of plugin %q deprecated since version %s and will be removed in %s: %s",
|
"%s: Option %q of plugin %q deprecated since version %s and will be removed in %s: %s",
|
||||||
prefix, option, plugin, info.Since, info.RemovalIn, info.Notice,
|
prefix, option, plugin, di.info.Since, di.info.RemovalIn, di.info.Notice,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -387,7 +387,7 @@ func PrintOptionValueDeprecationNotice(plugin, option string, value interface{},
|
||||||
prefix := deprecationPrefix(di.logLevel)
|
prefix := deprecationPrefix(di.logLevel)
|
||||||
log.Printf(
|
log.Printf(
|
||||||
`%s: Value "%+v" for option %q of plugin %q deprecated since version %s and will be removed in %s: %s`,
|
`%s: Value "%+v" for option %q of plugin %q deprecated since version %s and will be removed in %s: %s`,
|
||||||
prefix, value, option, plugin, info.Since, info.RemovalIn, info.Notice,
|
prefix, value, option, plugin, di.info.Since, di.info.RemovalIn, di.info.Notice,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -106,6 +106,12 @@ func TestPluginOptionDeprecation(t *testing.T) {
|
||||||
expectedLevel: telegraf.Warn,
|
expectedLevel: telegraf.Warn,
|
||||||
expected: `Option "option" of plugin "test" deprecated since version 1.23.0 and will be removed in 2.0.0: please check`,
|
expected: `Option "option" of plugin "test" deprecated since version 1.23.0 and will be removed in 2.0.0: please check`,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "No removal info",
|
||||||
|
since: "1.23.0",
|
||||||
|
expectedLevel: telegraf.Warn,
|
||||||
|
expected: `Option "option" of plugin "test" deprecated since version 1.23.0 and will be removed in 2.0.0: please check`,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: "None",
|
name: "None",
|
||||||
expectedLevel: telegraf.None,
|
expectedLevel: telegraf.None,
|
||||||
|
|
@ -190,6 +196,13 @@ func TestPluginOptionValueDeprecation(t *testing.T) {
|
||||||
expected: `Value "foobar" for option "option" of plugin "test" deprecated since version 1.25.0 and will be removed in 2.0.0: please check`,
|
expected: `Value "foobar" for option "option" of plugin "test" deprecated since version 1.25.0 and will be removed in 2.0.0: please check`,
|
||||||
expectedLevel: telegraf.Warn,
|
expectedLevel: telegraf.Warn,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "No removal info",
|
||||||
|
since: "1.25.0",
|
||||||
|
value: "foobar",
|
||||||
|
expected: `Value "foobar" for option "option" of plugin "test" deprecated since version 1.25.0 and will be removed in 2.0.0: please check`,
|
||||||
|
expectedLevel: telegraf.Warn,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: "None",
|
name: "None",
|
||||||
expected: ``,
|
expected: ``,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue