diff --git a/internal/eval/bitpos.go b/internal/eval/bitpos.go index 2fac45a86..039a8035f 100644 --- a/internal/eval/bitpos.go +++ b/internal/eval/bitpos.go @@ -130,7 +130,7 @@ func getBitPos(byteSlice []byte, bitToFind byte, start, end int, rangeType strin return result } -//nolint: gocritic +// nolint: gocritic func adjustBitPosSearchRange(start, end, byteLen int) (int, int) { if start < 0 { start += byteLen diff --git a/internal/server/server.go b/internal/server/server.go index e7e141c48..fbdb8c8d4 100644 --- a/internal/server/server.go +++ b/internal/server/server.go @@ -97,7 +97,7 @@ func (s *AsyncServer) FindPortAndBind() (socketErr error) { return ErrInvalidIPAddress } - log.Infof("DiceDB running on port %d", config.Port) + log.Infof("DiceDB %s running on port %d", "0.0.3", config.Port) return syscall.Bind(serverFD, &syscall.SockaddrInet4{ Port: config.Port, Addr: [4]byte{ip4[0], ip4[1], ip4[2], ip4[3]}, @@ -110,7 +110,7 @@ func (s *AsyncServer) ClosePort() { if err := syscall.Close(s.serverFD); err != nil { log.Warn("failed to close server socket", "error", err) } else { - log.Info("Server socket closed successfully") + log.Debug("Server socket closed successfully") } s.serverFD = 0 } @@ -130,7 +130,6 @@ func (s *AsyncServer) InitiateShutdown() { } delete(s.connectedClients, fd) } - log.Info("cleaned up all client connections") } // Run starts the server, accepts connections, and handles client requests @@ -226,12 +225,9 @@ func (s *AsyncServer) eventLoop(ctx context.Context) error { } else { if err := s.handleClientEvent(event); err != nil { if errors.Is(err, ErrAborted) { - log.Info("Received abort command, initiating graceful shutdown") + log.Debug("Received abort command, initiating graceful shutdown") return err - } else if errors.Is(err, syscall.ECONNRESET) || errors.Is(err, net.ErrClosed) { - // Both are normal scenarios when client disconnections happen, hence just info log - log.Info("Connection closed by client or reset", "fd", event.Fd) - } else { + } else if !errors.Is(err, syscall.ECONNRESET) && !errors.Is(err, net.ErrClosed) { log.Warn(err) } } diff --git a/main.go b/main.go index 5422b1aee..99b3c5c16 100644 --- a/main.go +++ b/main.go @@ -57,17 +57,17 @@ func main() { // Handling different server errors if err != nil { if errors.Is(err, context.Canceled) { - log.Info("Server was canceled") + log.Debug("Server was canceled") } else if errors.Is(err, server.ErrAborted) { - log.Info("Server received abort command") + log.Debug("Server received abort command") } else { log.Error("Server error", "error", err) } } else { - log.Info("Server stopped without error") + log.Debug("Server stopped without error") } close(sigs) wg.Wait() - log.Info("Server has shut down gracefully") + log.Debug("Server has shut down gracefully") }