debug logs

This commit is contained in:
nquidox 2026-04-01 18:35:08 +03:00
parent 081267a662
commit cf84b598d0
2 changed files with 12 additions and 0 deletions

View file

@ -3,10 +3,13 @@ package user
import ( import (
"context" "context"
"errors" "errors"
log "github.com/sirupsen/logrus"
"merch-api/internal/common" "merch-api/internal/common"
"merch-api/pkg/utils" "merch-api/pkg/utils"
) )
const serviceLogHeader string = "service |"
type service struct { type service struct {
repo Repository repo Repository
utils utils.Utils utils utils.Utils
@ -56,6 +59,7 @@ func (s *service) getPersonalData(ctx context.Context, userUuid string) (*common
if userUuid == "" { if userUuid == "" {
return nil, errors.New("user uuid is empty") return nil, errors.New("user uuid is empty")
} }
log.WithField("user_uuid", userUuid).Debugf("%v %v get personal data", pkgLogHeader, serviceLogHeader)
return s.authDP.GetPersonalData(ctx, userUuid) return s.authDP.GetPersonalData(ctx, userUuid)
} }

View file

@ -3,11 +3,14 @@ package authCheck
import ( import (
"context" "context"
"errors" "errors"
log "github.com/sirupsen/logrus"
"merch-api/internal/common" "merch-api/internal/common"
verifyV1 "merch-api/pkg/verify/v1" verifyV1 "merch-api/pkg/verify/v1"
"time" "time"
) )
const serviceLogHeader = "service |"
type service struct { type service struct {
client verifyV1.AuthServiceClient client verifyV1.AuthServiceClient
timeout time.Duration timeout time.Duration
@ -49,6 +52,11 @@ func (s *service) GetPersonalData(ctx context.Context, userUuid string) (*common
runCtx, cancel := context.WithTimeout(ctx, s.timeout) runCtx, cancel := context.WithTimeout(ctx, s.timeout)
defer cancel() defer cancel()
log.WithFields(log.Fields{
"userUuid": userUuid,
"serviceId": s.serviceId,
}).Debugf("%v %v get personal data")
response, err := s.client.GetPersonalInfo(runCtx, &verifyV1.PersonalRequest{ response, err := s.client.GetPersonalInfo(runCtx, &verifyV1.PersonalRequest{
UserUuid: userUuid, UserUuid: userUuid,
ServiceId: s.serviceId, ServiceId: s.serviceId,