don't log at debug

This commit is contained in:
Branden J Brown 2024-02-02 18:40:57 -06:00
parent 2088a33b87
commit 66c37a655a
1 changed files with 7 additions and 7 deletions

14
game.go
View File

@ -69,7 +69,7 @@ func gameActor(ctx context.Context, g *game.Match, dealer, chall person, join <-
case <-ctx.Done(): case <-ctx.Done():
return return
case p := <-join: case p := <-join:
slog.DebugContext(ctx, "observer", "id", p.id) slog.InfoContext(ctx, "observer", "id", p.id)
// Deliver the game state just to the new observer. // Deliver the game state just to the new observer.
if err := wsjson.Write(ctx, p.conn, g.DTO(p.id)); err != nil { if err := wsjson.Write(ctx, p.conn, g.DTO(p.id)); err != nil {
// We don't need to track them as an observer. Just close their // We don't need to track them as an observer. Just close their
@ -80,7 +80,7 @@ func gameActor(ctx context.Context, g *game.Match, dealer, chall person, join <-
q := p.conn.CloseRead(ctx) q := p.conn.CloseRead(ctx)
obs = append(obs, observer{conn: p.conn, ctx: q}) obs = append(obs, observer{conn: p.conn, ctx: q})
case a := <-actions: case a := <-actions:
slog.DebugContext(ctx, "got action", "from", a.Player, "action", a.Action) slog.InfoContext(ctx, "got action", "from", a.Player, "action", a.Action)
err := applyAction(g, a) err := applyAction(g, a)
switch err { switch err {
case nil: case nil:
@ -124,7 +124,7 @@ func playerActor(ctx context.Context, p person, actions chan<- action) {
select { select {
case <-ctx.Done(): case <-ctx.Done():
case actions <- a: case actions <- a:
slog.DebugContext(ctx, "lost connection", "player", p.id, "err", err.Error()) slog.InfoContext(ctx, "lost connection", "player", p.id, "err", err.Error())
} }
return return
} }
@ -132,7 +132,7 @@ func playerActor(ctx context.Context, p person, actions chan<- action) {
case <-ctx.Done(): case <-ctx.Done():
return return
case actions <- a: case actions <- a:
slog.DebugContext(ctx, "action", "action", a) slog.InfoContext(ctx, "action", "action", a)
} }
} }
} }
@ -142,11 +142,11 @@ func broadcast(ctx context.Context, g *game.Match, dealer, chall person, obs []o
// if a player drops so that the actor knows to quit // if a player drops so that the actor knows to quit
if err := wsjson.Write(ctx, dealer.conn, g.DTO(dealer.id)); err != nil { if err := wsjson.Write(ctx, dealer.conn, g.DTO(dealer.id)); err != nil {
// TODO(zeph): concede, but we need to be careful not to recurse // TODO(zeph): concede, but we need to be careful not to recurse
slog.DebugContext(ctx, "lost dealer", "player", dealer.id, "err", err.Error()) slog.InfoContext(ctx, "lost dealer", "player", dealer.id, "err", err.Error())
} }
if err := wsjson.Write(ctx, chall.conn, g.DTO(chall.id)); err != nil { if err := wsjson.Write(ctx, chall.conn, g.DTO(chall.id)); err != nil {
// TODO(zeph): concede, but we need to be careful not to recurse // TODO(zeph): concede, but we need to be careful not to recurse
slog.DebugContext(ctx, "lost challenger", "player", chall.id, "err", err.Error()) slog.InfoContext(ctx, "lost challenger", "player", chall.id, "err", err.Error())
} }
if len(obs) == 0 { if len(obs) == 0 {
return return
@ -154,7 +154,7 @@ func broadcast(ctx context.Context, g *game.Match, dealer, chall person, obs []o
d := g.DTO(player.ID{}) d := g.DTO(player.ID{})
for _, p := range obs { for _, p := range obs {
if err := wsjson.Write(ctx, p.conn, &d); err != nil { if err := wsjson.Write(ctx, p.conn, &d); err != nil {
slog.DebugContext(ctx, "lost observer", "err", err.Error()) slog.InfoContext(ctx, "lost observer", "err", err.Error())
} }
} }
} }