Skip to content

Commit c10859a

Browse files
committed
[users] improve logging
1 parent bec8daf commit c10859a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

internal/sms-gateway/users/service.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@ package users
22

33
import (
44
"context"
5+
"errors"
56
"fmt"
67

8+
"github.com/android-sms-gateway/server/pkg/cache"
79
"github.com/android-sms-gateway/server/pkg/crypto"
810
"go.uber.org/zap"
911
)
@@ -70,6 +72,8 @@ func (s *Service) Login(ctx context.Context, username, password string) (*User,
7072
cachedUser, err := s.cache.Get(ctx, username, password)
7173
if err == nil {
7274
return cachedUser, nil
75+
} else if !errors.Is(err, cache.ErrKeyNotFound) {
76+
s.logger.Warn("failed to get user from cache", zap.String("username", username), zap.Error(err))
7377
}
7478

7579
user, err := s.users.GetByID(username)

0 commit comments

Comments
 (0)