all repos — telegram-bot-api @ e21c8668476e99fea8312247293cae14444af05a

Golang bindings for the Telegram Bot API

Merge pull request #191 from yanmhlv/master

added custom logger and SetLogger function
Syfaro syfaro@huefox.com
Mon, 27 Aug 2018 15:38:41 -0500
commit

e21c8668476e99fea8312247293cae14444af05a

parent

4c16a90966d12d963e19e4df99e7744c191d0e79

3 files changed, 17 insertions(+), 2 deletions(-)

jump to
M bot.gobot.go

@@ -9,7 +9,6 @@ "errors"

"fmt" "io" "io/ioutil" - "log" "net/http" "net/url" "os"
M helpers.gohelpers.go

@@ -1,7 +1,6 @@

package tgbotapi import ( - "log" "net/url" )
A log.go

@@ -0,0 +1,17 @@

+package tgbotapi + +import ( + "os" + "errors" + stdlog "log" +) + +var log = stdlog.New(os.Stderr, "", stdlog.LstdFlags) + +func SetLogger(newLog *stdlog.Logger) error { + if newLog == nil { + return errors.New("logger is nil") + } + log = newLog + return nil +}