Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add logging to show why snake was disconnected #6

Closed
noelbk opened this issue Feb 11, 2017 · 0 comments · Fixed by #7
Closed

Add logging to show why snake was disconnected #6

noelbk opened this issue Feb 11, 2017 · 0 comments · Fixed by #7

Comments

@noelbk
Copy link

noelbk commented Feb 11, 2017

For development, it'd be be handy if the server logged why it disconnects from a snake.

Here's a broken pipe error from my Python snake:

DEBUG:__main__:move: request=<Request 'http://172.17.0.1:5000/move' [POST]>
DEBUG:__main__:move: data={u'snakes': [{u'health_points': 98, u'taunt': u'taunt', u'coords': [[13, 2], [13, 3], [13, 4]], u'name': u'Genetisnake NBK', u'id': u'9e2c5b05-9d66-4fa7-ba8d-c834a441d4c2'}, {u'health_points': 98, u'taunt': u'taunt', u'coords': [[19, 13], [19, 14], [18, 14]], u'name': u'Genetisnake NBK', u'id': u'448a4bec-47ad-4ead-afe1-8afda2f6f65d'}], u'turn': 2, u'food': [[10, 3], [9, 11], [8, 9], [11, 8]], u'height': 20, u'width': 20, u'game_id': u'8760721f-08dd-46eb-a3d4-4a76f2d92ed1', u'you': u'9e2c5b05-9d66-4fa7-ba8d-c834a441d4c2'}
DEBUG:__main__:move: move=left
ERROR:werkzeug:Error on request:
Traceback (most recent call last):
  File "/home/noel/projects/battlesnake/genetisnake/env/lib/python2.7/site-packages/werkzeug/serving.py", line 205, in run_wsgi
    execute(self.server.app)
  File "/home/noel/projects/battlesnake/genetisnake/env/lib/python2.7/site-packages/werkzeug/serving.py", line 196, in execute
    write(data)
  File "/home/noel/projects/battlesnake/genetisnake/env/lib/python2.7/site-packages/werkzeug/serving.py", line 164, in write
    self.send_header(key, value)
  File "/usr/lib/python2.7/BaseHTTPServer.py", line 412, in send_header
    self.wfile.write("%s: %s\r\n" % (keyword, value))
IOError: [Errno 32] Broken pipe

and here's battle_snake_server's iex output: https://gist.github.com/b3141062ca8e01bed7569c325096e64a

[info] Sent 200 in 837µs
[info] JOIN board_viewer:8760721f-08dd-46eb-a3d4-4a76f2d92ed1 to BattleSnake.BoardViewerChannel
  Transport:  Phoenix.Transports.WebSocket
  Parameters: %{"contentType" => "html"}
[info] Replied board_viewer:8760721f-08dd-46eb-a3d4-4a76f2d92ed1 :ok
[info] JOIN game_admin:8760721f-08dd-46eb-a3d4-4a76f2d92ed1 to BattleSnake.GameAdminChannel
  Transport:  Phoenix.Transports.WebSocket
  Parameters: %{}
[info] Replied game_admin:8760721f-08dd-46eb-a3d4-4a76f2d92ed1 :ok
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant