1
0
mirror of synced 2024-11-25 13:16:02 +03:00

add logging in webhook methods

This commit is contained in:
DmitryZagorulko 2018-06-01 13:38:34 +03:00
parent f880b6f8fa
commit 39d38391d0

View File

@ -32,6 +32,11 @@ func GetBotName(bot *tgbotapi.BotAPI) string {
} }
func telegramWebhookHandler(w http.ResponseWriter, r *http.Request, token 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) b, err := getBotByToken(token)
if err != nil { if err != nil {
raven.CaptureErrorAndWait(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) { 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) bytes, err := ioutil.ReadAll(r.Body)
if err != nil { if err != nil {
raven.CaptureErrorAndWait(err, nil) raven.CaptureErrorAndWait(err, nil)