Skip to content

Commit

Permalink
cli: Cleanup MaybeLogFile
Browse files Browse the repository at this point in the history
  • Loading branch information
wader committed Sep 12, 2021
1 parent 6420928 commit 22eb53d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkg/cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,11 @@ func MaybeProfile() func() {
}

func MaybeLogFile() {
// used during dev to redirect log to file, useful when debugging repl etc
if lf := os.Getenv("LOGFILE"); lf != "" {
log.SetOutput(func() io.Writer { f, _ := os.Create(lf); return f }())
if f, err := os.Create(lf); err == nil {
log.SetOutput(f)
}
}
}

Expand Down

0 comments on commit 22eb53d

Please sign in to comment.