mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-14 05:11:19 -04:00
Add a -log option to server-webrtc.
This commit is contained in:
parent
86a244c39e
commit
9ebde38b3f
1 changed files with 9 additions and 5 deletions
|
@ -219,17 +219,21 @@ func receiveSignalsFIFO(filename string, config *webrtc.Configuration) error {
|
|||
func main() {
|
||||
var err error
|
||||
var httpAddr string
|
||||
var logFilename string
|
||||
|
||||
flag.StringVar(&httpAddr, "http", "", "listen for HTTP signaling")
|
||||
flag.StringVar(&logFilename, "log", "", "log file to write to")
|
||||
flag.Parse()
|
||||
|
||||
log.SetFlags(log.LstdFlags | log.LUTC)
|
||||
logFile, err = os.OpenFile("snowflake.log", os.O_CREATE|os.O_APPEND|os.O_WRONLY, 0600)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
if logFilename != "" {
|
||||
f, err := os.OpenFile(logFilename, os.O_CREATE|os.O_APPEND|os.O_WRONLY, 0600)
|
||||
if err != nil {
|
||||
log.Fatalf("can't open log file: %s", err)
|
||||
}
|
||||
defer logFile.Close()
|
||||
log.SetOutput(f)
|
||||
}
|
||||
defer logFile.Close()
|
||||
log.SetOutput(logFile)
|
||||
|
||||
log.Println("starting")
|
||||
webrtc.SetLoggingVerbosity(1)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue