cleaned up some logging
This commit is contained in:
parent
d3070ad501
commit
c6c45ace51
1
game.go
1
game.go
@ -125,7 +125,6 @@ func NewGame(id string, width, height float32, obstacles, tick, maxPoints int, m
|
||||
|
||||
g.mode.setup(g)
|
||||
|
||||
log.Printf("NewGame: %+v", g)
|
||||
return g
|
||||
}
|
||||
|
||||
|
@ -21,8 +21,7 @@ func (p *player) sender() {
|
||||
}
|
||||
}
|
||||
p.ws.Close()
|
||||
// TODO
|
||||
log.Printf("player %s: sender close", p.Robots[0].Id)
|
||||
log.Printf("%s: robot (%s) sender close", p.Id, p.Robots[0].Id)
|
||||
}
|
||||
|
||||
func (p *player) recv() {
|
||||
@ -36,7 +35,7 @@ func (p *player) recv() {
|
||||
// TODO: perhaps we could be a bit more precise in the handling of
|
||||
// this 'error' by selecting on some kill signal channel and this
|
||||
// json read?
|
||||
log.Print("problem receiving JSON from player: ", err)
|
||||
log.Printf("%s: problem receiving JSON from player: %s", p.Id, err)
|
||||
break
|
||||
}
|
||||
|
||||
@ -101,6 +100,6 @@ func (p *player) recv() {
|
||||
}
|
||||
}
|
||||
|
||||
log.Printf("player %s: recv close", p.Robots[0].Id)
|
||||
log.Printf("%s: recv close", p.Id)
|
||||
p.ws.Close()
|
||||
}
|
||||
|
11
protocol.go
11
protocol.go
@ -204,7 +204,7 @@ func addPlayer(ws *websocket.Conn) {
|
||||
for {
|
||||
log.Printf("%s Waiting for client to send conf ...", player_id)
|
||||
err = websocket.JSON.Receive(ws, &conf)
|
||||
log.Printf("conf received: %+v", conf)
|
||||
log.Printf("%s: conf received: %+v", player_id, conf)
|
||||
|
||||
if err != nil {
|
||||
log.Printf("%s %s config parse error", gid.Id, player_id)
|
||||
@ -239,7 +239,7 @@ func addPlayer(ws *websocket.Conn) {
|
||||
Heading: v.Vector2d{1, 0},
|
||||
Scanners: make([]Scanner, 0)}
|
||||
r.Health = r.Stats.Hp
|
||||
log.Printf("Adding Robot: %+v", r)
|
||||
log.Printf("%s: adding robot: %s", p.Id, r.Id)
|
||||
r.reset(game)
|
||||
p.Robots = append(p.Robots, &r)
|
||||
}
|
||||
@ -251,7 +251,12 @@ func addPlayer(ws *websocket.Conn) {
|
||||
}()
|
||||
go p.sender()
|
||||
p.recv()
|
||||
log.Printf("game %s: player %v has been disconnected from this game\n", gid.Id, p.Robots[0].Id)
|
||||
log.Printf(
|
||||
"%s (player): %v (robot) has been disconnected from %s (game)",
|
||||
p.Id,
|
||||
p.Robots[0].Id,
|
||||
gid.Id,
|
||||
)
|
||||
case "spectator":
|
||||
s := &Spectator{
|
||||
send: make(chan Message),
|
||||
|
Loading…
Reference in New Issue
Block a user