| 1234567891011121314151617181920212223242526272829303132333435363738394041 |
- package main
- import (
- "encoding/json"
- "log"
- "os"
-
- "battlecamp-go-server/stomp"
- "battlecamp-go-server/flag"
- "battlecamp-go-server/events"
- )
- var Server *string
- func main() {
- initLogging()
- log.Println("Game bot version 0.1")
-
- flag.ParseFlags()
-
- sub := stomp.Subscribe("game")
-
- for {
- announcement := <- sub
- gs := new(events.GameStart)
- json.Unmarshal(announcement.Body, &gs)
- log.Printf("announcement type: %v ", gs.Type)
- }
-
- }
- func initLogging() {
- logFile, err := os.Create("server.log")
- if err == nil {
- log.SetOutput(logFile)
- } else {
- log.Println("ERROR: Cannot open log file, using console.")
- log.Printf("%v=n", err)
- }
- }
|