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

22 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)
})
}