From 39d38391d00c91befbec042064e8ebbbe5758d2e Mon Sep 17 00:00:00 2001 From: DmitryZagorulko Date: Fri, 1 Jun 2018 13:38:34 +0300 Subject: [PATCH] add logging in webhook methods --- telegram.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/telegram.go b/telegram.go index c0b6d6c..2cee350 100644 --- a/telegram.go +++ b/telegram.go @@ -32,6 +32,11 @@ func GetBotName(bot *tgbotapi.BotAPI) string { } func telegramWebhookHandler(w http.ResponseWriter, r *http.Request, token string) { + if config.Debug { + var v interface{} + json.NewDecoder(r.Body).Decode(&v) + logger.Debugf("token: %v mgWebhookHandler: %v", token, v) + } b, err := getBotByToken(token) if err != nil { raven.CaptureErrorAndWait(err, nil) @@ -141,6 +146,11 @@ func telegramWebhookHandler(w http.ResponseWriter, r *http.Request, token string } func mgWebhookHandler(w http.ResponseWriter, r *http.Request) { + if config.Debug { + var v interface{} + json.NewDecoder(r.Body).Decode(&v) + logger.Debugf("mgWebhookHandler: %v", v) + } bytes, err := ioutil.ReadAll(r.Body) if err != nil { raven.CaptureErrorAndWait(err, nil)