Print version, help etc to stdout

The default behavior of kingpin lib is to print stuff to stderr. This is now changed by using the os.Stdout writer. Now information like version and help text will be printed to stdout.

Signed-off-by: don-philipe <don_philipe@gmx.de>
This commit is contained in:
don-philipe 2022-09-21 23:05:42 +02:00 committed by GitHub
parent aecad1a2fa
commit 00d82daaf2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -265,6 +265,7 @@ func main() {
promlogConfig := &promlog.Config{}
flag.AddFlags(kingpin.CommandLine, promlogConfig)
kingpin.Version(version.Print("statsd_exporter"))
kingpin.CommandLine.UsageWriter(os.Stdout)
kingpin.HelpFlag.Short('h')
kingpin.Parse()
logger := promlog.New(promlogConfig)