mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2025-03-21 15:45:01 +00:00
lib/logger: show only explicitly set command-line flags in logs
This reduces initial verbosity in logs
This commit is contained in:
parent
acfda6d8fd
commit
d0e7c0535e
1 changed files with 1 additions and 9 deletions
|
@ -11,20 +11,12 @@ import (
|
||||||
func logAllFlags() {
|
func logAllFlags() {
|
||||||
Infof("build version: %s", buildinfo.Version)
|
Infof("build version: %s", buildinfo.Version)
|
||||||
Infof("command line flags")
|
Infof("command line flags")
|
||||||
isSetMap := make(map[string]bool)
|
|
||||||
flag.Visit(func(f *flag.Flag) {
|
flag.Visit(func(f *flag.Flag) {
|
||||||
isSetMap[f.Name] = true
|
|
||||||
})
|
|
||||||
flag.VisitAll(func(f *flag.Flag) {
|
|
||||||
lname := strings.ToLower(f.Name)
|
lname := strings.ToLower(f.Name)
|
||||||
value := f.Value.String()
|
value := f.Value.String()
|
||||||
if flagutil.IsSecretFlag(lname) {
|
if flagutil.IsSecretFlag(lname) {
|
||||||
value = "secret"
|
value = "secret"
|
||||||
}
|
}
|
||||||
isSet := "false"
|
Infof("flag %q=%q", f.Name, value)
|
||||||
if isSetMap[f.Name] {
|
|
||||||
isSet = "true"
|
|
||||||
}
|
|
||||||
Infof("flag %q=%q (is_set=%s)", f.Name, value, isSet)
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue