lib/logger: prettify logging the defined command-line flags

This commit is contained in:
Aliaksandr Valialkin 2022-08-07 22:58:29 +03:00
parent ebd59e17df
commit 9fa6b25fb2
No known key found for this signature in database
GPG key ID: A72BEC6CD3D0DED1

View file

@ -10,13 +10,13 @@ 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")
flag.Visit(func(f *flag.Flag) { flag.Visit(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"
} }
Infof("flag %q=%q", f.Name, value) Infof(" -%s=%q", f.Name, value)
}) })
} }