Logging added

This commit is contained in:
2020-10-31 00:06:13 -04:00
parent a59696a069
commit 79f666dd0e
2 changed files with 3 additions and 2 deletions

View File

@ -69,11 +69,12 @@ func chessCommand(m chat1.MsgSummary) {
func showBoard(m chat1.MsgSummary, g *Game) { func showBoard(m chat1.MsgSummary, g *Game) {
defer log.PanicSafe("showBoard") defer log.PanicSafe("showBoard")
// create file // create file
log.LogInfo("Creating file for %+v.svg", m.ConvID)
f, err := os.Create(fmt.Sprintf("/home/chessbot/chessbot/games/%+v.svg", m.ConvID)) f, err := os.Create(fmt.Sprintf("/home/chessbot/chessbot/games/%+v.svg", m.ConvID))
if err != nil { if err != nil {
log.LogError(fmt.Sprintf("Error in ShowBoard os.Create: %+v\n", err)) log.LogError(fmt.Sprintf("Error in ShowBoard os.Create: %+v\n", err))
} }
log.LogInfo("Creating board position (g.Game.Position().String())")
// create board position // create board position
fenStr := g.Game.Position().String() fenStr := g.Game.Position().String()
pos := &chess.Position{} pos := &chess.Position{}
@ -95,6 +96,7 @@ func showBoard(m chat1.MsgSummary, g *Game) {
} }
} }
log.LogInfo("Closing file.")
f.Close() f.Close()
if svgToPNG(fmt.Sprintf("/home/chessbot/chessbot/games/%+v", m.ConvID)) { if svgToPNG(fmt.Sprintf("/home/chessbot/chessbot/games/%+v", m.ConvID)) {
k.UploadToConversation(m.ConvID, "", fmt.Sprintf("/home/chessbot/chessbot/games/%+v.png", m.ConvID)) k.UploadToConversation(m.ConvID, "", fmt.Sprintf("/home/chessbot/chessbot/games/%+v.png", m.ConvID))

View File

@ -33,7 +33,6 @@ func printChat(m chat1.MsgSummary) {
chessCommand(m) chessCommand(m)
return return
} }
log.LogInfo("%s: %s\n", m.Sender.Username, m.Content.Text.Body)
} }
func main() { func main() {
fmt.Println("Loading config.") fmt.Println("Loading config.")