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

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

Is it real to write built-in logs to file? #476

Open olegnysss opened 3 years ago

olegnysss commented 3 years ago

By studying this package I didn't find possibility to write logs to file. Is this possible? If no, can I implement it and send Pull Request?

Syfaro commented 2 years ago

Hi, sorry about the delay in replying! The current logging situation is pretty bad, but #456 addresses this by allowing per-instance bot logging configuration. Once that's implemented, you can set the logger to something that writes entries to a file.

temamagic commented 2 years ago

Still no answer?

You can implement

type BotLogger interface {
    Println(v ...interface{})
    Printf(format string, v ...interface{})
}

And set up to the tgbotapi.SetLogger

Does this fit as a solution?