1
0
mirror of synced 2024-11-22 12:26:02 +03:00

Merge pull request #10 from gwinn/master

add logging in webhook methods
This commit is contained in:
Alex Lushpai 2018-06-01 13:44:34 +03:00 committed by GitHub
commit e2ffd603a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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)