Skip to content

Commit

Permalink
fix: add multi writer
Browse files Browse the repository at this point in the history
add multi writer to support both file output and std out
  • Loading branch information
jokresner committed Jan 26, 2024
1 parent 9c8dfec commit 07d200b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion internal/flags/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"bufio"
"errors"
"fmt"
"io"
"os"
"regexp"
"strings"
Expand Down Expand Up @@ -691,7 +692,8 @@ func SetupLogging(f *pflag.FlagSet) error {
return fmt.Errorf("failed to open log file: %e", err)
}
}
log.SetOutput(logFile)
multiWriter := io.MultiWriter(os.Stdout, os.Stderr, logFile)
log.SetOutput(multiWriter)
}

return nil
Expand Down

0 comments on commit 07d200b

Please sign in to comment.