added more logging to control requests

This commit is contained in:
Stephen McQuay 2013-10-14 00:17:12 -07:00
parent 158c7d90d8
commit f4e2e84676
1 changed files with 3 additions and 0 deletions

View File

@ -16,6 +16,7 @@ func (h JsonHandler) ServeHTTP(w http.ResponseWriter, req *http.Request) {
}
func startGame(w http.ResponseWriter, req *http.Request) {
log.Println("asked to create a game")
new_game_name := idg.Hash()
_g := NewGame(new_game_name, *width, *height)
@ -36,6 +37,7 @@ func startGame(w http.ResponseWriter, req *http.Request) {
}
func listGames(w http.ResponseWriter, req *http.Request) {
log.Println("games list requested")
games.RLock()
defer games.RUnlock()
type pout struct {
@ -68,6 +70,7 @@ func listGames(w http.ResponseWriter, req *http.Request) {
func stopGame(w http.ResponseWriter, req *http.Request) {
trimmed := strings.Trim(req.URL.Path, "/")
fullPath := strings.Split(trimmed, "/")
log.Println(req.URL.Path)
if len(fullPath) != 3 {
http.Error(w, "improperly formed url", http.StatusBadRequest)
return