Skip to content

Commit

Permalink
print version to stdout when -version flag is used (#662)
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanmdavidson authored Jun 14, 2022
1 parent 5eed1e4 commit be3ea8e
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,23 +100,25 @@ 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")
} else {
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)
Expand Down

0 comments on commit be3ea8e

Please sign in to comment.