Commit 21e27d3b authored by David Fifield's avatar David Fifield
Browse files

Use log.Fatalf instead of log.Printf + os.Exit in server.

parent 11f3bbe3
...@@ -228,11 +228,11 @@ func main() { ...@@ -228,11 +228,11 @@ func main() {
flag.StringVar(&logFilename, "log", "", "log file to write to") flag.StringVar(&logFilename, "log", "", "log file to write to")
flag.Parse() flag.Parse()
log.SetFlags(log.LstdFlags | log.LUTC)
if logFilename != "" { if logFilename != "" {
f, err := os.OpenFile(logFilename, os.O_CREATE|os.O_APPEND|os.O_WRONLY, 0600) f, err := os.OpenFile(logFilename, os.O_CREATE|os.O_APPEND|os.O_WRONLY, 0600)
if err != nil { if err != nil {
fmt.Fprintf(os.Stderr, "Can't open log file %q: %s.\n", logFilename, err.Error()) log.Fatalf("Can't open log file %q: %s.", logFilename, err.Error())
os.Exit(1)
} }
log.SetOutput(f) log.SetOutput(f)
} }
...@@ -247,13 +247,11 @@ func main() { ...@@ -247,13 +247,11 @@ func main() {
} }
} }
log.SetFlags(log.LstdFlags | log.LUTC)
log.Printf("starting") log.Printf("starting")
var err error var err error
ptInfo, err = pt.ServerSetup(nil) ptInfo, err = pt.ServerSetup(nil)
if err != nil { if err != nil {
log.Printf("error in setup: %s", err) log.Fatalf("error in setup: %s", err)
os.Exit(1)
} }
listeners := make([]net.Listener, 0) listeners := make([]net.Listener, 0)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment