infra: add logging wrapping

Resolves issues with gcp cloud logging quirks such as field names
This commit is contained in:
Arjun Patel
2026-05-27 15:49:27 -07:00
parent e804cee229
commit 563c91e7d5
30 changed files with 347 additions and 250 deletions
+9 -7
View File
@@ -5,17 +5,19 @@ import (
"errors"
"fmt"
"html"
"log/slog"
"slices"
"strings"
"github.com/flowy-live/llink/internal/utils/flog"
"github.com/jackc/pgx/v5"
"github.com/jackc/pgx/v5/pgxpool"
pbaero "github.com/flowy-live/llink/genproto/aero"
"github.com/flowy-live/llink/internal/billing"
"github.com/flowy-live/llink/internal/constants"
"github.com/flowy-live/llink/internal/livestore"
"github.com/flowy-live/llink/internal/utils"
"github.com/jackc/pgx/v5"
"github.com/jackc/pgx/v5/pgxpool"
)
var ErrNotFound = errors.New("network not found")
@@ -91,7 +93,7 @@ func (s *serviceImpl) Create(ctx context.Context, name, adminHumanId string) (*N
},
})
if err != nil {
slog.Warn("unable to send admin update email", "error", err)
flog.Warn("unable to send admin update email", "error", err)
}
return network, nil
@@ -149,13 +151,13 @@ func (s *serviceImpl) RemoveMember(ctx context.Context, networkID, humanId strin
// Postgres is the source of truth: failures are logged and the reconciler heals drift.
func (s *serviceImpl) mirrorAddMembership(ctx context.Context, humanId, networkID string) {
if err := s.pub.Add(ctx, humanId, networkID); err != nil {
slog.Error("membership publish add failed", "error", err, "humanId", humanId, "networkID", networkID)
flog.Error("membership publish add failed", "error", err, "humanId", humanId, "networkID", networkID)
}
}
func (s *serviceImpl) mirrorRemoveMembership(ctx context.Context, humanId, networkID string) {
if err := s.pub.Remove(ctx, humanId, networkID); err != nil {
slog.Error("membership publish remove failed", "error", err, "humanId", humanId, "networkID", networkID)
flog.Error("membership publish remove failed", "error", err, "humanId", humanId, "networkID", networkID)
}
}
@@ -214,7 +216,7 @@ func (s *serviceImpl) InviteByEmail(ctx context.Context, networkID string, email
},
})
if err != nil {
slog.Warn("unable to send email notification", "email", email, "network", network.Name)
flog.Warn("unable to send email notification", "email", email, "network", network.Name)
}
}
return nil