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
|
|
@ -3,9 +3,10 @@ package commands
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
|
||||
log "github.com/spf13/jwalterweatherman"
|
||||
|
||||
"github.com/BattlesnakeOfficial/rules/client"
|
||||
)
|
||||
|
||||
|
|
@ -30,7 +31,7 @@ func (ge *GameExporter) FlushToFile(filepath string, format string) error {
|
|||
if format == "JSONL" {
|
||||
formattedOutput, formattingErr = ge.ConvertToJSON()
|
||||
} else {
|
||||
log.Fatalf("Invalid output format passed: %s", format)
|
||||
log.ERROR.Fatalf("Invalid output format passed: %s", format)
|
||||
}
|
||||
|
||||
if formattingErr != nil {
|
||||
|
|
@ -50,7 +51,7 @@ func (ge *GameExporter) FlushToFile(filepath string, format string) error {
|
|||
}
|
||||
}
|
||||
|
||||
log.Printf("Written %d lines of output to file: %s\n", len(formattedOutput), filepath)
|
||||
log.DEBUG.Printf("Written %d lines of output to file: %s\n", len(formattedOutput), filepath)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue