go-telegram-bot-api / telegram-bot-api

Golang bindings for the Telegram Bot API
https://go-telegram-bot-api.dev
MIT License
5.7k stars 879 forks source link

Have a flag to stop logging empty responses during polling #559

Open aaronangxz opened 2 years ago

aaronangxz commented 2 years ago

Currently, when we set Debug = true, the following will be logged continuously:

...
2022/06/17 14:14:19 Endpoint: getUpdates, response: {"ok":true,"result":[]}
2022/06/17 14:14:19 Endpoint: getUpdates, params: map[allowed_updates:null offset:811825219 timeout:3600]
2022/06/17 14:15:09 Endpoint: getUpdates, response: {"ok":true,"result":[]}
2022/06/17 14:15:09 Endpoint: getUpdates, params: map[allowed_updates:null offset:811825219 timeout:3600]
...

It floods the log and frankly speaking I do not need this information.

Maybe we can have a flag or a different level of logging? Say

Log bool //Logs only relevant updates i.e.in this case if the response is empty it will skip
LogAll bool //Logs everything