diff --git a/cmd/gateway/main.go b/cmd/gateway/main.go index 7aa627a..c97d405 100644 --- a/cmd/gateway/main.go +++ b/cmd/gateway/main.go @@ -24,7 +24,7 @@ func main() { // Create the connection to the server. conn, err := grpc.Dial(fmt.Sprintf("%s:%d", *serverAddr, *serverPort)) if err != nil { - fmt.Printf("Failed to connect: %v", err) + log.Fatal(err) } // Defer closing the connection. @@ -41,8 +41,8 @@ func main() { http.HandleFunc("/change_password", gateway.ChangePassword(client)) // Listen for requests. - fmt.Printf("Forwarding from :%d to %s:%d", *port, *serverAddr, *serverPort) + log.Printf("Forwarding from :%d to %s:%d", *port, *serverAddr, *serverPort) if err := http.ListenAndServe(fmt.Sprintf(":%d", *port), nil); err != nil { - fmt.Printf("Failed to listen: %v", err) + log.Fatal(err) } } diff --git a/cmd/server/main.go b/cmd/server/main.go index 661423f..f66beda 100644 --- a/cmd/server/main.go +++ b/cmd/server/main.go @@ -3,6 +3,7 @@ package main import ( "flag" "fmt" + "log" "net" "git.chrishayward.xyz/x/users/proto" @@ -33,7 +34,7 @@ func main() { // If the secret has not been set print it to the console. if *secret == secretDefault { - fmt.Printf("SECRET=%s\n", secretDefault) + log.Printf("SECRET=%s\n", secretDefault) } // Initialize the database. @@ -52,12 +53,12 @@ func main() { // Create the network listener. lis, err := net.Listen("tcp", fmt.Sprintf(":%d", *port)) if err != nil { - fmt.Printf("Failed to listen: %v", err) + log.Fatal(err) } // Start listening for requests. srv := grpc.NewServer() proto.RegisterUsersServer(srv, server.NewUsersServer(secret, db)) - fmt.Printf("Listening on :%d", *port) + log.Printf("Listening on :%d", *port) srv.Serve(lis) }