Add logs when we use deprecated flags

This commit is contained in:
Tim Hockin 2023-02-16 13:28:24 -08:00
parent e025726d0d
commit 31e2a2669d
No known key found for this signature in database
1 changed files with 7 additions and 2 deletions

View File

@ -227,7 +227,7 @@ func envMultiString(keys []string, def string) string {
for i, key := range keys { for i, key := range keys {
if val := os.Getenv(key); val != "" { if val := os.Getenv(key); val != "" {
if i != 0 { if i != 0 {
fmt.Fprintf(os.Stderr, "Env %s has been deprecated, use %s instead\n", key, keys[0]) fmt.Fprintf(os.Stderr, "env %s has been deprecated, use %s instead\n", key, keys[0])
} }
return val return val
} }
@ -252,7 +252,7 @@ func envMultiBool(keys []string, def bool) bool {
parsed, err := strconv.ParseBool(val) parsed, err := strconv.ParseBool(val)
if err == nil { if err == nil {
if i != 0 { if i != 0 {
fmt.Fprintf(os.Stderr, "Env %s has been deprecated, use %s instead\n", key, keys[0]) fmt.Fprintf(os.Stderr, "env %s has been deprecated, use %s instead\n", key, keys[0])
} }
return parsed return parsed
} }
@ -383,6 +383,7 @@ func main() {
if *flDest != "" { if *flDest != "" {
// Back-compat // Back-compat
log.V(1).Info("setting --link from deprecated --dest")
*flLink = *flDest *flLink = *flDest
} }
if *flLink == "" { if *flLink == "" {
@ -395,6 +396,7 @@ func main() {
if *flWait != 0 { if *flWait != 0 {
// Back-compat // Back-compat
log.V(1).Info("setting --period from deprecated --wait")
*flPeriod = time.Duration(int(*flWait*1000)) * time.Millisecond *flPeriod = time.Duration(int(*flWait*1000)) * time.Millisecond
} }
if *flPeriod < 10*time.Millisecond { if *flPeriod < 10*time.Millisecond {
@ -421,6 +423,7 @@ func main() {
if *flTimeout != 0 { if *flTimeout != 0 {
// Back-compat // Back-compat
log.V(1).Info("setting --sync-timeout from deprecated --timeout")
*flSyncTimeout = time.Duration(*flTimeout) * time.Second *flSyncTimeout = time.Duration(*flTimeout) * time.Second
} }
if *flSyncTimeout < 10*time.Millisecond { if *flSyncTimeout < 10*time.Millisecond {
@ -429,6 +432,7 @@ func main() {
if *flMaxSyncFailures != 0 { if *flMaxSyncFailures != 0 {
// Back-compat // Back-compat
log.V(1).Info("setting --max-failures from deprecated --max-sync-failures")
*flMaxFailures = *flMaxSyncFailures *flMaxFailures = *flMaxSyncFailures
} }
@ -441,6 +445,7 @@ func main() {
if *flSyncHookCommand != "" { if *flSyncHookCommand != "" {
// Back-compat // Back-compat
log.V(1).Info("setting --exechook-command from deprecated --sync-hook-command")
*flExechookCommand = *flSyncHookCommand *flExechookCommand = *flSyncHookCommand
} }
if *flExechookCommand != "" { if *flExechookCommand != "" {