From 79f666dd0e2f34689bcbcd1424a99aa0359272b4 Mon Sep 17 00:00:00 2001 From: Gregory Rudolph Date: Sat, 31 Oct 2020 00:06:13 -0400 Subject: [PATCH] Logging added --- chess.go | 4 +++- main.go | 1 - 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/chess.go b/chess.go index 8b95d28..c38a7d6 100644 --- a/chess.go +++ b/chess.go @@ -69,11 +69,12 @@ func chessCommand(m chat1.MsgSummary) { func showBoard(m chat1.MsgSummary, g *Game) { defer log.PanicSafe("showBoard") // 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)) if err != nil { log.LogError(fmt.Sprintf("Error in ShowBoard os.Create: %+v\n", err)) } - + log.LogInfo("Creating board position (g.Game.Position().String())") // create board position fenStr := g.Game.Position().String() pos := &chess.Position{} @@ -95,6 +96,7 @@ func showBoard(m chat1.MsgSummary, g *Game) { } } + log.LogInfo("Closing file.") f.Close() 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)) diff --git a/main.go b/main.go index 93ac278..24f616b 100755 --- a/main.go +++ b/main.go @@ -33,7 +33,6 @@ func printChat(m chat1.MsgSummary) { chessCommand(m) return } - log.LogInfo("%s: %s\n", m.Sender.Username, m.Content.Text.Body) } func main() { fmt.Println("Loading config.")