From c4582aaaeef32cbfe852cecd2deb982eb0a1deca Mon Sep 17 00:00:00 2001 From: kkkkun Date: Fri, 16 Sep 2022 11:45:39 +0800 Subject: [PATCH] remove redundant log messages Signed-off-by: kkkkun --- pkg/osutil/interrupt_unix.go | 7 ++++--- server/etcdmain/etcd.go | 8 +++++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/pkg/osutil/interrupt_unix.go b/pkg/osutil/interrupt_unix.go index 78161d496..30ce20358 100644 --- a/pkg/osutil/interrupt_unix.go +++ b/pkg/osutil/interrupt_unix.go @@ -23,6 +23,8 @@ import ( "sync" "syscall" + "go.etcd.io/etcd/client/pkg/v3/verify" + "go.uber.org/zap" ) @@ -47,6 +49,7 @@ func RegisterInterruptHandler(h InterruptHandler) { // HandleInterrupts calls the handler functions on receiving a SIGINT or SIGTERM. func HandleInterrupts(lg *zap.Logger) { + verify.Assert(lg != nil, "the logger should not be nil") notifier := make(chan os.Signal, 1) signal.Notify(notifier, syscall.SIGINT, syscall.SIGTERM) @@ -60,9 +63,7 @@ func HandleInterrupts(lg *zap.Logger) { interruptExitMu.Lock() - if lg != nil { - lg.Info("received signal; shutting down", zap.String("signal", sig.String())) - } + lg.Info("received signal; shutting down", zap.String("signal", sig.String())) for _, h := range ihs { h() diff --git a/server/etcdmain/etcd.go b/server/etcdmain/etcd.go index 40f705904..0fc08a431 100644 --- a/server/etcdmain/etcd.go +++ b/server/etcdmain/etcd.go @@ -120,10 +120,12 @@ func startEtcdOrProxyV2(args []string) { ) } } else { + lg.Info( + "Initialize and start etcd server", + zap.String("data-dir", cfg.ec.Dir), + zap.String("dir-type", string(which)), + ) stopped, errc, err = startEtcd(&cfg.ec) - if err != nil { - lg.Warn("failed to start etcd", zap.Error(err)) - } } if err != nil {