mirror of
https://github.com/containrrr/watchtower.git
synced 2025-12-16 15:10:12 +01:00
fix: add multi writer
add multi writer to support both file output and std out
This commit is contained in:
parent
9c8dfec947
commit
07d200b353
1 changed files with 3 additions and 1 deletions
|
|
@ -4,6 +4,7 @@ import (
|
||||||
"bufio"
|
"bufio"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"io"
|
||||||
"os"
|
"os"
|
||||||
"regexp"
|
"regexp"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
@ -691,7 +692,8 @@ func SetupLogging(f *pflag.FlagSet) error {
|
||||||
return fmt.Errorf("failed to open log file: %e", err)
|
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
|
return nil
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue