From 1feeefae582f62f682e7e4e8b746cd0983684e5a Mon Sep 17 00:00:00 2001 From: Ian Shim <100327837+ian-shim@users.noreply.github.com> Date: Mon, 13 Nov 2023 11:09:09 -0800 Subject: [PATCH] Include `err` on fatal log (#8) --- inabox/deploy/config.go | 2 +- node/grpc/server.go | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/inabox/deploy/config.go b/inabox/deploy/config.go index a84400a32..fbdcf21aa 100644 --- a/inabox/deploy/config.go +++ b/inabox/deploy/config.go @@ -248,7 +248,7 @@ func (env *Config) generateOperatorVars(ind int, name, key, churnerUrl, logPath, //Generate cryptographically strong pseudo-random between 0 - max n, err := rand.Int(rand.Reader, max) if err != nil { - log.Fatal("Could not generate key") + log.Fatalf("Could not generate key: %v", err) } //String representation of n in base 32 diff --git a/node/grpc/server.go b/node/grpc/server.go index 8731e2779..f40d7fac5 100644 --- a/node/grpc/server.go +++ b/node/grpc/server.go @@ -3,7 +3,6 @@ package grpc import ( "context" "fmt" - "log" "net" @@ -77,7 +76,7 @@ func (s *Server) serveDispersal() error { addr := fmt.Sprintf("%s:%s", localhost, s.config.InternalDispersalPort) listener, err := net.Listen("tcp", addr) if err != nil { - log.Fatal("Could not start tcp listener") + s.logger.Fatalf("Could not start tcp listener: %w", err) } opt := grpc.MaxRecvMsgSize(1024 * 1024 * 1024) // 1 GiB @@ -98,11 +97,10 @@ func (s *Server) serveDispersal() error { } func (s *Server) serveRetrieval() error { - addr := fmt.Sprintf("%s:%s", localhost, s.config.InternalRetrievalPort) listener, err := net.Listen("tcp", addr) if err != nil { - log.Fatal("Could not start tcp listener") + s.logger.Fatalf("Could not start tcp listener: %w", err) } opt := grpc.MaxRecvMsgSize(1024 * 1024 * 300) // 300 MiB