VictoriaMetrics/lib/logger/flag.go
Aliaksandr Valialkin d0e7c0535e
lib/logger: show only explicitly set command-line flags in logs
This reduces initial verbosity in logs
2021-10-28 11:00:52 +03:00

23 lines
463 B
Go

package logger
import (
"flag"
"strings"
"github.com/VictoriaMetrics/VictoriaMetrics/lib/buildinfo"
"github.com/VictoriaMetrics/VictoriaMetrics/lib/flagutil"
)
func logAllFlags() {
Infof("build version: %s", buildinfo.Version)
Infof("command line flags")
flag.Visit(func(f *flag.Flag) {
lname := strings.ToLower(f.Name)
value := f.Value.String()
if flagutil.IsSecretFlag(lname) {
value = "secret"
}
Infof("flag %q=%q", f.Name, value)
})
}