extended logging #453

Merged
tech merged 1 commits from mntx-452 into main 2026-02-10 10:25:10 +00:00
Showing only changes of commit f59789ab7a - Show all commits

View File

@@ -10,6 +10,7 @@ import (
ri "github.com/tech/sendico/pkg/db/repository/index" ri "github.com/tech/sendico/pkg/db/repository/index"
"github.com/tech/sendico/pkg/merrors" "github.com/tech/sendico/pkg/merrors"
"github.com/tech/sendico/pkg/mlogger" "github.com/tech/sendico/pkg/mlogger"
"github.com/tech/sendico/pkg/mutil/mzap"
"go.mongodb.org/mongo-driver/v2/bson" "go.mongodb.org/mongo-driver/v2/bson"
"go.mongodb.org/mongo-driver/v2/mongo" "go.mongodb.org/mongo-driver/v2/mongo"
"go.uber.org/zap" "go.uber.org/zap"
@@ -85,10 +86,19 @@ func (p *Payouts) Upsert(ctx context.Context, record *model.CardPayout) error {
} }
if record.ID == bson.NilObjectID { if record.ID == bson.NilObjectID {
return p.repository.Insert(ctx, record, nil) if err := p.repository.Insert(ctx, record, nil); err != nil {
p.logger.Warn("Failed to insert new record", zap.Error(err), zap.String("operation_Ref", record.OperationRef))
return err
}
return nil
} }
return p.repository.Update(ctx, record) if err := p.repository.Update(ctx, record); err != nil {
p.logger.Warn("Failed to update existing record", zap.Error(err),
zap.String("operation_Ref", record.OperationRef), mzap.ObjRef("payout_ref", record.ID))
return err
}
return nil
} }
var _ storage.PayoutsStore = (*Payouts)(nil) var _ storage.PayoutsStore = (*Payouts)(nil)