commit 21e27d3b3c02fb6153d7e75c8da046dd6e647063 Author: David Fifield david@bamsoftware.com Date: Fri Jan 20 09:30:00 2017 -0800
Use log.Fatalf instead of log.Printf + os.Exit in server. --- server/server.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/server/server.go b/server/server.go index 07b496c..b525569 100644 --- a/server/server.go +++ b/server/server.go @@ -228,11 +228,11 @@ func main() { flag.StringVar(&logFilename, "log", "", "log file to write to") flag.Parse()
+ log.SetFlags(log.LstdFlags | log.LUTC) if logFilename != "" { f, err := os.OpenFile(logFilename, os.O_CREATE|os.O_APPEND|os.O_WRONLY, 0600) if err != nil { - fmt.Fprintf(os.Stderr, "Can't open log file %q: %s.\n", logFilename, err.Error()) - os.Exit(1) + log.Fatalf("Can't open log file %q: %s.", logFilename, err.Error()) } log.SetOutput(f) } @@ -247,13 +247,11 @@ func main() { } }
- log.SetFlags(log.LstdFlags | log.LUTC) log.Printf("starting") var err error ptInfo, err = pt.ServerSetup(nil) if err != nil { - log.Printf("error in setup: %s", err) - os.Exit(1) + log.Fatalf("error in setup: %s", err) }
listeners := make([]net.Listener, 0)
tor-commits@lists.torproject.org