fix: add multi writer

add multi writer to support both file output and std out
pull/1813/head
Johannes Kresner 10 months ago
parent 9c8dfec947
commit 07d200b353

@ -4,6 +4,7 @@ import (
"bufio"
"errors"
"fmt"
"io"
"os"
"regexp"
"strings"
@ -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

Loading…
Cancel
Save