diff --git a/chess.go b/chess.go index 22c16e1..8b95d28 100644 --- a/chess.go +++ b/chess.go @@ -13,7 +13,7 @@ import ( ) func chessCommand(m chat1.MsgSummary) { - defer log.PanicSafe() + defer log.PanicSafe("chessCommand") convID := string(m.ConvID) parts := strings.Split(m.Content.Text.Body, " ") if g, ok := config.Games[convID]; ok { @@ -28,6 +28,7 @@ func chessCommand(m chat1.MsgSummary) { submitMove(m, &g) return } + log.LogInfo("Game not found") if len(parts) < 3 { return } @@ -66,7 +67,7 @@ func chessCommand(m chat1.MsgSummary) { } func showBoard(m chat1.MsgSummary, g *Game) { - defer log.PanicSafe() + defer log.PanicSafe("showBoard") // create file f, err := os.Create(fmt.Sprintf("/home/chessbot/chessbot/games/%+v.svg", m.ConvID)) if err != nil { @@ -103,7 +104,7 @@ func showBoard(m chat1.MsgSummary, g *Game) { } func submitMove(m chat1.MsgSummary, g *Game) { - defer log.PanicSafe() + defer log.PanicSafe("submitMove") defer saveConfig() parts := strings.Split(m.Content.Text.Body, " ") if g.Move { diff --git a/config.go b/config.go index 1f4bc60..d2c22aa 100644 --- a/config.go +++ b/config.go @@ -13,7 +13,7 @@ func loadConfig() Config { } func saveConfig() { - defer log.PanicSafe() + defer log.PanicSafe("saveConfig") log.LogInfo("Saving config.") file, err := json.Marshal(config) if err != nil { diff --git a/go.mod b/go.mod index b314fcb..6eac495 100644 --- a/go.mod +++ b/go.mod @@ -5,9 +5,8 @@ go 1.15 require ( git.nightmare.haus/rudi/chessv2 v0.0.0-20201030161310-809f6e9c5b9b github.com/ajstarks/svgo v0.0.0-20200725142600-7a3c8b57fecb // indirect - github.com/bwmarrin/discordgo v0.22.0 github.com/llgcode/draw2d v0.0.0-20200930101115-bfaf5d914d1e github.com/rogpeppe/misc v0.0.0-20200516092017-43a33a8f4c44 - github.com/rudi9719/loggy v0.0.0-20201030144506-35d9b032ab93 + github.com/rudi9719/loggy v0.0.0-20201031035735-9438c484de9a samhofi.us/x/keybase/v2 v2.0.6 ) diff --git a/go.sum b/go.sum index 6bd95e9..852e5f1 100644 --- a/go.sum +++ b/go.sum @@ -16,6 +16,8 @@ github.com/rogpeppe/misc v0.0.0-20200516092017-43a33a8f4c44 h1:osBnWuJgXxjdv/zUO github.com/rogpeppe/misc v0.0.0-20200516092017-43a33a8f4c44/go.mod h1:hT7K6J2LNwUaaq7rtwF5VMB9kQ9yf7HgYFNVOOf41OI= github.com/rudi9719/loggy v0.0.0-20201030144506-35d9b032ab93 h1:GjCI3CXdGt2PysVpObVzmKqMgKf3RlsKLBnaSOqPpUk= github.com/rudi9719/loggy v0.0.0-20201030144506-35d9b032ab93/go.mod h1:s1ANCN8bF6HwwTpJLR458MFVGua9oqKKDbph/2jptL4= +github.com/rudi9719/loggy v0.0.0-20201031035735-9438c484de9a h1:4rkaWoLCWOmra5Mw/dLAWjtDLT/+i5uTX1qhlMVL8WA= +github.com/rudi9719/loggy v0.0.0-20201031035735-9438c484de9a/go.mod h1:s1ANCN8bF6HwwTpJLR458MFVGua9oqKKDbph/2jptL4= golang.org/x/crypto v0.0.0-20181030102418-4d3f4d9ffa16/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81 h1:00VmoueYNlNz/aHIilyyQz/MHSqGoWJzpFv/HW8xpzI= golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81/go.mod h1:ux5Hcp/YLpHSI86hEcLt0YII63i6oz57MZXIpbrjZUs= diff --git a/main.go b/main.go index 806b595..93ac278 100755 --- a/main.go +++ b/main.go @@ -25,7 +25,7 @@ var ( ) func printChat(m chat1.MsgSummary) { - defer log.PanicSafe() + defer log.PanicSafe("printChat") if m.Sender.Username == k.Username { return } @@ -40,7 +40,7 @@ func main() { fmt.Println("Starting log") log = loggy.NewLogger(config.LogOpts) fmt.Println("Log configured") - defer log.PanicSafe() + defer log.PanicSafe("main") log.LogInfo("Logger configured") chat := printChat err := log.LogErrorType @@ -52,7 +52,7 @@ func main() { k.Run(handlers, &keybase.RunOptions{}) } func svgToPNG(path string) bool { - defer log.PanicSafe() + defer log.PanicSafe("svgToPNG") file, err := os.Open(fmt.Sprintf("%+v.svg", path)) if err != nil { return false