diff --git a/main.go b/main.go index 82ca7aad..e2e46313 100644 --- a/main.go +++ b/main.go @@ -100,12 +100,18 @@ func main() { default: log.SetFormatter(&log.TextFormatter{}) } + if *showVersion { + log.SetOutput(os.Stdout) + } log.Printf("Redis Metrics Exporter %s build date: %s sha1: %s Go: %s GOOS: %s GOARCH: %s", BuildVersion, BuildDate, BuildCommitSha, runtime.Version(), runtime.GOOS, runtime.GOARCH, ) + if *showVersion { + return + } if *isDebug { log.SetLevel(log.DebugLevel) log.Debugln("Enabling debug output") @@ -113,10 +119,6 @@ func main() { log.SetLevel(log.InfoLevel) } - if *showVersion { - return - } - to, err := time.ParseDuration(*connectionTimeout) if err != nil { log.Fatalf("Couldn't parse connection timeout duration, err: %s", err)