Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Make logging optional and controlled by a -log option.
Loading branch information
Showing
1 changed file
with
14 additions
and
16 deletions .
+14
−16
client/snowflake.go
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -10,7 +10,6 @@ import (
"net"
"os"
"os/signal"
"path"
"sync"
"syscall"
"time"
@@ -122,29 +121,28 @@ func copyLoop(a, b io.ReadWriter) {
}
func main () {
webrtc .SetLoggingVerbosity (1 )
stateDir , err := pt .MakeStateDir ()
if err != nil {
log .Fatal (err )
}
logFile , err := os .OpenFile (path .Join (stateDir , "snowflake.log" ),
os .O_CREATE | os .O_APPEND | os .O_WRONLY , 0600 )
if err != nil {
log .Fatal (err )
}
defer logFile .Close ()
log .SetOutput (logFile )
var iceServers IceServerList
log .Println ("\n \n \n --- Starting Snowflake Client ---" )
flag .Var (& iceServers , "ice" , "comma-separated list of ICE servers" )
brokerURL := flag .String ("url" , "" , "URL of signaling broker" )
frontDomain := flag .String ("front" , "" , "front domain" )
logFilename := flag .String ("log" , "" , "name of log file" )
max := flag .Int ("max" , DefaultSnowflakeCapacity ,
"capacity for number of multiplexed WebRTC peers" )
flag .Parse ()
webrtc .SetLoggingVerbosity (1 )
if * logFilename != "" {
logFile , err := os .OpenFile (* logFilename ,
os .O_CREATE | os .O_APPEND | os .O_WRONLY , 0600 )
if err != nil {
log .Fatal (err )
}
defer logFile .Close ()
log .SetOutput (logFile )
}
log .Println ("\n \n \n --- Starting Snowflake Client ---" )
// Prepare to collect remote WebRTC peers.
snowflakes := NewPeers (* max )
if "" != * brokerURL {
Toggle all file notes
Toggle all file annotations