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
+7 -6
View File
@@ -2,13 +2,14 @@ package pusher
import (
"context"
"log/slog"
"net/http"
"github.com/flowy-live/llink/genproto/llink/pusher"
"github.com/flowy-live/llink/internal/auth"
"github.com/google/uuid"
"nhooyr.io/websocket"
pbpusher "github.com/flowy-live/llink/genproto/llink/pusher"
"github.com/flowy-live/llink/internal/auth"
"github.com/flowy-live/llink/internal/utils/flog"
)
// Server handles WebSocket upgrades and gRPC presence queries.
@@ -49,14 +50,14 @@ func (s *Server) HandleWebSocket(w http.ResponseWriter, r *http.Request) {
InsecureSkipVerify: true,
})
if err != nil {
slog.Error("websocket accept failed", "error", err)
flog.Error("websocket accept failed", "error", err)
return
}
connID := uuid.New().String()
conn := newConn(connID, session.HumanId, ws)
slog.Info("websocket connected", "connId", connID, "humanId", session.HumanId)
flog.Info("websocket connected", "connId", connID, "humanId", session.HumanId)
// Use the server context, not r.Context(): after upgrade the HTTP request
// context can be cancelled by load balancers and nhooyr/websocket would
@@ -70,7 +71,7 @@ func (s *Server) HandleWebSocket(w http.ResponseWriter, r *http.Request) {
go conn.WritePump(ctx)
conn.ReadPump(ctx, s.hub)
slog.Info("websocket disconnected", "connId", connID, "humanId", session.HumanId)
flog.Info("websocket disconnected", "connId", connID, "humanId", session.HumanId)
}
func (s *Server) GetOnlineHumanIds(ctx context.Context, _ *pbpusher.GetOnlineHumanIdsRequest) (*pbpusher.GetOnlineHumanIdsResponse, error) {