[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [snowflake/master] Add a -log option to server-webrtc.
commit 9ebde38b3fe3cb1d957049ae1f0f9490be7eee1b
Author: David Fifield <david@xxxxxxxxxxxxxxx>
Date: Sun Jul 16 15:02:41 2017 -0700
Add a -log option to server-webrtc.
---
server-webrtc/snowflake.go | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/server-webrtc/snowflake.go b/server-webrtc/snowflake.go
index b74dcbd..b95829d 100644
--- a/server-webrtc/snowflake.go
+++ b/server-webrtc/snowflake.go
@@ -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)
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits