DEV 1666: Fix /end requests and clean up logging (#109)
* ensure /end request is always called, and refactor win/draw logic * clean up logging and error handling during initialization * automatically generate friendly snake names * title-case snake names * print out list of alive snake names instead of count * log snake names, IDs, and URLs at startup * print out state for turn zero
This commit is contained in:
parent
006f394355
commit
09aea9c49d
10 changed files with 317 additions and 151 deletions
|
|
@ -2,10 +2,11 @@ package commands
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
log "github.com/spf13/jwalterweatherman"
|
||||
|
||||
"github.com/BattlesnakeOfficial/rules/maps"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
type mapInfo struct {
|
||||
|
|
@ -35,7 +36,7 @@ func NewMapInfoCommand() *cobra.Command {
|
|||
if len(args) < 1 {
|
||||
err := cmd.Help()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
log.ERROR.Fatal(err)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
|
@ -59,7 +60,7 @@ func NewMapInfoCommand() *cobra.Command {
|
|||
func (m *mapInfo) display(id string) {
|
||||
gameMap, err := maps.GetMap(id)
|
||||
if err != nil {
|
||||
log.Fatalf("Failed to load game map %#v: %v", id, err)
|
||||
log.ERROR.Fatalf("Failed to load game map %v: %v", id, err)
|
||||
}
|
||||
meta := gameMap.Meta()
|
||||
fmt.Println("Name:", meta.Name)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue