commit 8a31312ca11f75eeb070ba30e25ba2096418e941 Author: Arlo Breault arlolra@gmail.com Date: Thu Mar 8 16:05:33 2018 -0500
Provide a flag to Log to state dir --- client/snowflake.go | 10 ++++++++++ 1 file changed, 10 insertions(+)
diff --git a/client/snowflake.go b/client/snowflake.go index b958a7f..3b8a248 100644 --- a/client/snowflake.go +++ b/client/snowflake.go @@ -10,6 +10,7 @@ import ( "net" "os" "os/signal" + "path/filepath" "strings" "sync" "syscall" @@ -126,13 +127,22 @@ func main() { brokerURL := flag.String("url", "", "URL of signaling broker") frontDomain := flag.String("front", "", "front domain") logFilename := flag.String("log", "", "name of log file") + logToStateDir := flag.Bool("logToStateDir", false, "resolve the log file relative to tor's pt state dir") max := flag.Int("max", DefaultSnowflakeCapacity, "capacity for number of multiplexed WebRTC peers") flag.Parse()
webrtc.SetLoggingVerbosity(1) log.SetFlags(log.LstdFlags | log.LUTC) + if *logFilename != "" { + if *logToStateDir { + stateDir, err := pt.MakeStateDir() + if err != nil { + log.Fatal(err) + } + *logFilename = filepath.Join(stateDir, *logFilename) + } logFile, err := os.OpenFile(*logFilename, os.O_CREATE|os.O_APPEND|os.O_WRONLY, 0600) if err != nil {
tor-commits@lists.torproject.org