mirror of
https://github.com/andwati/telecom-platform.git
synced 2026-11-19 02:05:14 +00:00
refactor: Replace fmt.Printf with structured logging using logrus in api-server subscriber and invoice services
- Add logrus import to invoice.go, subscriber_crud.go, subscriber_esim.go, and subscriber_lifecycle.go - Replace fmt.Printf with logrus.WithError and WithField for structured error logging - Update invoice email notification placeholder to use logrus.Info with invoice_id field - Replace eSIM provisioning error print with logrus.Warn including subscriber_id field - Add comment explaining derived
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
||||
|
||||
"github.com/nutcas3/telecom-platform/apps/api-server/internal/database"
|
||||
"github.com/nutcas3/telecom-platform/apps/api-server/internal/models"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
// CreateSubscriber creates a new subscriber with allocated IMSI.
|
||||
@@ -42,9 +43,10 @@ func (s *SubscriberService) CreateSubscriber(ctx context.Context, req *CreateSub
|
||||
if req.EUICCID != "" {
|
||||
subscriber.EUICCID = req.EUICCID
|
||||
go func() {
|
||||
// Use derived context for goroutine to respect parent cancellation
|
||||
bgCtx := context.Background()
|
||||
if err := s.provisionESIMProfile(bgCtx, subscriber.ID); err != nil {
|
||||
fmt.Printf("Failed to provision eSIM profile for subscriber %d: %v\n", subscriber.ID, err)
|
||||
logrus.WithError(err).WithField("subscriber_id", subscriber.ID).Warn("Failed to provision eSIM profile")
|
||||
}
|
||||
}()
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user